Clean up DSGraph::removeDeadNodes interface
authorChris Lattner <sabre@nondot.org>
Sat, 9 Nov 2002 21:00:49 +0000 (21:00 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 9 Nov 2002 21:00:49 +0000 (21:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4660 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DSGraph.h
include/llvm/Analysis/DataStructure/DSGraph.h
lib/Analysis/DataStructure/BottomUpClosure.cpp
lib/Analysis/DataStructure/DataStructure.cpp
lib/Analysis/DataStructure/Local.cpp
lib/Analysis/DataStructure/Steensgaard.cpp
lib/Analysis/DataStructure/TopDownClosure.cpp

index ad175ec063c280c58c82adee8dfbb86e479cabc8..3ec567e6655d13a68b71a3730940fc10167cd71c 100644 (file)
@@ -132,7 +132,7 @@ public:
   // from the caller's graph entirely.  This is only appropriate to use when
   // inlining graphs.
   //
-  void removeDeadNodes(bool KeepAllGlobals, bool KeepCalls);
+  void removeDeadNodes(bool KeepAllGlobals);
 
   // CloneFlags enum - Bits that may be passed into the cloneInto method to
   // specify how to clone the function graph.
index ad175ec063c280c58c82adee8dfbb86e479cabc8..3ec567e6655d13a68b71a3730940fc10167cd71c 100644 (file)
@@ -132,7 +132,7 @@ public:
   // from the caller's graph entirely.  This is only appropriate to use when
   // inlining graphs.
   //
-  void removeDeadNodes(bool KeepAllGlobals, bool KeepCalls);
+  void removeDeadNodes(bool KeepAllGlobals);
 
   // CloneFlags enum - Bits that may be passed into the cloneInto method to
   // specify how to clone the function graph.
index 1a3f48002f24b3a5e5b70fa0050fd2f70286c3c6..d57b6186f86f145d063814217e732cf3349e556b 100644 (file)
@@ -150,16 +150,10 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
     if (Inlined) {
       Graph->maskIncompleteMarkers();
       Graph->markIncompleteNodes();
-      Graph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true);
+      Graph->removeDeadNodes(/*KeepAllGlobals*/ true);
     }
   } while (Inlined && !FCs.empty());
 
-#if 0
-  Graph->maskIncompleteMarkers();
-  Graph->markIncompleteNodes();
-  Graph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true);
-#endif
-
   DEBUG(std::cerr << "  [BU] Done inlining: " << F.getName() << " ["
         << Graph->getGraphSize() << "+" << Graph->getFunctionCalls().size()
         << "]\n");
