From 5328c6fd9708b1727e534ecaeda8cc96fb6a81e8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 26 Feb 2002 19:40:28 +0000 Subject: * 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 --- .../Transforms/Instrumentation/ProfilePaths/Graph.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp') 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 +#include + +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:"<getElement()->getName()<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()<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"<getWeight()<wt"<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)