ADIC

 -d5
 -mforward

execution the canonicalization:

  ADIC.cpp:257
      state->setContext("Canonicalization");
      canonC.canonicalizeFile();

Things I have to change in ADIC

 #pragma omp parallel for
is gonna be a SgOmpParallelStatement and the for loop is gonna be a successor node of this node.
canon/StmtCanon.cpp 2032: Unknown nodes SgOmpParallelStatement
So I add this kind of node and handle loop as SgForStatement

4528: case V_SgOmpParallelStatement:

    {
        SgOmpParallelStatement * ompparallelstmt=isSgOmpParallelStatement(astNode);
        ROSE_ASSERT(ompparallelstmt != NULL);
	    SgStatement * ompbody =  ompparallelstmt->get_body();
	    if (ompbody->variantT()==V_SgOmpForStatement){
	        SgOmpForStatement* ompforstmt = isSgOmpForStatement(ompbody);
	        ROSE_ASSERT(ompforstmt!=NULL);
	        SgStatement * ompforbody =  ompforstmt->get_body();
	        ROSE_ASSERT(ompforbody != NULL);
	        SgForStatement * for_loop = isSgForStatement(ompforbody);
            findAllMemRefsAndPtrAssigns( for_loop, stmt );
	    }
    	break;
    }
     // Michael: SgOmpParallelStatement handling is needed here
     SgOmpParallelStatement * ompparallelstmt=isSgOmpParallelStatement(sgLoopStatement);
     ...
   OA::StmtHandle SageIRInterface::loopHeader(OA::StmtHandle h)
This Method needs to be able to perform OmpLoops
    OA::CFG::IRStmtType SageIRInterface::getCFGStmtType(OA::StmtHandle h)
    case V_SgOmpParallelStatement:
    ...
Handle of SgOmpParallelStatement is needed
add a class for parallel loop

How things work inside ADIC.cpp

 ADIC.cpp:195:  for (SgFilePtrList::iterator iter = fptr->begin(); iter != fptr->end(); iter++) {
 ADIC.cpp:503: }
here the file rose_originalname.c is being created.
Here the rose file is copied into preXB file.
      state->setContext("Sage2XAIF");
      XAIFGlobalTraverse * globTraverse = new XAIFGlobalTraverse(canonC, &global_node_count_offset, XAIFCallGraph);
      syn = globTraverse->traverse(*iter, inh);
     adic::SgXAIF::CallGraph  * XAIFCallGraph =  new adic::SgXAIF::CallGraph();
      XAIFGlobalTraverse * globTraverse = new XAIFGlobalTraverse(canonC, &global_node_count_offset, XAIFCallGraph);
      syn = globTraverse->traverse(*iter, inh);
      state->setContext("OA2XAIF");
      OAtoXAIFConverter(psgproj, XAIFCallGraph).callGraph(NULL, inh , FALSE);
main/ADIC.cpp:334
    xaif/OA2XAIFGraph.cpp:75
    Alias/ManagerFIAliasAliasTag.cpp:43
    Alias/ManagerFIAlias.cpp:419
    Alias/ManagerFIAlias.cpp:449
    Alias/ManagerFIAlias.cpp:1050
    Alias/ManagerFIAlias.cpp:952
    Sage2OA.C:3949
    MemSage2OA.C:32
    MemSage2OA.C:76
    MemSage2OA.C:643
    MemSage2OA.C:894
