OpenADFortTk (including Open64 and OpenAnalysis references)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ManagerReachDefsOverwriteXAIF.cpp
Go to the documentation of this file.
1 
16 
17 
18 namespace OA {
19  namespace XAIF {
20 
21 static bool debug = false;
22 
23 
25  OA_DEBUG_CTRL_MACRO("DEBUG_ManagerReachDefsOverwriteXAIF:ALL", debug);
26  }
27 
30  if (debug) {
31  std::cout << "In OA::XAIF::ManagerReachDefsOverwriteXAIF::performAnalysis" << std::endl;
32  }
33  OA_ptr<ReachDefsOverwriteXAIF> aReachDefsOverwriteXAIF;
34  aReachDefsOverwriteXAIF = new ReachDefsOverwriteXAIF();
36  nodeIterPtr = cfg->getNodesIterator();
37  // looping over basic blocks
38  for ( ;nodeIterPtr->isValid(); ++(*nodeIterPtr) ) {
39  OA_ptr<DGraph::NodeInterface> dnode = nodeIterPtr->current();
42  = node->getNodeStatementsIterator();
43  // looping over statements in basic blocks
44  for (; stmtIterPtr->isValid(); ++(*stmtIterPtr)) {
45  OA::StmtHandle stmt = stmtIterPtr->current();
46  if (debug) {
47  std::cout << "checking overwrites of "
48  << mIR->toString(stmt) << std::endl;
49  }
50  StmtSet subSet;
52  overwritingStmtIterPtr = reachDefs->getOverwritingStmts(stmt);
53  for (; overwritingStmtIterPtr->isValid(); ++(*overwritingStmtIterPtr)) {
54  StmtHandle overwritingStmt = overwritingStmtIterPtr->current();
55  if (debug) {
56  std::cout << "overwritingStmt (" << overwritingStmt.hval() << ") = "
57  << mIR->toString(overwritingStmt) << std::endl;
58  }
59  subSet.insert(overwritingStmt);
60  }
61  int chainId = aReachDefsOverwriteXAIF->findChain(subSet);
62  if (chainId == ChainsXAIF::CHAIN_ID_NONE) {
63  // if it isn't then make a new chain
64  chainId=getNextChainId();
65  // and add the subset of statements into that chain
66  aReachDefsOverwriteXAIF->addStmtSet(subSet,chainId);
67  }
68  // assiciate the stmt with the chainId
69  aReachDefsOverwriteXAIF->insert(stmt, chainId);
70  }
71  }
72  // insert an empty chain as chain 0 because that is the default chain in XAIF
73  // don't insert it until the end because while building, we don't want to find
74  // empty chains at 0, want to find it at 1
75  StmtSet emptySet;
76  aReachDefsOverwriteXAIF->addStmtSet(emptySet,0);
77  return aReachDefsOverwriteXAIF;
78  }
79 
81 
83  return ourCurrentStartId++;
84  }
85 
86  }
87 }