From: Chris Lattner Date: Wed, 29 Jan 2003 21:09:59 +0000 (+0000) Subject: New API for traversing graph X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=9e4b15b1a19b0903a14429f841b7b6a160dae44d;p=oota-llvm.git New API for traversing graph git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5430 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/DSNode.h b/include/llvm/Analysis/DSNode.h index a8339fde2f0..cf298a234e4 100644 --- a/include/llvm/Analysis/DSNode.h +++ b/include/llvm/Analysis/DSNode.h @@ -218,6 +218,12 @@ public: /// specified mapping. void remapLinks(std::map &OldNodeMap); + /// markReachableNodes - This method recursively traverses the specified + /// DSNodes, marking any nodes which are reachable. All reachable nodes it + /// adds to the set, which allows it to only traverse visited nodes once. + /// + void markReachableNodes(std::set &ReachableNodes); + private: friend class DSNodeHandle; diff --git a/include/llvm/Analysis/DSSupport.h b/include/llvm/Analysis/DSSupport.h index 29351cc8e5d..f0f261e0b9e 100644 --- a/include/llvm/Analysis/DSSupport.h +++ b/include/llvm/Analysis/DSSupport.h @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -214,6 +215,12 @@ public: getPtrArg(a).mergeWith(CS.getPtrArg(a)); } + /// markReachableNodes - This method recursively traverses the specified + /// DSNodes, marking any nodes which are reachable. All reachable nodes it + /// adds to the set, which allows it to only traverse visited nodes once. + /// + void markReachableNodes(std::set &Nodes); + bool operator<(const DSCallSite &CS) const { if (Callee < CS.Callee) return true; // This must sort by callee first! if (Callee > CS.Callee) return false; diff --git a/include/llvm/Analysis/DataStructure/DSNode.h b/include/llvm/Analysis/DataStructure/DSNode.h index a8339fde2f0..cf298a234e4 100644 --- a/include/llvm/Analysis/DataStructure/DSNode.h +++ b/include/llvm/Analysis/DataStructure/DSNode.h @@ -218,6 +218,12 @@ public: /// specified mapping. void remapLinks(std::map &OldNodeMap); + /// markReachableNodes - This method recursively traverses the specified + /// DSNodes, marking any nodes which are reachable. All reachable nodes it + /// adds to the set, which allows it to only traverse visited nodes once. + /// + void markReachableNodes(std::set &ReachableNodes); + private: friend class DSNodeHandle; diff --git a/include/llvm/Analysis/DataStructure/DSSupport.h b/include/llvm/Analysis/DataStructure/DSSupport.h index 29351cc8e5d..f0f261e0b9e 100644 --- a/include/llvm/Analysis/DataStructure/DSSupport.h +++ b/include/llvm/Analysis/DataStructure/DSSupport.h @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -214,6 +215,12 @@ public: getPtrArg(a).mergeWith(CS.getPtrArg(a)); } + /// markReachableNodes - This method recursively traverses the specified + /// DSNodes, marking any nodes which are reachable. All reachable nodes it + /// adds to the set, which allows it to only traverse visited nodes once. + /// + void markReachableNodes(std::set &Nodes); + bool operator<(const DSCallSite &CS) const { if (Callee < CS.Callee) return true; // This must sort by callee first! if (Callee > CS.Callee) return false;