[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp DataStructure.cpp Local.cpp Steensgaard.cpp TopDownClosure.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Jan 23 16:06:01 PST 2003
Changes in directory llvm/lib/Analysis/DataStructure:
BottomUpClosure.cpp updated: 1.46 -> 1.47
DataStructure.cpp updated: 1.73 -> 1.74
Local.cpp updated: 1.41 -> 1.42
Steensgaard.cpp updated: 1.14 -> 1.15
TopDownClosure.cpp updated: 1.31 -> 1.32
---
Log message:
* Eliminate boolean arguments in favor of using enums
* T-D pass now eliminates unreachable globals
---
Diffs of the changes:
Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.46 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.47
--- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.46 Wed Nov 27 11:41:13 2002
+++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp Thu Jan 23 16:05:33 2003
@@ -364,8 +364,8 @@
// Recompute the Incomplete markers. If there are any function calls left
// now that are complete, we must loop!
Graph.maskIncompleteMarkers();
- Graph.markIncompleteNodes();
- Graph.removeDeadNodes();
+ Graph.markIncompleteNodes(DSGraph::MarkFormalArgs);
+ Graph.removeDeadNodes(DSGraph::KeepUnreachableGlobals);
DEBUG(std::cerr << " [BU] Done inlining: " << F.getName() << " ["
<< Graph.getGraphSize() << "+" << Graph.getAuxFunctionCalls().size()
@@ -440,8 +440,8 @@
// Recompute the Incomplete markers. If there are any function calls left
// now that are complete, we must loop!
Graph.maskIncompleteMarkers();
- Graph.markIncompleteNodes();
- Graph.removeDeadNodes();
+ Graph.markIncompleteNodes(DSGraph::MarkFormalArgs);
+ Graph.removeDeadNodes(DSGraph::KeepUnreachableGlobals);
DEBUG(std::cerr << " [BU] Done Non-SCC inlining: " << F.getName() << " ["
<< Graph.getGraphSize() << "+" << Graph.getAuxFunctionCalls().size()
@@ -535,8 +535,8 @@
// Recompute the Incomplete markers. If there are any function calls left
// now that are complete, we must loop!
Graph.maskIncompleteMarkers();
- Graph.markIncompleteNodes();
- Graph.removeDeadNodes();
+ Graph.markIncompleteNodes(DSGraph::MarkFormalArgs);
+ Graph.removeDeadNodes(DSGraph::KeepUnreachableGlobals);
DEBUG(std::cerr << " [BU] Done inlining: " << F.getName() << " ["
<< Graph.getGraphSize() << "+" << Graph.getAuxFunctionCalls().size()
Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.73 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.74
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.73 Wed Jan 22 16:00:24 2003
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Jan 23 16:05:33 2003
@@ -785,9 +785,9 @@
// scope of current analysis may have modified it), the 'Incomplete' flag is
// added to the NodeType.
//
-void DSGraph::markIncompleteNodes(bool markFormalArgs) {
+void DSGraph::markIncompleteNodes(unsigned Flags) {
// Mark any incoming arguments as incomplete...
- if (markFormalArgs && Func)
+ if ((Flags & DSGraph::MarkFormalArgs) && Func)
for (Function::aiterator I = Func->abegin(), E = Func->aend(); I != E; ++I)
if (isPointerType(I->getType()) && ScalarMap.find(I) != ScalarMap.end())
markIncompleteNode(ScalarMap[I].getNode());
@@ -1010,7 +1010,7 @@
// from the caller's graph entirely. This is only appropriate to use when
// inlining graphs.
//
-void DSGraph::removeDeadNodes() {
+void DSGraph::removeDeadNodes(unsigned Flags) {
// Reduce the amount of work we have to do...
removeTriviallyDeadNodes();
@@ -1023,10 +1023,11 @@
// Mark all nodes reachable by (non-global) scalar nodes as alive...
for (std::map<Value*, DSNodeHandle>::iterator I = ScalarMap.begin(),
E = ScalarMap.end(); I != E; ++I)
- // if (!isa<GlobalValue>(I->first)) // Don't mark globals!
+ if (!(Flags & DSGraph::RemoveUnreachableGlobals) ||
+ !isa<GlobalValue>(I->first)) // Don't mark globals!
markAlive(I->second.getNode(), Alive);
- // else // Keep track of global nodes
- // GlobalNodes.push_back(std::make_pair(I->first, I->second.getNode()));
+ else // Keep track of global nodes
+ GlobalNodes.push_back(std::make_pair(I->first, I->second.getNode()));
// The return value is alive as well...
markAlive(RetNode.getNode(), Alive);
Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.41 llvm/lib/Analysis/DataStructure/Local.cpp:1.42
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.41 Thu Jan 23 15:31:16 2003
+++ llvm/lib/Analysis/DataStructure/Local.cpp Thu Jan 23 16:05:33 2003
@@ -136,10 +136,10 @@
#ifndef NDEBUG
Timer::addPeakMemoryMeasurement();
#endif
- markIncompleteNodes();
+ markIncompleteNodes(DSGraph::MarkFormalArgs);
// Remove any nodes made dead due to merging...
- removeDeadNodes();
+ removeDeadNodes(DSGraph::KeepUnreachableGlobals);
}
Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp
diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.14 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.15
--- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.14 Wed Dec 11 23:34:10 2002
+++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp Thu Jan 23 16:05:33 2003
@@ -196,10 +196,10 @@
// Update the "incomplete" markers on the nodes, ignoring unknownness due to
// incoming arguments...
ResultGraph->maskIncompleteMarkers();
- ResultGraph->markIncompleteNodes(false);
+ ResultGraph->markIncompleteNodes(DSGraph::IgnoreFormalArgs);
// Remove any nodes that are dead after all of the merging we have done...
- ResultGraph->removeDeadNodes();
+ ResultGraph->removeDeadNodes(DSGraph::KeepUnreachableGlobals);
DEBUG(print(std::cerr, &M));
return false;
Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.31 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.32
--- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.31 Wed Nov 27 11:41:13 2002
+++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Thu Jan 23 16:05:33 2003
@@ -186,9 +186,10 @@
// Recompute the Incomplete markers and eliminate unreachable nodes.
CG.maskIncompleteMarkers();
- CG.markIncompleteNodes(/*markFormals*/ !F.hasInternalLinkage()
+ CG.markIncompleteNodes(F.hasInternalLinkage() ? DSGraph::IgnoreFormalArgs:
+ DSGraph::MarkFormalArgs
/*&& FIXME: NEED TO CHECK IF ALL CALLERS FOUND!*/);
- CG.removeDeadNodes();
+ CG.removeDeadNodes(DSGraph::RemoveUnreachableGlobals);
}
DEBUG(std::cerr << " [TD] Done inlining into callees for: " << F.getName()
More information about the llvm-commits
mailing list