diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-02-26 19:40:28 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-02-26 19:40:28 +0000 |
| commit | 5328c6fd9708b1727e534ecaeda8cc96fb6a81e8 (patch) | |
| tree | 2e930ff8dad47a4671385e8a3a7bb069120dadcc /llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp | |
| parent | a9b9636aca3c4be9547503e8dcd2fcf6fbe71c28 (diff) | |
| download | bcm5719-llvm-5328c6fd9708b1727e534ecaeda8cc96fb6a81e8.tar.gz bcm5719-llvm-5328c6fd9708b1727e534ecaeda8cc96fb6a81e8.zip | |
* Changes to compile successfully with GCC 3.0
* Eliminated memory leak in processGraph
* Pass vectors by const reference to moveDummyCode instead of by copy
llvm-svn: 1808
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp b/llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp index b3e3ca1c86d..206af1f682d 100644 --- a/llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp +++ b/llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp @@ -1,13 +1,20 @@ //===--Graph.cpp--- implements Graph class ---------------- ------*- C++ -*--=// // // This implements Graph for helping in trace generation -// This graph gets used by "PathProfile" class +// This graph gets used by "ProfilePaths" class // //===----------------------------------------------------------------------===// #include "Graph.h" #include "llvm/BasicBlock.h" #include <algorithm> +#include <iostream> + +using std::list; +using std::set; +using std::map; +using std::vector; +using std::cerr; static const graphListElement *findNodeInList(const Graph::nodeList &NL, Node *N) { @@ -180,8 +187,8 @@ struct compare_nodes { }; -void printNode(Node *nd){ - cerr<<"Node:"<<nd->getElement()->getName()<<endl; +static void printNode(Node *nd){ + cerr<<"Node:"<<nd->getElement()->getName()<<"\n"; } //Get the Maximal spanning tree (also a graph) @@ -233,7 +240,7 @@ Graph* Graph::getMaxSpanningTree(){ while(!vt.empty()){ Node *u=*(min_element(vt.begin(), vt.end(), compare_nodes())); #ifdef DEBUG_PATH_PROFILES - cerr<<"popped wt"<<(u)->getWeight()<<endl; + cerr<<"popped wt"<<(u)->getWeight()<<"\n"; printNode(u); #endif if(parent[u]!=NULL){ //so not root @@ -270,8 +277,8 @@ Graph* Graph::getMaxSpanningTree(){ } } #ifdef DEBUG_PATH_PROFILES - cerr<<"wt:v->wt"<<weight<<":"<<v->getWeight()<<endl; - printNode(v);cerr<<"node wt:"<<(*v).weight<<endl; + cerr<<"wt:v->wt"<<weight<<":"<<v->getWeight()<<"\n"; + printNode(v);cerr<<"node wt:"<<(*v).weight<<"\n"; #endif //so if v in in vt, change wt(v) to wt(u->v) //only if wt(u->v)<wt(v) |

