aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/IPModRef.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-11-06 19:59:33 +0000
committerChris Lattner <sabre@nondot.org>2002-11-06 19:59:33 +0000
commit4476ceb414afc6aebdcd1e055478175d95b62cb9 (patch)
tree6b7eba1e2dbf4a6ce1eda0755fa195a705651015 /lib/Analysis/DataStructure/IPModRef.cpp
parent268748a0d8a86463a0d222d5e2c0de0bc55ee2b8 (diff)
Allow the ResolveCallSiteModRefInfo method to return a mapping of nodes,
implement the mod/ref bit masking git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4578 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/IPModRef.cpp')
-rw-r--r--lib/Analysis/DataStructure/IPModRef.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/Analysis/DataStructure/IPModRef.cpp b/lib/Analysis/DataStructure/IPModRef.cpp
index 9b33a3c27c..0f9da42531 100644
--- a/lib/Analysis/DataStructure/IPModRef.cpp
+++ b/lib/Analysis/DataStructure/IPModRef.cpp
@@ -104,17 +104,28 @@ void FunctionModRefInfo::computeModRef(const Function &func)
// 2. It clears all of the mod/ref bits in the cloned graph
// 3. It then merges the bottom-up graph(s) for the specified call-site into
// the clone (bringing new mod/ref bits).
-// 4. It returns the clone.
+// 4. It returns the clone, and a mapping of nodes from the original TDGraph to
+// the cloned graph with Mod/Ref info for the callsite.
//
// NOTE: Because this clones a dsgraph and returns it, the caller is responsible
// for deleting the returned graph!
//
-DSGraph *FunctionModRefInfo::ResolveCallSiteModRefInfo(const CallInst &CI) {
+DSGraph *FunctionModRefInfo::ResolveCallSiteModRefInfo(const CallInst &CI,
+ std::map<const DSNode*, DSNodeHandle> &NodeMap) {
+
// Step #1: Clone the top-down graph...
- DSGraph *Result = new DSGraph(funcTDGraph);
+ std::map<const DSNode*, DSNode*> RawNodeMap;
+ DSGraph *Result = new DSGraph(funcTDGraph, RawNodeMap);
+
+ // Convert the NodeMap from a map to DSNode* to be a map to DSNodeHandle's
+ NodeMap.insert(RawNodeMap.begin(), RawNodeMap.end());
+
+ // We are now done with the old map... so free it's memory...
+ RawNodeMap.clear();
+
+ // Step #2: Clear Mod/Ref information...
+ Result->maskNodeTypes(~(DSNode::Modified | DSNode::Read));
- //const Function &F = *CI.getParent()->getParent();
- //DSGraph &TDGraph = IPModRefObj.getAnalysis<TDDataStructures>().getDSGraph(F);
return Result;
@@ -133,7 +144,8 @@ FunctionModRefInfo::computeModRef(const CallInst& callInst)
callSiteModRefInfo[&callInst] = callModRefInfo;
// Get a copy of the graph for the callee with the callee inlined
- DSGraph* csgp = ResolveCallSiteModRefInfo(callInst);
+ std::map<const DSNode*, DSNodeHandle> NodeMap;
+ DSGraph* csgp = ResolveCallSiteModRefInfo(callInst, NodeMap);
// For all nodes in the graph, extract the mod/ref information
const std::vector<DSNode*>& csgNodes = csgp->getNodes();