diff options
author | Chris Lattner <sabre@nondot.org> | 2002-05-22 21:56:32 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-05-22 21:56:32 +0000 |
commit | f09c74c3859f3c97dfe36d22d9ff1c536fc825ed (patch) | |
tree | 67c61113ce7c9a2e3318d197a645c2a53947a103 /lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp | |
parent | d9036a1aad813b419edcec8e17d24bcaedd72065 (diff) |
Convert code to use the DEBUG macro so that debug code can simply be
enabled with the -debug command line option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2721 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp')
-rw-r--r-- | lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp b/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp index 206af1f682..0e7bce06b4 100644 --- a/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp +++ b/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp @@ -239,17 +239,15 @@ Graph* Graph::getMaxSpanningTree(){ //keep pulling out vertex of min wt from vt while(!vt.empty()){ Node *u=*(min_element(vt.begin(), vt.end(), compare_nodes())); -#ifdef DEBUG_PATH_PROFILES - cerr<<"popped wt"<<(u)->getWeight()<<"\n"; - printNode(u); -#endif + DEBUG(cerr<<"popped wt"<<(u)->getWeight()<<"\n"; + printNode(u)); + if(parent[u]!=NULL){ //so not root Edge edge(parent[u],u, ed_weight[u]); //assign edge in spanning tree st->addEdge(edge,ed_weight[u]); -#ifdef DEBUG_PATH_PROFILES - cerr<<"added:\n"; - printEdge(edge); -#endif + + DEBUG(cerr<<"added:\n"; + printEdge(edge)); } //vt.erase(u); @@ -276,21 +274,19 @@ Graph* Graph::getMaxSpanningTree(){ break; } } -#ifdef DEBUG_PATH_PROFILES - cerr<<"wt:v->wt"<<weight<<":"<<v->getWeight()<<"\n"; - printNode(v);cerr<<"node wt:"<<(*v).weight<<"\n"; -#endif + DEBUG(cerr<<"wt:v->wt"<<weight<<":"<<v->getWeight()<<"\n"; + printNode(v);cerr<<"node wt:"<<(*v).weight<<"\n"); + //so if v in in vt, change wt(v) to wt(u->v) //only if wt(u->v)<wt(v) if(contains && weight<v->getWeight()){ parent[v]=u; ed_weight[v]=weight; v->setWeight(weight); -#ifdef DEBUG_PATH_PROFILES - cerr<<v->getWeight()<<":Set weight------\n"; - printGraph(); - printEdge(Edge(u,v,weight)); -#endif + + DEBUG(cerr<<v->getWeight()<<":Set weight------\n"; + printGraph(); + printEdge(Edge(u,v,weight))); } } } @@ -352,10 +348,8 @@ void Graph::makeUnDirectional(){ for(nodeList::iterator NLI=nl.begin(), NLE=nl.end(); NLI!=NLE; ++NLI){ Edge ed(NLI->element, *NI, NLI->weight); if(!hasEdgeAndWt(ed)){ -#ifdef DEBUG_PATH_PROFILES - cerr<<"######doesn't hv\n"; - printEdge(ed); -#endif + DEBUG(cerr<<"######doesn't hv\n"; + printEdge(ed)); addEdgeForce(ed); } } |