diff options
author | Chris Lattner <sabre@nondot.org> | 2003-06-30 05:57:30 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-06-30 05:57:30 +0000 |
commit | bfce1115e320db82a03a5bc7db6da4bd366114f5 (patch) | |
tree | aa9481b76b72674639c6ee0701c6ce743df1b5c7 | |
parent | f8865a4389d82a5d761ae8161bf058bdf0fafa07 (diff) | |
download | bcm5719-llvm-bfce1115e320db82a03a5bc7db6da4bd366114f5.tar.gz bcm5719-llvm-bfce1115e320db82a03a5bc7db6da4bd366114f5.zip |
Add new method
llvm-svn: 7007
-rw-r--r-- | llvm/include/llvm/Analysis/DSGraph.h | 4 | ||||
-rw-r--r-- | llvm/lib/Analysis/DataStructure/DataStructure.cpp | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/llvm/include/llvm/Analysis/DSGraph.h b/llvm/include/llvm/Analysis/DSGraph.h index c08d404cea9..81979cf74ec 100644 --- a/llvm/include/llvm/Analysis/DSGraph.h +++ b/llvm/include/llvm/Analysis/DSGraph.h @@ -80,6 +80,10 @@ public: const std::vector<DSNode*> &getNodes() const { return Nodes; } std::vector<DSNode*> &getNodes() { return Nodes; } + /// getFunctionNames - Return a space separated list of the name of the + /// functions in this graph (if any) + std::string getFunctionNames() const; + /// addNode - Add a new node to the graph. /// void addNode(DSNode *N) { Nodes.push_back(N); } diff --git a/llvm/lib/Analysis/DataStructure/DataStructure.cpp b/llvm/lib/Analysis/DataStructure/DataStructure.cpp index fbd223f71b0..cd73acbc7c7 100644 --- a/llvm/lib/Analysis/DataStructure/DataStructure.cpp +++ b/llvm/lib/Analysis/DataStructure/DataStructure.cpp @@ -703,6 +703,23 @@ Function &DSCallSite::getCaller() const { // DSGraph Implementation //===----------------------------------------------------------------------===// +/// getFunctionNames - Return a space separated list of the name of the +/// functions in this graph (if any) +std::string DSGraph::getFunctionNames() const { + switch (getReturnNodes().size()) { + case 0: return "Globals graph"; + case 1: return getReturnNodes().begin()->first->getName(); + default: + std::string Return; + for (DSGraph::ReturnNodesTy::const_iterator I = getReturnNodes().begin(); + I != getReturnNodes().end(); ++I) + Return += I->first->getName() + " "; + Return.erase(Return.end()-1, Return.end()); // Remove last space character + return Return; + } +} + + DSGraph::DSGraph(const DSGraph &G) : GlobalsGraph(0) { PrintAuxCalls = false; NodeMapTy NodeMap; |