//
//===----------------------------------------------------------------------===//
//
-// See high-level comments in include/llvm/Analysis/IPModRef.h
+// See high-level comments in IPModRef.h
//
//===----------------------------------------------------------------------===//
-#include "llvm/Analysis/IPModRef.h"
-#include "llvm/Analysis/DataStructure.h"
-#include "llvm/Analysis/DSGraph.h"
+#include "IPModRef.h"
+#include "llvm/Analysis/DataStructure/DataStructure.h"
+#include "llvm/Analysis/DataStructure/DSGraph.h"
#include "llvm/Module.h"
-#include "llvm/Function.h"
-#include "llvm/iMemory.h"
-#include "llvm/iOther.h"
-#include "Support/Statistic.h"
-#include "Support/STLExtras.h"
-#include "Support/StringExtras.h"
+#include "llvm/Instructions.h"
+#include "llvm/ADT/Statistic.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringExtras.h"
#include <vector>
+namespace llvm {
+
//----------------------------------------------------------------------------
// Private constants and data
//----------------------------------------------------------------------------
funcTDGraph(tdgClone),
funcModRefInfo(tdgClone->getGraphSize())
{
- for (unsigned i=0, N = funcTDGraph->getGraphSize(); i < N; ++i)
- NodeIds[funcTDGraph->getNodes()[i]] = i;
+ unsigned i = 0;
+ for (DSGraph::node_iterator NI = funcTDGraph->node_begin(),
+ E = funcTDGraph->node_end(); NI != E; ++NI)
+ NodeIds[*NI] = i++;
}
{
// Mark all nodes in the graph that are marked MOD as being mod
// and all those marked REF as being ref.
- for (unsigned i = 0, N = funcTDGraph->getGraphSize(); i < N; ++i)
- {
- if (funcTDGraph->getNodes()[i]->isModified())
- funcModRefInfo.setNodeIsMod(i);
- if (funcTDGraph->getNodes()[i]->isRead())
- funcModRefInfo.setNodeIsRef(i);
- }
+ unsigned i = 0;
+ for (DSGraph::node_iterator NI = funcTDGraph->node_begin(),
+ E = funcTDGraph->node_end(); NI != E; ++NI, ++i) {
+ if ((*NI)->isModified()) funcModRefInfo.setNodeIsMod(i);
+ if ((*NI)->isRead()) funcModRefInfo.setNodeIsRef(i);
+ }
// Compute the Mod/Ref info for all call sites within the function.
// The call sites are recorded in the TD graph.
Args.push_back(Result->getNodeForValue(*I));
// Build the call site...
- DSCallSite CS(CS, RetVal, F, Args);
+ DSCallSite NCS(CS, RetVal, F, Args);
// Perform the merging now of the graph for the callee, which will
// come with mod/ref bits set...
- Result->mergeInGraph(CS, *F, IPModRefObj.getBUDSGraph(*F),
+ Result->mergeInGraph(NCS, *F, IPModRefObj.getBUDSGraph(*F),
DSGraph::StripAllocaBit
| DSGraph::DontCloneCallNodes
| DSGraph::DontCloneAuxCallNodes);
}
// For all nodes in the graph, extract the mod/ref information
- const std::vector<DSNode*>& csgNodes = csgp->getNodes();
- const std::vector<DSNode*>& origNodes = funcTDGraph->getNodes();
- assert(csgNodes.size() == origNodes.size());
- for (unsigned i=0, N = origNodes.size(); i < N; ++i)
- {
- DSNode* csgNode = NodeMap[origNodes[i]].getNode();
- assert(csgNode && "Inlined and original graphs do not correspond!");
- if (csgNode->isModified())
- callModRefInfo->setNodeIsMod(getNodeId(origNodes[i]));
- if (csgNode->isRead())
- callModRefInfo->setNodeIsRef(getNodeId(origNodes[i]));
- }
+ for (DSGraph::node_iterator NI = funcTDGraph->node_begin(),
+ E = funcTDGraph->node_end(); NI != E; ++NI) {
+ DSNode* csgNode = NodeMap[*NI].getNode();
+ assert(csgNode && "Inlined and original graphs do not correspond!");
+ if (csgNode->isModified())
+ callModRefInfo->setNodeIsMod(getNodeId(*NI));
+ if (csgNode->isRead())
+ callModRefInfo->setNodeIsRef(getNodeId(*NI));
+ }
// Drop nodemap before we delete the graph...
NodeMap.clear();
O << std::string((j < NV-1)? "; " : "\n");
}
+#if 0
else
tdGraph.getNodes()[i]->print(O, /*graph*/ NULL);
+#endif
}
}
};
CI = callSiteModRefInfo.begin(), CE = callSiteModRefInfo.end();
CI != CE; ++CI)
{
- O << " ----Mod/Ref information for call site\n" << CI->first;
+ O << " ----Mod/Ref information for call site\n" << *CI->first;
O << " --Objects modified at call site:\n";
DPH.printValuesInBitVec(O, CI->second->getModSet());
{
print(std::cerr);
}
+
+} // End llvm namespace