index 630ec5f4d34a3a92153e3a159021b1c0df7986cb..f1fce0fb97d86b546493bba793df7dafadc85857 100644 (file)
@@ -981,10 +981,7 @@ static void markGlobalsAlive(DSGraph &G, std::set<DSNode*> &Alive,
 // from the caller's graph entirely.  This is only appropriate to use when
 // inlining graphs.
 //
-void DSGraph::removeDeadNodes(bool KeepAllGlobals, bool KeepCalls) {
-  assert((!KeepAllGlobals || KeepCalls) &&  // FIXME: This should be an enum!
-         "KeepAllGlobals without KeepCalls is meaningless");
-
+void DSGraph::removeDeadNodes(bool KeepAllGlobals) {
   // Reduce the amount of work we have to do...
   removeTriviallyDeadNodes(KeepAllGlobals);
 
@@ -994,19 +991,17 @@ void DSGraph::removeDeadNodes(bool KeepAllGlobals, bool KeepCalls) {
   std::set<DSNode*> Alive;
 
   // If KeepCalls, mark all nodes reachable by call nodes as alive...
-  if (KeepCalls) {
-    for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) {
-      for (unsigned j = 0, e = FunctionCalls[i].getNumPtrArgs(); j != e; ++j)
-        markAlive(FunctionCalls[i].getPtrArg(j).getNode(), Alive);
-      markAlive(FunctionCalls[i].getRetVal().getNode(), Alive);
-      markAlive(FunctionCalls[i].getCallee().getNode(), Alive);
-    }
-    for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) {
-      for (unsigned j = 0, e = AuxFunctionCalls[i].getNumPtrArgs(); j != e; ++j)
-        markAlive(AuxFunctionCalls[i].getPtrArg(j).getNode(), Alive);
-      markAlive(AuxFunctionCalls[i].getRetVal().getNode(), Alive);
-      markAlive(AuxFunctionCalls[i].getCallee().getNode(), Alive);
-    }
+  for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) {
+    for (unsigned j = 0, e = FunctionCalls[i].getNumPtrArgs(); j != e; ++j)
+      markAlive(FunctionCalls[i].getPtrArg(j).getNode(), Alive);
+    markAlive(FunctionCalls[i].getRetVal().getNode(), Alive);
+    markAlive(FunctionCalls[i].getCallee().getNode(), Alive);
+  }
+  for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) {
+    for (unsigned j = 0, e = AuxFunctionCalls[i].getNumPtrArgs(); j != e; ++j)
+      markAlive(AuxFunctionCalls[i].getPtrArg(j).getNode(), Alive);
+    markAlive(AuxFunctionCalls[i].getRetVal().getNode(), Alive);
+    markAlive(AuxFunctionCalls[i].getCallee().getNode(), Alive);
   }
 
   // Mark all nodes reachable by scalar nodes as alive...
@@ -1022,7 +1017,7 @@ void DSGraph::removeDeadNodes(bool KeepAllGlobals, bool KeepCalls) {
   // Of course, if KeepAllGlobals is specified, they would be live already.
 
   if (!KeepAllGlobals)
-    markGlobalsAlive(*this, Alive, !KeepCalls);
+    markGlobalsAlive(*this, Alive, false);
 
   // Loop over all unreachable nodes, dropping their references...
   vector<DSNode*> DeadNodes;
@@ -1157,7 +1152,7 @@ void GlobalDSGraph::cloneGlobals(DSGraph& Graph, bool CloneCalls) {
   if (CloneCalls)
     GlobalsGraph->cloneCalls(Graph);
 
-  GlobalsGraph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true);
+  GlobalsGraph->removeDeadNodes(/*KeepAllGlobals*/ true);
 #endif
 }
 
index 3df4fd4f600ffd3854c7339d4164c9ed61512c70..e159a6087e85f8a26f85cb47f39a0a1c3c8a4ff0 100644 (file)
@@ -134,7 +134,7 @@ DSGraph::DSGraph(Function &F, DSGraph *GG) : Func(&F), GlobalsGraph(GG) {
   markIncompleteNodes();
 
   // Remove any nodes made dead due to merging...
-  removeDeadNodes(true, true);
+  removeDeadNodes(true);
 }
 
 
index 5ee4dc4cecede3914350ca52c3d6fdc0f376a9b0..6dc2bda30be885c212c02443e16b070e13f47203 100644 (file)
@@ -194,7 +194,7 @@ bool Steens::run(Module &M) {
   ResultGraph->markIncompleteNodes(false);
 
   // Remove any nodes that are dead after all of the merging we have done...
-  ResultGraph->removeDeadNodes(true, true);
+  ResultGraph->removeDeadNodes(true);
 
   DEBUG(print(std::cerr, &M));
   return false;
index ee559d6fc0d4292f03568c5b4c0f9520ee4e8424..b4b43f77c59cd0b20c75bd34c6bddec64d5edb06 100644 (file)
@@ -180,8 +180,7 @@ void TDDataStructures::calculateGraph(Function &F) {
       CG.maskIncompleteMarkers();
       CG.markIncompleteNodes(/*markFormals*/ !F.hasInternalLinkage()
                              /*&& FIXME: NEED TO CHECK IF ALL CALLERS FOUND!*/);
-      CG.removeDeadNodes(false, true) ;///*KeepAllGlobals*/ false, true);
-      ///*KeepCalls*/ false);
+      CG.removeDeadNodes(/*KeepAllGlobals*/ false);
     }
 
   DEBUG(std::cerr << "  [TD] Done inlining into callees for: " << F.getName()