Here the nodes are being all tested.
       ControlFlowGraph * cfg = CreateCFG(fundef, inh, XaifCallGraph, &count_ptr);
   ControlFlowGraph * OAtoXAIFConverter::CreateCFG(
   ...
CreateCFG.cpp:656: ControlFlowGraph * cfgp=new ControlFlowGraph(*cg,

convertIntToString(ControlFlowGraph::count));

  CreateCFG.cpp:755: else if(isForBlock(n, irInterface, forloopupdateOANodes)
    adic::SgXAIF::OAtoXAIFConverter::CreateCFG
	      debugMsg(4,"done with cfg vertices, now do edges");
      state->setContext("PrintXAIF");
      globTraverse->sageToGraph(((*iter)->get_file_info())->get_filenameString());
This creates the file originalname.c.xaif
    psgproj->unparse();
    std::string filename = (*iter)->getFileName();
    std::string xaiffilename = filename + ".xaif";
      state->setContext("AD");
      debugMsg(1,"**** AD step, calling xaifBooster *****");
      std::string adxaiffilename = getDir(xaiffilename) + std::string("ad_") + getBaseFilename(xaiffilename);
     ...
      // invoke XAIF module
      std::string command;
      if (state->getDifferentiationModule() == "") {
        command = state->baseDir + "/bin/xaifBooster";
      } else {
        command = state->getDifferentiationModule();
      }
      command += " -v -i " + xaiffilename + " -o " + adxaiffilename + " -s "
          + state->getXaifSchemaLocation() + " -c " + intrinsicsFile;
      debugMsg(2, "XAIFBOOSTER command: "<< command.c_str());
      system(command.c_str());
    // Check if differentiated XAIF file exists
    state->setContext("ad_XAIF Parsing");
    if (stat(xaiffilename.c_str(), &statStruct)<0) {
      // File does not exist
      fatal(
          "Differentiated XAIF file not found (check differentiation module errors).");
    }
    debugMsg(2, "****************** reading produced XAIF back ****************");
    XAIFParser debuggingParser;
    try {
      debuggingParser.parse(xaiffilename);
    } catch (const XMLException& toCatch) {
      fatal("Error encountered when parsing differentiated XAIF.");
    }
    debuggingParser.parse(xaiffilename);
    debugMsg(3, "---- Successfully Parsed XAIF Graph in "<<
        xaiffilename.c_str());
    debugMsg(5, "XML Output: ----");
    ...
    // Convert to Sage
    state->setContext("XAIF2Sage");
    debugMsg(2, "****************** converting XAIF to Sage ****************");
    DFSVisitor_XAIF2Sage xaif2SageVisitor(*iter,state);
      std::string command = "mv " + roseFileName + " " + diffFileName;
      system(command.c_str());
}

How to set an attribute inside of an xaif element

      virtual void initAttributes() {
        setAttribute("ElementName", "ForLoop");
        setAttribute("myTestElementName", "asdf");
      }
    <xaif:ForLoop myTestElementName="asdf" vertex_id="4">

Unsorted things that might be useful but I don't know how yet

    initAttributes(); forloop.addChild(this);
}
    {
    public:
      ForLoop(std::string id) : ControlFlowVertex(id)
      {        initAttributes();      }
      ForLoop(ControlFlowGraph& cfg, std::string id) : ControlFlowVertex(id)
      {        initAttributes();        cfg.addVertex(this);      }
      ForLoop(Replacement& rp, std::string id) : ControlFlowVertex(id)
      {        initAttributes();        rp.addVertex(this);      }
      ~ForLoop()      {      }
      virtual void      initAttributes()      {
        setAttribute("ElementName", "ForLoop");
      }
      Expression* getCondition()     {
        return condition;
      }
      void setCondition(Expression& cond)
      {
        condition = &cond;
        this->addChild(condition);
        condition->setAttribute("ElementName", "Condition");
      }

      Assignment* getInitialization() {
        return initialization;
      }
      void setInitialization(Assignment& init) {
        initialization = &init;
        this->addChild(initialization);
        initialization->setAttribute("ElementName", "Initialization");
      }

      Assignment* getUpdate()      {
        return update;
      }
      void      setUpdate(Assignment& updt)      {
        update = &updt;
        this->addChild(update);
        update->setAttribute("ElementName", "Update");
      }

    private:
      Expression *condition;
      Assignment * initialization;
      Assignment * update;
    };

xaif/XAIFVisitor.cpp

// file xaif/XAIFVisitors.cpp:152 void DFSVisitor_XAIF2Sage::onStartElement(XAIFElement *e, bool empty)
    {
      SgExpression *sgExpr = NULL;
      Sg_File_Info * finfo = Sg_File_Info::generateFileInfoForTransformationNode(sgFile->getFileName());
      std::string name = e->getAttribute("ElementName");
      // Expression vertices: VariableReference, Constant, Intrinsic,
      // FunctionCall, BooleanOperation

      // ------------------ SymbolReference -----------------------
      if (name == "SymbolReference") { }
      // --------------------- Constant ---------------------------
      else if (name == "Constant") { }
      else if (name == "Marker") {
      }  
      // -------------------- Branch ---------------------------
      else if (name == "Branch") {
      }
      // -------------------- ForLoop ---------------------------
      else if (name == "ForLoop") {
      }      

      // -------------------- BasicBlock ---------------------------
      else if (name == "BasicBlock") {
      }       
      // -------------------- Replacement ---------------------------
      else if (name == "Replacement") {        
      }
      // -------------------- ReplacementList ---------------------------      
      else if (name == "ReplacementList") {
      } else {
        ;//pwarning(std::string("Element ") + name + " not handled in startElement");      
      }
    }