[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp DataStructure.cpp Local.cpp Printer.cpp Steensgaard.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Nov 3 15:28:09 PST 2002


Changes in directory llvm/lib/Analysis/DataStructure:

BottomUpClosure.cpp updated: 1.28 -> 1.29
DataStructure.cpp updated: 1.39 -> 1.40
Local.cpp updated: 1.26 -> 1.27
Printer.cpp updated: 1.31 -> 1.32
Steensgaard.cpp updated: 1.6 -> 1.7

---
Log message:

Rename ValueMap to ScalarMap



---
Diffs of the changes:

Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.28 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.29
--- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.28	Fri Nov  1 18:26:32 2002
+++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp	Sun Nov  3 15:27:48 2002
@@ -56,7 +56,7 @@
 // call.
 //
 static void ResolveArguments(DSCallSite &Call, Function &F,
-                             map<Value*, DSNodeHandle> &ValueMap) {
+                             map<Value*, DSNodeHandle> &ScalarMap) {
   // Resolve all of the function arguments...
   Function::aiterator AI = F.abegin();
   for (unsigned i = 0, e = Call.getNumPtrArgs(); i != e; ++i, ++AI) {
@@ -64,7 +64,7 @@
     while (!isPointerType(AI->getType())) ++AI;
     
     // Add the link from the argument scalar to the provided value
-    ValueMap[AI].mergeWith(Call.getPtrArg(i));
+    ScalarMap[AI].mergeWith(Call.getPtrArg(i));
   }
 }
 
@@ -118,7 +118,7 @@
             Graph->getRetNode().mergeWith(Call.getRetVal());
 
             // Resolve the arguments in the call to the actual values...
-            ResolveArguments(Call, F, Graph->getValueMap());
+            ResolveArguments(Call, F, Graph->getScalarMap());
 
             // Erase the entry in the callees vector
             Callees.erase(Callees.begin()+c--);


Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.39 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.40
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.39	Sun Nov  3 15:24:04 2002
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp	Sun Nov  3 15:27:48 2002
@@ -488,17 +488,17 @@
 
 DSGraph::DSGraph(const DSGraph &G) : Func(G.Func) {
   std::map<const DSNode*, DSNode*> NodeMap;
-  RetNode = cloneInto(G, ValueMap, NodeMap);
+  RetNode = cloneInto(G, ScalarMap, NodeMap);
 }
 
 DSGraph::DSGraph(const DSGraph &G, std::map<const DSNode*, DSNode*> &NodeMap)
   : Func(G.Func) {
-  RetNode = cloneInto(G, ValueMap, NodeMap);
+  RetNode = cloneInto(G, ScalarMap, NodeMap);
 }
 
 DSGraph::~DSGraph() {
   FunctionCalls.clear();
-  ValueMap.clear();
+  ScalarMap.clear();
   RetNode.setNode(0);
 
 #ifndef NDEBUG
@@ -536,7 +536,7 @@
 
 
 // cloneInto - Clone the specified DSGraph into the current graph, returning the
-// Return node of the graph.  The translated ValueMap for the old function is
+// Return node of the graph.  The translated ScalarMap for the old function is
 // filled into the OldValMap member.  If StripAllocas is set to true, Alloca
 // markers are removed from the graph, as the graph is being cloned into a
 // calling function's graph.
@@ -570,18 +570,18 @@
       Nodes[i]->NodeType &= ~StripBits;
 
   // Copy the value map... and merge all of the global nodes...
-  for (std::map<Value*, DSNodeHandle>::const_iterator I = G.ValueMap.begin(),
-         E = G.ValueMap.end(); I != E; ++I) {
+  for (std::map<Value*, DSNodeHandle>::const_iterator I = G.ScalarMap.begin(),
+         E = G.ScalarMap.end(); I != E; ++I) {
     DSNodeHandle &H = OldValMap[I->first];
     H.setNode(OldNodeMap[I->second.getNode()]);
     H.setOffset(I->second.getOffset());
 
     if (isa<GlobalValue>(I->first)) {  // Is this a global?
-      std::map<Value*, DSNodeHandle>::iterator GVI = ValueMap.find(I->first);
-      if (GVI != ValueMap.end()) {   // Is the global value in this fun already?
+      std::map<Value*, DSNodeHandle>::iterator GVI = ScalarMap.find(I->first);
+      if (GVI != ScalarMap.end()) {   // Is the global value in this fn already?
         GVI->second.mergeWith(H);
       } else {
-        ValueMap[I->first] = H;      // Add global pointer to this graph
+        ScalarMap[I->first] = H;      // Add global pointer to this graph
       }
     }
   }
@@ -601,7 +601,7 @@
   if (GNode == 0 || GNode->getGlobals().size() == 0) return 0;
 
   // If a clone has already been created for GNode, return it.
-  DSNodeHandle& ValMapEntry = ValueMap[GNode->getGlobals()[0]];
+  DSNodeHandle& ValMapEntry = ScalarMap[GNode->getGlobals()[0]];
   if (ValMapEntry != 0)
     return ValMapEntry;
 
@@ -610,7 +610,7 @@
   ValMapEntry = NewNode;                // j=0 case of loop below!
   Nodes.push_back(NewNode);
   for (unsigned j = 1, N = NewNode->getGlobals().size(); j < N; ++j)
-    ValueMap[NewNode->getGlobals()[j]] = NewNode;
+    ScalarMap[NewNode->getGlobals()[j]] = NewNode;
 
   // Rewrite the links in the new node to point into the current graph.
   for (unsigned j = 0, e = GNode->getNumLinks(); j != e; ++j)
@@ -655,8 +655,8 @@
   // Mark any incoming arguments as incomplete...
   if (markFormalArgs && Func)
     for (Function::aiterator I = Func->abegin(), E = Func->aend(); I != E; ++I)
-      if (isPointerType(I->getType()) && ValueMap.find(I) != ValueMap.end())
-        markIncompleteNode(ValueMap[I].getNode());
+      if (isPointerType(I->getType()) && ScalarMap.find(I) != ScalarMap.end())
+        markIncompleteNode(ScalarMap[I].getNode());
 
   // Mark stuff passed into functions calls as being incomplete...
   for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) {
@@ -681,13 +681,13 @@
 }
 
 // removeRefsToGlobal - Helper function that removes globals from the
-// ValueMap so that the referrer count will go down to zero.
+// ScalarMap so that the referrer count will go down to zero.
 static void removeRefsToGlobal(DSNode* N,
-                               std::map<Value*, DSNodeHandle> &ValueMap) {
+                               std::map<Value*, DSNodeHandle> &ScalarMap) {
   while (!N->getGlobals().empty()) {
     GlobalValue *GV = N->getGlobals().back();
     N->getGlobals().pop_back();      
-    ValueMap.erase(GV);
+    ScalarMap.erase(GV);
   }
 }
 
@@ -705,9 +705,9 @@
   if ((N->NodeType & ~DSNode::GlobalNode) == 0 && N->getSize() == 0 &&
       N->getReferrers().size() == N->getGlobals().size()) {
 
-    // Remove the globals from the ValueMap, so that the referrer count will go
+    // Remove the globals from the ScalarMap, so that the referrer count will go
     // down to zero.
-    removeRefsToGlobal(N, ValueMap);
+    removeRefsToGlobal(N, ScalarMap);
     assert(N->getReferrers().empty() && "Referrers should all be gone now!");
     return true;
   }
@@ -881,11 +881,11 @@
   // This would be a simple iterative loop if function calls were real nodes!
   markGlobalsIteration(GlobalNodes, Calls, Alive, FilterCalls);
 
-  // Free up references to dead globals from the ValueMap
+  // Free up references to dead globals from the ScalarMap
   std::set<DSNode*>::iterator I = GlobalNodes.begin(), E = GlobalNodes.end();
   for( ; I != E; ++I)
     if (Alive.count(*I) == 0)
-      removeRefsToGlobal(*I, G.getValueMap());
+      removeRefsToGlobal(*I, G.getScalarMap());
 
   // Delete dead function calls
   if (FilterCalls)
@@ -927,13 +927,13 @@
     }
 
   // Mark all nodes reachable by scalar nodes as alive...
-  for (std::map<Value*, DSNodeHandle>::iterator I = ValueMap.begin(),
-         E = ValueMap.end(); I != E; ++I)
+  for (std::map<Value*, DSNodeHandle>::iterator I = ScalarMap.begin(),
+         E = ScalarMap.end(); I != E; ++I)
     markAlive(I->second.getNode(), Alive);
 
 #if 0
   // Marge all nodes reachable by global nodes, as alive.  Isn't this covered by
-  // the ValueMap?
+  // the ScalarMap?
   //
   if (KeepAllGlobals)
     for (unsigned i = 0, e = Nodes.size(); i != e; ++i)
@@ -1039,7 +1039,7 @@
   // an identical list of globals and return it if it exists.
   //
   for (unsigned j = 0, N = OldNode->getGlobals().size(); j != N; ++j)
-    if (DSNode *PrevNode = ValueMap[OldNode->getGlobals()[j]].getNode()) {
+    if (DSNode *PrevNode = ScalarMap[OldNode->getGlobals()[j]].getNode()) {
       if (NewNode == 0) {
         NewNode = PrevNode;             // first existing node found
         if (GlobalsAreFinal && j == 0)
@@ -1051,11 +1051,11 @@
       else if (NewNode != PrevNode) {   // found another, different from prev
         // update ValMap *before* merging PrevNode into NewNode
         for (unsigned k = 0, NK = PrevNode->getGlobals().size(); k < NK; ++k)
-          ValueMap[PrevNode->getGlobals()[k]] = NewNode;
+          ScalarMap[PrevNode->getGlobals()[k]] = NewNode;
         NewNode->mergeWith(PrevNode);
       }
     } else if (NewNode != 0) {
-      ValueMap[OldNode->getGlobals()[j]] = NewNode; // add the merged node
+      ScalarMap[OldNode->getGlobals()[j]] = NewNode; // add the merged node
     }
 
   // If no existing node was found, clone the node and update the ValMap.
@@ -1065,7 +1065,7 @@
     for (unsigned j = 0, e = NewNode->getNumLinks(); j != e; ++j)
       NewNode->setLink(j, 0);
     for (unsigned j = 0, N = NewNode->getGlobals().size(); j < N; ++j)
-      ValueMap[NewNode->getGlobals()[j]] = NewNode;
+      ScalarMap[NewNode->getGlobals()[j]] = NewNode;
   }
   else
     NewNode->NodeType |= OldNode->NodeType; // Markers may be different!


Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.26 llvm/lib/Analysis/DataStructure/Local.cpp:1.27
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.26	Sun Nov  3 15:24:04 2002
+++ llvm/lib/Analysis/DataStructure/Local.cpp	Sun Nov  3 15:27:48 2002
@@ -60,14 +60,14 @@
     DSGraph &G;
     vector<DSNode*> &Nodes;
     DSNodeHandle &RetNode;               // Node that gets returned...
-    map<Value*, DSNodeHandle> &ValueMap;
+    map<Value*, DSNodeHandle> &ScalarMap;
     vector<DSCallSite> &FunctionCalls;
 
   public:
     GraphBuilder(DSGraph &g, vector<DSNode*> &nodes, DSNodeHandle &retNode,
-                 map<Value*, DSNodeHandle> &vm,
+                 map<Value*, DSNodeHandle> &SM,
                  vector<DSCallSite> &fc)
-      : G(g), Nodes(nodes), RetNode(retNode), ValueMap(vm), FunctionCalls(fc) {
+      : G(g), Nodes(nodes), RetNode(retNode), ScalarMap(SM), FunctionCalls(fc) {
 
       // Create scalar nodes for all pointer arguments...
       for (Function::aiterator I = G.getFunction().abegin(),
@@ -112,7 +112,7 @@
       return N;
     }
 
-    /// setDestTo - Set the ValueMap entry for the specified value to point to
+    /// setDestTo - Set the ScalarMap entry for the specified value to point to
     /// the specified destination.  If the Value already points to a node, make
     /// sure to merge the two destinations together.
     ///
@@ -135,7 +135,7 @@
 // graph.
 DSGraph::DSGraph(Function &F) : Func(&F) {
   // Use the graph builder to construct the local version of the graph
-  GraphBuilder B(*this, Nodes, RetNode, ValueMap, FunctionCalls);
+  GraphBuilder B(*this, Nodes, RetNode, ScalarMap, FunctionCalls);
   markIncompleteNodes();
 }
 
@@ -155,7 +155,7 @@
     return 0;   // Constant doesn't point to anything.
   }
 
-  DSNodeHandle &NH = ValueMap[&V];
+  DSNodeHandle &NH = ScalarMap[&V];
   if (NH.getNode())
     return NH;     // Already have a node?  Just return it...
 
@@ -194,12 +194,12 @@
 }
 
 
-/// setDestTo - Set the ValueMap entry for the specified value to point to the
+/// setDestTo - Set the ScalarMap entry for the specified value to point to the
 /// specified destination.  If the Value already points to a node, make sure to
 /// merge the two destinations together.
 ///
 void GraphBuilder::setDestTo(Value &V, const DSNodeHandle &NH) {
-  DSNodeHandle &AINH = ValueMap[&V];
+  DSNodeHandle &AINH = ScalarMap[&V];
   if (AINH.getNode() == 0)   // Not pointing to anything yet?
     AINH = NH;               // Just point directly to NH
   else
@@ -224,7 +224,7 @@
 void GraphBuilder::visitPHINode(PHINode &PN) {
   if (!isPointerType(PN.getType())) return; // Only pointer PHIs
 
-  DSNodeHandle &PNDest = ValueMap[&PN];
+  DSNodeHandle &PNDest = ScalarMap[&PN];
   for (unsigned i = 0, e = PN.getNumIncomingValues(); i != e; ++i)
     PNDest.mergeWith(getValueDest(*PN.getIncomingValue(i)));
 }


Index: llvm/lib/Analysis/DataStructure/Printer.cpp
diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.31 llvm/lib/Analysis/DataStructure/Printer.cpp:1.32
--- llvm/lib/Analysis/DataStructure/Printer.cpp:1.31	Sun Nov  3 15:24:04 2002
+++ llvm/lib/Analysis/DataStructure/Printer.cpp	Sun Nov  3 15:27:48 2002
@@ -86,7 +86,7 @@
   static void addCustomGraphFeatures(const DSGraph *G,
                                      GraphWriter<const DSGraph*> &GW) {
     // Add scalar nodes to the graph...
-    const std::map<Value*, DSNodeHandle> &VM = G->getValueMap();
+    const std::map<Value*, DSNodeHandle> &VM = G->getScalarMap();
     for (std::map<Value*, DSNodeHandle>::const_iterator I = VM.begin();
          I != VM.end(); ++I)
       if (!isa<GlobalValue>(I->first)) {


Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp
diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.6 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.7
--- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.6	Fri Nov  1 11:34:23 2002
+++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp	Sun Nov  3 15:27:48 2002
@@ -84,7 +84,7 @@
                                  const DSCallSite &Call,
                                  DSNodeHandle &RetVal) {
   assert(ResultGraph != 0 && "Result graph not allocated!");
-  std::map<Value*, DSNodeHandle> &ValMap = ResultGraph->getValueMap();
+  std::map<Value*, DSNodeHandle> &ValMap = ResultGraph->getScalarMap();
 
   // Handle the return value of the function...
   if (Call.getRetVal().getNode() && RetVal.getNode())
@@ -135,8 +135,9 @@
           RetValMap[I] = RetNode;
       }
 
-      // Incorporate the inlined Function's ValueMap into the global ValueMap...
-      std::map<Value*, DSNodeHandle> &GVM = ResultGraph->getValueMap();
+      // Incorporate the inlined Function's ScalarMap into the global
+      // ScalarMap...
+      std::map<Value*, DSNodeHandle> &GVM = ResultGraph->getScalarMap();
 
       while (!ValMap.empty()) { // Loop over value map, moving entries over...
         const std::pair<Value*, DSNodeHandle> &DSN = *ValMap.begin();
@@ -198,7 +199,7 @@
 AliasAnalysis::Result Steens::alias(const Value *V1, const Value *V2) const {
   assert(ResultGraph && "Result grcaph has not yet been computed!");
 
-  std::map<Value*, DSNodeHandle> &GVM = ResultGraph->getValueMap();
+  std::map<Value*, DSNodeHandle> &GVM = ResultGraph->getScalarMap();
 
   std::map<Value*, DSNodeHandle>::iterator I = GVM.find(const_cast<Value*>(V1));
   if (I != GVM.end() && I->second.getNode()) {





More information about the llvm-commits mailing list