[llvm-commits] CVS: llvm/lib/Analysis/IPA/IPModRef.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Nov 6 14:00:04 PST 2002


Changes in directory llvm/lib/Analysis/IPA:

IPModRef.cpp updated: 1.4 -> 1.5

---
Log message:

Allow the ResolveCallSiteModRefInfo method to return a mapping of nodes,
implement the mod/ref bit masking



---
Diffs of the changes:

Index: llvm/lib/Analysis/IPA/IPModRef.cpp
diff -u llvm/lib/Analysis/IPA/IPModRef.cpp:1.4 llvm/lib/Analysis/IPA/IPModRef.cpp:1.5
--- llvm/lib/Analysis/IPA/IPModRef.cpp:1.4	Wed Nov  6 13:38:43 2002
+++ llvm/lib/Analysis/IPA/IPModRef.cpp	Wed Nov  6 13:59:33 2002
@@ -104,17 +104,28 @@
 //  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 @@
   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();





More information about the llvm-commits mailing list