From 9fdaeb44b389f46dcb927821b7142f66e35e7776 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 30 Jun 2002 16:01:15 +0000 Subject: [PATCH] Fix anand's last checkin git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2804 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/DataStructure/ComputeClosure.cpp | 16 ++--- lib/Analysis/DataStructure/DataStructure.cpp | 1 - lib/Analysis/DataStructure/EliminateNodes.cpp | 68 +++++++++---------- .../DataStructure/FunctionRepBuilder.cpp | 1 - .../DataStructure/FunctionRepBuilder.h | 1 - lib/Analysis/DataStructure/NodeImpl.cpp | 3 +- 6 files changed, 43 insertions(+), 47 deletions(-) diff --git a/lib/Analysis/DataStructure/ComputeClosure.cpp b/lib/Analysis/DataStructure/ComputeClosure.cpp index ed2f93cdf1d..0f94b9141c8 100644 --- a/lib/Analysis/DataStructure/ComputeClosure.cpp +++ b/lib/Analysis/DataStructure/ComputeClosure.cpp @@ -12,7 +12,7 @@ #include "llvm/iOther.h" #include "Support/STLExtras.h" #include -#include +using std::cerr; // Make all of the pointers that point to Val also point to N. // @@ -111,8 +111,8 @@ void FunctionDSGraph::computeClosure(const DataStructure &DS) { Function *F = cast(FGDN->getGlobal()); if ((int)NumInlines++ == InlineLimit) { // CUTE hack huh? - std::cerr << "Infinite (?) recursion halted\n"; - std::cerr << "Not inlining: " << F->getName() << "\n"; + cerr << "Infinite (?) recursion halted\n"; + cerr << "Not inlining: " << F->getName() << "\n"; CN->dump(); return; } @@ -126,10 +126,10 @@ void FunctionDSGraph::computeClosure(const DataStructure &DS) { // #if 0 - std::cerr << "\nSearching for: " << (void*)CN->getCall() << ": "; + cerr << "\nSearching for: " << (void*)CN->getCall() << ": "; for (unsigned X = 0; X != CN->getArgs().size(); ++X) { - std::cerr << " " << X << " is\n"; - CN->getArgs().first[X].print(std::cerr); + cerr << " " << X << " is\n"; + CN->getArgs().first[X].print(cerr); } #endif @@ -137,9 +137,9 @@ void FunctionDSGraph::computeClosure(const DataStructure &DS) { PointerValSet *CMI = 0; for (unsigned i = 0, e = CallMap.size(); i != e; ++i) { #if 0 - std::cerr << "Found: " << (void*)CallMap[i].first.second << ": "; + cerr << "Found: " << (void*)CallMap[i].first.second << ": "; for (unsigned X = 0; X != CallMap[i].first.first.size(); ++X) { - std::cerr << " " << X << " is\n"; CallMap[i].first.first[X].print(std::cerr); + cerr << " " << X << " is\n"; CallMap[i].first.first[X].print(cerr); } #endif diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index 923bca5f347..7575a5da5bc 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -8,7 +8,6 @@ #include "llvm/Module.h" #include #include -#include //===----------------------------------------------------------------------===// // DataStructure Class Implementation diff --git a/lib/Analysis/DataStructure/EliminateNodes.cpp b/lib/Analysis/DataStructure/EliminateNodes.cpp index 06385d4b12c..7d8eb9b251e 100644 --- a/lib/Analysis/DataStructure/EliminateNodes.cpp +++ b/lib/Analysis/DataStructure/EliminateNodes.cpp @@ -19,7 +19,7 @@ #include "llvm/Value.h" #include "Support/STLExtras.h" #include -#include +using std::vector; //#define DEBUG_NODE_ELIMINATE 1 @@ -40,7 +40,7 @@ static void DestroyFirstNodeOfPair(DSNode *N1, DSNode *N2) { // Now make sure that all of the nodes that point to N1 also point to the node // that we are merging it with... // - const std::vector &Refs = N1->getReferrers(); + const vector &Refs = N1->getReferrers(); for (unsigned i = 0, e = Refs.size(); i != e; ++i) { PointerValSet &PVS = *Refs[i]; @@ -79,7 +79,7 @@ static bool isIndistinguishableNode(DSNode *DN) { // DSNode *IndFrom = 0; - const std::vector &Refs = DN->getReferrers(); + const vector &Refs = DN->getReferrers(); for (unsigned R = 0, RE = Refs.size(); R != RE; ++R) { const PointerValSet &Ptr = *Refs[R]; @@ -126,9 +126,9 @@ static bool isIndistinguishableNode(DSNode *DN) { } template -static bool removeIndistinguishableNodes(std::vector &Nodes) { +static bool removeIndistinguishableNodes(vector &Nodes) { bool Changed = false; - std::vector::iterator I = Nodes.begin(); + vector::iterator I = Nodes.begin(); while (I != Nodes.end()) { if (isIndistinguishableNode(*I)) { I = Nodes.erase(I); @@ -141,12 +141,12 @@ static bool removeIndistinguishableNodes(std::vector &Nodes) { } template -static bool removeIndistinguishableNodePairs(std::vector &Nodes) { +static bool removeIndistinguishableNodePairs(vector &Nodes) { bool Changed = false; - std::vector::iterator I = Nodes.begin(); + vector::iterator I = Nodes.begin(); while (I != Nodes.end()) { NodeTy *N1 = *I++; - for (std::vector::iterator I2 = I, I2E = Nodes.end(); + for (vector::iterator I2 = I, I2E = Nodes.end(); I2 != I2E; ++I2) { NodeTy *N2 = *I2; if (N1->isEquivalentTo(N2)) { @@ -178,16 +178,16 @@ bool FunctionDSGraph::UnlinkUndistinguishableNodes() { } static void MarkReferredNodesReachable(DSNode *N, - std::vector &ShadowNodes, - std::vector &ReachableShadowNodes, - std::vector &AllocNodes, - std::vector &ReachableAllocNodes); + vector &ShadowNodes, + vector &ReachableShadowNodes, + vector &AllocNodes, + vector &ReachableAllocNodes); static inline void MarkReferredNodeSetReachable(const PointerValSet &PVS, - std::vector &ShadowNodes, - std::vector &ReachableShadowNodes, - std::vector &AllocNodes, - std::vector &ReachableAllocNodes) { + vector &ShadowNodes, + vector &ReachableShadowNodes, + vector &AllocNodes, + vector &ReachableAllocNodes) { for (unsigned i = 0, e = PVS.size(); i != e; ++i) if (isa(PVS[i].Node) || isa(PVS[i].Node)) MarkReferredNodesReachable(PVS[i].Node, ShadowNodes, ReachableShadowNodes, @@ -195,21 +195,21 @@ static inline void MarkReferredNodeSetReachable(const PointerValSet &PVS, } static void MarkReferredNodesReachable(DSNode *N, - std::vector &ShadowNodes, - std::vector &ReachableShadowNodes, - std::vector &AllocNodes, - std::vector &ReachableAllocNodes) { + vector &ShadowNodes, + vector &ReachableShadowNodes, + vector &AllocNodes, + vector &ReachableAllocNodes) { assert(ShadowNodes.size() == ReachableShadowNodes.size()); assert(AllocNodes.size() == ReachableAllocNodes.size()); if (ShadowDSNode *Shad = dyn_cast(N)) { - std::vector::iterator I = + vector::iterator I = std::find(ShadowNodes.begin(), ShadowNodes.end(), Shad); unsigned i = I-ShadowNodes.begin(); if (ReachableShadowNodes[i]) return; // Recursion detected, abort... ReachableShadowNodes[i] = true; } else if (AllocDSNode *Alloc = dyn_cast(N)) { - std::vector::iterator I = + vector::iterator I = std::find(AllocNodes.begin(), AllocNodes.end(), Alloc); unsigned i = I-AllocNodes.begin(); if (ReachableAllocNodes[i]) return; // Recursion detected, abort... @@ -221,7 +221,7 @@ static void MarkReferredNodesReachable(DSNode *N, ShadowNodes, ReachableShadowNodes, AllocNodes, ReachableAllocNodes); - const std::vector *Links = N->getAuxLinks(); + const vector *Links = N->getAuxLinks(); if (Links) for (unsigned i = 0, e = Links->size(); i != e; ++i) MarkReferredNodeSetReachable((*Links)[i], @@ -230,8 +230,8 @@ static void MarkReferredNodesReachable(DSNode *N, } void FunctionDSGraph::MarkEscapeableNodesReachable( - std::vector &ReachableShadowNodes, - std::vector &ReachableAllocNodes) { + vector &ReachableShadowNodes, + vector &ReachableAllocNodes) { // Mark all shadow nodes that have edges from other nodes as reachable. // Recursively mark any shadow nodes pointed to by the newly live shadow // nodes as also alive. @@ -261,8 +261,8 @@ bool FunctionDSGraph::RemoveUnreachableNodes() { // Reachable*Nodes - Contains true if there is an edge from a reachable // node to the numbered node... // - std::vector ReachableShadowNodes(ShadowNodes.size()); - std::vector ReachableAllocNodes (AllocNodes.size()); + vector ReachableShadowNodes(ShadowNodes.size()); + vector ReachableAllocNodes (AllocNodes.size()); MarkEscapeableNodesReachable(ReachableShadowNodes, ReachableAllocNodes); @@ -317,7 +317,7 @@ bool FunctionDSGraph::RemoveUnreachableNodes() { // Loop over the global nodes, removing nodes that have no edges into them or // out of them. // - for (std::vector::iterator I = GlobalNodes.begin(); + for (vector::iterator I = GlobalNodes.begin(); I != GlobalNodes.end(); ) if ((*I)->getReferrers().empty()) { GlobalDSNode *GDN = *I; @@ -347,9 +347,9 @@ bool FunctionDSGraph::RemoveUnreachableNodes() { // getEscapingAllocations - Add all allocations that escape the current // function to the specified vector. // -void FunctionDSGraph::getEscapingAllocations(std::vector &Allocs) { - std::vector ReachableShadowNodes(ShadowNodes.size()); - std::vector ReachableAllocNodes (AllocNodes.size()); +void FunctionDSGraph::getEscapingAllocations(vector &Allocs) { + vector ReachableShadowNodes(ShadowNodes.size()); + vector ReachableAllocNodes (AllocNodes.size()); MarkEscapeableNodesReachable(ReachableShadowNodes, ReachableAllocNodes); @@ -361,9 +361,9 @@ void FunctionDSGraph::getEscapingAllocations(std::vector &Allocs) // getNonEscapingAllocations - Add all allocations that do not escape the // current function to the specified vector. // -void FunctionDSGraph::getNonEscapingAllocations(std::vector &Allocs) { - std::vector ReachableShadowNodes(ShadowNodes.size()); - std::vector ReachableAllocNodes (AllocNodes.size()); +void FunctionDSGraph::getNonEscapingAllocations(vector &Allocs) { + vector ReachableShadowNodes(ShadowNodes.size()); + vector ReachableAllocNodes (AllocNodes.size()); MarkEscapeableNodesReachable(ReachableShadowNodes, ReachableAllocNodes); diff --git a/lib/Analysis/DataStructure/FunctionRepBuilder.cpp b/lib/Analysis/DataStructure/FunctionRepBuilder.cpp index f90ab9ba604..be49eec177d 100644 --- a/lib/Analysis/DataStructure/FunctionRepBuilder.cpp +++ b/lib/Analysis/DataStructure/FunctionRepBuilder.cpp @@ -15,7 +15,6 @@ #include "llvm/Constants.h" #include "Support/STLExtras.h" #include -#include // synthesizeNode - Create a new shadow node that is to be linked into this // chain.. diff --git a/lib/Analysis/DataStructure/FunctionRepBuilder.h b/lib/Analysis/DataStructure/FunctionRepBuilder.h index 30e0bb21b6b..9965759fec4 100644 --- a/lib/Analysis/DataStructure/FunctionRepBuilder.h +++ b/lib/Analysis/DataStructure/FunctionRepBuilder.h @@ -10,7 +10,6 @@ #include "llvm/Analysis/DataStructure.h" #include "llvm/Support/InstVisitor.h" -#include // DEBUG_DATA_STRUCTURE_CONSTRUCTION - Define this to 1 if you want debug output //#define DEBUG_DATA_STRUCTURE_CONSTRUCTION 1 diff --git a/lib/Analysis/DataStructure/NodeImpl.cpp b/lib/Analysis/DataStructure/NodeImpl.cpp index b47b265814e..1b3fb76505e 100644 --- a/lib/Analysis/DataStructure/NodeImpl.cpp +++ b/lib/Analysis/DataStructure/NodeImpl.cpp @@ -13,7 +13,6 @@ #include "Support/STLExtras.h" #include #include -#include using std::map; using std::string; @@ -128,7 +127,7 @@ DSNode::DSNode(enum NodeTy NT, const Type *T) : Ty(T), NodeType(NT) { void DSNode::removeReferrer(PointerValSet *PVS) { std::vector::iterator I = std::find(Referrers.begin(), - Referrers.end(), PVS); + Referrers.end(), PVS); assert(I != Referrers.end() && "PVS not pointing to node!"); Referrers.erase(I); } -- 2.34.1