From 394471f1973db98b13e97e82ed8a5beb35dd4811 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 23 Jan 2003 22:05:33 +0000 Subject: * Eliminate boolean arguments in favor of using enums * T-D pass now eliminates unreachable globals git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5419 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/DataStructure/DataStructure.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib/Analysis/DataStructure/DataStructure.cpp') diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index 0e61f03781..f15195114a 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -785,9 +785,9 @@ static void markIncomplete(DSCallSite &Call) { // 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 @@ static void markAlive(DSCallSite &CS, std::set &Alive) { // 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 @@ void DSGraph::removeDeadNodes() { // Mark all nodes reachable by (non-global) scalar nodes as alive... for (std::map::iterator I = ScalarMap.begin(), E = ScalarMap.end(); I != E; ++I) - // if (!isa(I->first)) // Don't mark globals! + if (!(Flags & DSGraph::RemoveUnreachableGlobals) || + !isa(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); -- cgit v1.2.3-18-g5258