[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp EdgeCode.cpp Graph.cpp Graph.h GraphAuxiliary.cpp InstLoops.cpp RetracePath.cpp

Jeff Cohen jeffc at jolt-lang.org
Sat Apr 23 14:38:47 PDT 2005



Changes in directory llvm/lib/Transforms/Instrumentation/ProfilePaths:

CombineBranch.cpp updated: 1.14 -> 1.15
EdgeCode.cpp updated: 1.29 -> 1.30
Graph.cpp updated: 1.20 -> 1.21
Graph.h updated: 1.13 -> 1.14
GraphAuxiliary.cpp updated: 1.27 -> 1.28
InstLoops.cpp updated: 1.20 -> 1.21
RetracePath.cpp updated: 1.12 -> 1.13
---
Log message:

Eliminate tabs and trailing spaces

---
Diffs of the changes:  (+203 -203)

 CombineBranch.cpp  |   96 ++++++++++++++---------------
 EdgeCode.cpp       |   18 ++---
 Graph.cpp          |   48 +++++++-------
 Graph.h            |   10 +--
 GraphAuxiliary.cpp |  174 ++++++++++++++++++++++++++---------------------------
 InstLoops.cpp      |   18 ++---
 RetracePath.cpp    |   42 ++++++------
 7 files changed, 203 insertions(+), 203 deletions(-)


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp:1.14 llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp:1.15
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp:1.14	Thu Apr 21 18:40:47 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp	Sat Apr 23 16:38:35 2005
@@ -30,10 +30,10 @@
     enum Color { WHITE, GREY, BLACK };
 
     void getBackEdgesVisit(BasicBlock *u,
-			   std::map<BasicBlock *, Color > &color,
-			   std::map<BasicBlock *, int > &d,
-			   int &time,
-			   std::map<BasicBlock *, BasicBlock *> &be);
+                           std::map<BasicBlock *, Color > &color,
+                           std::map<BasicBlock *, int > &d,
+                           int &time,
+                           std::map<BasicBlock *, BasicBlock *> &be);
     void removeRedundant(std::map<BasicBlock *, BasicBlock *> &be);
   public:
     bool runOnFunction(Function &F);
@@ -55,7 +55,7 @@
                        std::map<BasicBlock *, Color > &color,
                        std::map<BasicBlock *, int > &d,
                        int &time,
-		       std::map<BasicBlock *, BasicBlock *> &be) {
+                       std::map<BasicBlock *, BasicBlock *> &be) {
 
   color[u]=GREY;
   time++;
@@ -71,7 +71,7 @@
     else if(color[BB]==GREY){
       //so v is ancestor of u if time of u > time of v
       if(d[u] >= d[BB]) // u->BB is a backedge
-	be[u] = BB;
+        be[u] = BB;
     }
   }
   color[u]=BLACK;//done with visiting the node and its neighbors
@@ -85,7 +85,7 @@
   std::map<BasicBlock *, int> seenBB;
 
   for(std::map<BasicBlock *, BasicBlock *>::iterator MI = be.begin(),
-	ME = be.end(); MI != ME; ++MI){
+        ME = be.end(); MI != ME; ++MI){
 
     if(seenBB[MI->second])
       continue;
@@ -96,13 +96,13 @@
     sameTarget.clear();
 
     for(std::map<BasicBlock *, BasicBlock *>::iterator MMI = be.begin(),
-	  MME = be.end(); MMI != MME; ++MMI){
+          MME = be.end(); MMI != MME; ++MMI){
 
       if(MMI->first == MI->first)
-	continue;
+        continue;
 
       if(MMI->second == MI->second)
-	sameTarget.push_back(MMI->first);
+        sameTarget.push_back(MMI->first);
 
     }
 
@@ -117,49 +117,49 @@
       std::map<PHINode *, std::vector<unsigned int> > phiMap;
 
       for(std::vector<BasicBlock *>::iterator VBI = sameTarget.begin(),
-	    VBE = sameTarget.end(); VBI != VBE; ++VBI){
+            VBE = sameTarget.end(); VBI != VBE; ++VBI){
 
-	BranchInst *ti = cast<BranchInst>((*VBI)->getTerminator());
-	unsigned char index = 1;
-	if(ti->getSuccessor(0) == MI->second)
-	  index = 0;
-
-	ti->setSuccessor(index, newBB);
-
-	for(BasicBlock::iterator BB2Inst = MI->second->begin(),
-	      BBend = MI->second->end(); BB2Inst != BBend; ++BB2Inst){
-	
-	  if (PHINode *phiInst = dyn_cast<PHINode>(BB2Inst)){
-	    int bbIndex;
-	    bbIndex = phiInst->getBasicBlockIndex(*VBI);
-	    if(bbIndex>=0)
-	      phiMap[phiInst].push_back(bbIndex);
-	  }
-	}
+        BranchInst *ti = cast<BranchInst>((*VBI)->getTerminator());
+        unsigned char index = 1;
+        if(ti->getSuccessor(0) == MI->second)
+          index = 0;
+
+        ti->setSuccessor(index, newBB);
+
+        for(BasicBlock::iterator BB2Inst = MI->second->begin(),
+              BBend = MI->second->end(); BB2Inst != BBend; ++BB2Inst){
+
+          if (PHINode *phiInst = dyn_cast<PHINode>(BB2Inst)){
+            int bbIndex;
+            bbIndex = phiInst->getBasicBlockIndex(*VBI);
+            if(bbIndex>=0)
+              phiMap[phiInst].push_back(bbIndex);
+          }
+        }
       }
 
       for(std::map<PHINode *, std::vector<unsigned int> >::iterator
-	    PI = phiMap.begin(), PE = phiMap.end(); PI != PE; ++PI){
-	
-	PHINode *phiNode = new PHINode(PI->first->getType(), "phi", newBranch);
-	for(std::vector<unsigned int>::iterator II = PI->second.begin(),
-	      IE = PI->second.end(); II != IE; ++II){
-	  phiNode->addIncoming(PI->first->getIncomingValue(*II),
-			       PI->first->getIncomingBlock(*II));
-	}
-
-	std::vector<BasicBlock *> tempBB;
-	for(std::vector<unsigned int>::iterator II = PI->second.begin(),
-	      IE = PI->second.end(); II != IE; ++II){
-	  tempBB.push_back(PI->first->getIncomingBlock(*II));
-	}
-
-	for(std::vector<BasicBlock *>::iterator II = tempBB.begin(),
-	      IE = tempBB.end(); II != IE; ++II){
-	  PI->first->removeIncomingValue(*II);
-	}
+            PI = phiMap.begin(), PE = phiMap.end(); PI != PE; ++PI){
 
-	PI->first->addIncoming(phiNode, newBB);
+        PHINode *phiNode = new PHINode(PI->first->getType(), "phi", newBranch);
+        for(std::vector<unsigned int>::iterator II = PI->second.begin(),
+              IE = PI->second.end(); II != IE; ++II){
+          phiNode->addIncoming(PI->first->getIncomingValue(*II),
+                               PI->first->getIncomingBlock(*II));
+        }
+
+        std::vector<BasicBlock *> tempBB;
+        for(std::vector<unsigned int>::iterator II = PI->second.begin(),
+              IE = PI->second.end(); II != IE; ++II){
+          tempBB.push_back(PI->first->getIncomingBlock(*II));
+        }
+
+        for(std::vector<BasicBlock *>::iterator II = tempBB.begin(),
+              IE = tempBB.end(); II != IE; ++II){
+          PI->first->removeIncomingValue(*II);
+        }
+
+        PI->first->addIncoming(phiNode, newBB);
       }
     }
   }


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.29 llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.30
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp:1.29	Thu Apr 21 18:40:47 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp	Sat Apr 23 16:38:35 2005
@@ -59,7 +59,7 @@
 //get the code to be inserted on the edge
 //This is determined from cond (1-6)
 void getEdgeCode::getCode(Instruction *rInst, Value *countInst,
-			  Function *M, BasicBlock *BB,
+                          Function *M, BasicBlock *BB,
                           vector<Value *> &retVec){
 
   //Instruction *InsertPos = BB->getInstList().begin();
@@ -143,7 +143,7 @@
     retVec.push_back(trAddIndex);
     //insert trigger
     //getTriggerCode(M->getParent(), BB, MethNo,
-    //	   ConstantSInt::get(Type::IntTy,inc), newCount, triggerInst);
+    //     ConstantSInt::get(Type::IntTy,inc), newCount, triggerInst);
     //end trigger code
 
     assert(inc>=0 && "IT MUST BE POSITIVE NOW");
@@ -164,7 +164,7 @@
 
     //now load count[addIndex]
     Instruction *castInst=new CastInst(addIndex,
-				       Type::LongTy,"ctin");//, InsertPos);
+                                       Type::LongTy,"ctin");//, InsertPos);
     BB->getInstList().push_back(castInst);
 
     vector<Value *> tmpVec;
@@ -252,8 +252,8 @@
 //Count is an array, where Count[k] represents
 //the number of executions of path k
 void insertInTopBB(BasicBlock *front,
-		   int k,
-		   Instruction *rVar, Value *threshold){
+                   int k,
+                   Instruction *rVar, Value *threshold){
   //rVar is variable r,
   //countVar is count[]
 
@@ -281,10 +281,10 @@
 //insert a basic block with appropriate code
 //along a given edge
 void insertBB(Edge ed,
-	      getEdgeCode *edgeCode,
-	      Instruction *rInst,
-	      Value *countInst,
-	      int numPaths, int Methno, Value *threshold){
+              getEdgeCode *edgeCode,
+              Instruction *rInst,
+              Value *countInst,
+              int numPaths, int Methno, Value *threshold){
 
   BasicBlock* BB1=ed.getFirst()->getElement();
   BasicBlock* BB2=ed.getSecond()->getElement();


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp:1.20 llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp:1.21
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp:1.20	Thu Apr 21 18:40:47 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp	Sat Apr 23 16:38:35 2005
@@ -22,7 +22,7 @@
 namespace llvm {
 
 const graphListElement *findNodeInList(const Graph::nodeList &NL,
-					      Node *N) {
+                                       Node *N) {
   for(Graph::nodeList::const_iterator NI = NL.begin(), NE=NL.end(); NI != NE;
       ++NI)
     if (*NI->element== *N)
@@ -39,7 +39,7 @@
 
 //graph constructor with root and exit specified
 Graph::Graph(std::vector<Node*> n, std::vector<Edge> e,
-	     Node *rt, Node *lt){
+             Node *rt, Node *lt){
   strt=rt;
   ext=lt;
   for(vector<Node* >::iterator x=n.begin(), en=n.end(); x!=en; ++x)
@@ -297,9 +297,9 @@
     Node *lnode=EI->first;
     const nodeList &nl = getNodeList(lnode);
     for(Graph::nodeList::const_iterator NI = nl.begin(), NE=nl.end(); NI != NE;
-	++NI)
+        ++NI)
       if (*NI->element== *nd)
-	count++;
+        count++;
   }
   return count;
 }
@@ -400,8 +400,8 @@
     //remove u frm vt
     for(vector<Node *>::iterator VI=vt.begin(), VE=vt.end(); VI!=VE; ++VI){
       if(**VI==*u){
-	vt.erase(VI);
-	break;
+        vt.erase(VI);
+        break;
       }
     }
 
@@ -414,10 +414,10 @@
       //check if v is in vt
       bool contains=false;
       for(vector<Node *>::iterator VI=vt.begin(), VE=vt.end(); VI!=VE; ++VI){
-	if(**VI==*v){
-	  contains=true;
-	  break;
-	}
+        if(**VI==*v){
+          contains=true;
+          break;
+        }
       }
       DEBUG(std::cerr<<"wt:v->wt"<<weight<<":"<<v->getWeight()<<"\n";
             printNode(v);std::cerr<<"node wt:"<<(*v).weight<<"\n");
@@ -425,11 +425,11 @@
       //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);
+        parent[v]=u;
+        ed_weight[v]=weight;
+        v->setWeight(weight);
 
-	DEBUG(std::cerr<<v->getWeight()<<":Set weight------\n";
+        DEBUG(std::cerr<<v->getWeight()<<":Set weight------\n";
               printGraph();
               printEdge(Edge(u,v,weight)));
       }
@@ -447,7 +447,7 @@
      Graph::nodeList &nl = getNodeList(*LI);
      for(Graph::nodeList::iterator NI=nl.begin(), NE=nl.end(); NI!=NE; ++NI){
        std::cerr<<":"<<"("<<(NI->element->getElement())
-	 ->getName()<<":"<<NI->element->getWeight()<<","<<NI->weight<<")";
+         ->getName()<<":"<<NI->element->getWeight()<<","<<NI->weight<<")";
      }
      std::cerr<<"--------\n";
    }
@@ -494,9 +494,9 @@
     for(nodeList::iterator NLI=nl.begin(), NLE=nl.end(); NLI!=NLE; ++NLI){
       Edge ed(NLI->element, *NI, NLI->weight);
       if(!hasEdgeAndWt(ed)){
-	DEBUG(std::cerr<<"######doesn't hv\n";
+        DEBUG(std::cerr<<"######doesn't hv\n";
               printEdge(ed));
-	addEdgeForce(ed);
+        addEdgeForce(ed);
       }
     }
   }
@@ -511,7 +511,7 @@
       ++NI) {
     nodeList &node_list = getNodeList(*NI);
     for(nodeList::iterator NLI=nodes[*NI].begin(), NLE=nodes[*NI].end();
-	NLI!=NLE; ++NLI)
+        NLI!=NLE; ++NLI)
       NLI->weight=-NLI->weight;
   }
 }
@@ -538,8 +538,8 @@
 //helper function to get back edges: it is called by
 //the "getBackEdges" function above
 void Graph::getBackEdgesVisit(Node *u, vector<Edge > &be,
-			      std::map<Node *, Color > &color,
-			      std::map<Node *, int > &d, int &time) {
+                              std::map<Node *, Color > &color,
+                              std::map<Node *, int > &d, int &time) {
   color[u]=GREY;
   time++;
   d[u]=time;
@@ -547,7 +547,7 @@
   vector<graphListElement> &succ_list = getNodeList(u);
 
   for(vector<graphListElement>::iterator vl=succ_list.begin(),
-	ve=succ_list.end(); vl!=ve; ++vl){
+        ve=succ_list.end(); vl!=ve; ++vl){
     Node *v=vl->element;
     if(color[v]!=GREY && color[v]!=BLACK){
       getBackEdgesVisit(v, be, color, d, time);
@@ -557,9 +557,9 @@
     if(color[v]==GREY){
       //so v is ancestor of u if time of u > time of v
       if(d[u] >= d[v]){
-	Edge *ed=new Edge(u, v,vl->weight, vl->randId);
-	if (!(*u == *getExit() && *v == *getRoot()))
-	  be.push_back(*ed);      // choose the forward edges
+        Edge *ed=new Edge(u, v,vl->weight, vl->randId);
+        if (!(*u == *getExit() && *v == *getRoot()))
+          be.push_back(*ed);      // choose the forward edges
       }
     }
   }


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.h
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.h:1.13 llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.h:1.14
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.h:1.13	Thu Apr 21 18:40:47 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/Graph.h	Sat Apr 23 16:38:35 2005
@@ -233,10 +233,10 @@
   //So we have a back edge when we meet a successor of
   //a node with smaller time, and GREY color
   void getBackEdgesVisit(Node *u,
-			 std::vector<Edge > &be,
-			 std::map<Node *, Color> &clr,
-			 std::map<Node *, int> &d,
-			 int &time);
+                         std::vector<Edge > &be,
+                         std::map<Node *, Color> &clr,
+                         std::map<Node *, int> &d,
+                         int &time);
 
 public:
   typedef nodeMapTy::iterator elementIterator;
@@ -251,7 +251,7 @@
 
   //constructor with root and exit node specified
   Graph(std::vector<Node*> n,
-	std::vector<Edge> e, Node *rt, Node *lt);
+        std::vector<Edge> e, Node *rt, Node *lt);
 
   //add a node
   void addNode(Node *nd);


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp:1.27 llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp:1.28
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp:1.27	Thu Apr 21 18:40:47 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp	Sat Apr 23 16:38:35 2005
@@ -40,10 +40,10 @@
       ++NI){
     Graph::nodeList node_list=g.getNodeList(*NI);
     for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end();
-	NLI!=NLE; ++NLI){
+        NLI!=NLE; ++NLI){
       Edge f(*NI, NLI->element,NLI->weight, NLI->randId);
       if(!(st.hasEdgeAndWt(f)))//addnl
-	chords.push_back(f);
+        chords.push_back(f);
     }
   }
 }
@@ -60,7 +60,7 @@
   for(vector<Node *>::iterator NI=allNodes.begin(), NE=allNodes.end(); NI!=NE;
       ++NI){
     Graph::nodeList nl=t.getNodeList(*NI);
-    for(Graph::nodeList::iterator NLI=nl.begin(), NLE=nl.end();	NLI!=NLE;++NLI){
+    for(Graph::nodeList::iterator NLI=nl.begin(), NLE=nl.end(); NLI!=NLE;++NLI){
       Edge ed(NLI->element, *NI, NLI->weight);
       if(!g.hasEdgeAndWt(ed)) t.removeEdge(ed);//tree has only one edge
       //between any pair of vertices, so no need to delete by edge wt
@@ -91,8 +91,8 @@
       int sz=nlist.size();
 
       for(int i=0;i<sz-1; i++){
-	int min=i;
-	for(int j=i+1; j<sz; j++){
+        int min=i;
+        for(int j=i+1; j<sz; j++){
           BasicBlock *bb1 = nlist[j].element->getElement();
           BasicBlock *bb2 = nlist[min].element->getElement();
 
@@ -123,16 +123,16 @@
           }
 
         }
-	graphListElement tempEl=nlist[min];
-	nlist[min]=nlist[i];
-	nlist[i]=tempEl;
+        graphListElement tempEl=nlist[min];
+        nlist[min]=nlist[i];
+        nlist[i]=tempEl;
       }
 
       //sorted now!
       for(Graph::nodeList::iterator GLI=nlist.begin(), GLE=nlist.end();
-	  GLI!=GLE; ++GLI){
-       	GLI->weight=NumPaths[*RI];
-	NumPaths[*RI]+=NumPaths[GLI->element];
+          GLI!=GLE; ++GLI){
+        GLI->weight=NumPaths[*RI];
+        NumPaths[*RI]+=NumPaths[GLI->element];
       }
     }
   }
@@ -154,9 +154,9 @@
 
  //check that the edges must have at least one common endpoint
   assert(*(e.getFirst())==*(f.getFirst()) ||
-	 *(e.getFirst())==*(f.getSecond()) ||
-	 *(e.getSecond())==*(f.getFirst()) ||
-	 *(e.getSecond())==*(f.getSecond()));
+         *(e.getFirst())==*(f.getSecond()) ||
+         *(e.getSecond())==*(f.getFirst()) ||
+         *(e.getSecond())==*(f.getSecond()));
 
   if(*(e.getFirst())==*(f.getSecond()) ||
      *(e.getSecond())==*(f.getFirst()))
@@ -169,7 +169,7 @@
 //used for getting edge increments (read comments above in inc_Dir)
 //inc_DFS is a modification of DFS
 static void inc_DFS(Graph& g,Graph& t,map<Edge, int, EdgeCompare2>& Increment,
-	     int events, Node *v, Edge e){
+             int events, Node *v, Edge e){
 
   vector<Node *> allNodes=t.getAllNodes();
 
@@ -177,12 +177,12 @@
       ++NI){
     Graph::nodeList node_list=t.getNodeList(*NI);
     for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end();
-	NLI!= NLE; ++NLI){
+        NLI!= NLE; ++NLI){
       Edge f(*NI, NLI->element,NLI->weight, NLI->randId);
       if(!edgesEqual(f,e) && *v==*(f.getSecond())){
-	int dir_count=inc_Dir(e,f);
-	int wt=1*f.getWeight();
-	inc_DFS(g,t, Increment, dir_count*events+wt, f.getFirst(), f);
+        int dir_count=inc_Dir(e,f);
+        int wt=1*f.getWeight();
+        inc_DFS(g,t, Increment, dir_count*events+wt, f.getFirst(), f);
       }
     }
   }
@@ -191,13 +191,13 @@
       ++NI){
     Graph::nodeList node_list=t.getNodeList(*NI);
     for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end();
-	NLI!=NLE; ++NLI){
+        NLI!=NLE; ++NLI){
       Edge f(*NI, NLI->element,NLI->weight, NLI->randId);
       if(!edgesEqual(f,e) && *v==*(f.getFirst())){
-      	int dir_count=inc_Dir(e,f);
-	int wt=f.getWeight();
-	inc_DFS(g,t, Increment, dir_count*events+wt,
-		f.getSecond(), f);
+        int dir_count=inc_Dir(e,f);
+        int wt=f.getWeight();
+        inc_DFS(g,t, Increment, dir_count*events+wt,
+                f.getSecond(), f);
       }
     }
   }
@@ -207,12 +207,12 @@
       ++NI){
     Graph::nodeList node_list=g.getNodeList(*NI);
     for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end();
-	NLI!=NLE; ++NLI){
+        NLI!=NLE; ++NLI){
       Edge f(*NI, NLI->element,NLI->weight, NLI->randId);
       if(!(t.hasEdgeAndWt(f)) && (*v==*(f.getSecond()) ||
-				  *v==*(f.getFirst()))){
-	int dir_count=inc_Dir(e,f);
-	Increment[f]+=dir_count*events;
+                                  *v==*(f.getFirst()))){
+        int dir_count=inc_Dir(e,f);
+        Increment[f]+=dir_count*events;
       }
     }
   }
@@ -234,10 +234,10 @@
     Graph::nodeList node_list=g.getSortedNodeList(*NI, be);
     //modified g.getNodeList(*NI);
     for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end();
-	NLI!=NLE; ++NLI){
+        NLI!=NLE; ++NLI){
       Edge ed(*NI, NLI->element,NLI->weight,NLI->randId);
       if(!(t.hasEdgeAndWt(ed))){
-	Increment[ed]=0;;
+        Increment[ed]=0;;
       }
     }
   }
@@ -250,11 +250,11 @@
     Graph::nodeList node_list=g.getSortedNodeList(*NI, be);
     //modified g.getNodeList(*NI);
     for(Graph::nodeList::iterator NLI=node_list.begin(), NLE=node_list.end();
-	NLI!=NLE; ++NLI){
+        NLI!=NLE; ++NLI){
       Edge ed(*NI, NLI->element,NLI->weight, NLI->randId);
       if(!(t.hasEdgeAndWt(ed))){
-	int wt=ed.getWeight();
-	Increment[ed]+=wt;
+        int wt=ed.getWeight();
+        Increment[ed]+=wt;
       }
     }
   }
@@ -264,7 +264,7 @@
 
 //push it up: TODO
 const graphListElement *findNodeInList(const Graph::nodeList &NL,
-					      Node *N);
+                                              Node *N);
 
 graphListElement *findNodeInList(Graph::nodeList &NL, Node *N);
 //end TODO
@@ -287,33 +287,33 @@
     Graph::nodeList succs=g.getNodeList(v);
 
     for(Graph::nodeList::iterator nl=succs.begin(), ne=succs.end();
-	nl!=ne; ++nl){
+        nl!=ne; ++nl){
       int edgeWt=nl->weight;
       Node *w=nl->element;
       //if chords has v->w
       Edge ed(v,w, edgeWt, nl->randId);
       bool hasEdge=false;
       for(vector<Edge>::iterator CI=chords.begin(), CE=chords.end();
-	  CI!=CE && !hasEdge;++CI){
-	if(*CI==ed && CI->getWeight()==edgeWt){//modf
-	  hasEdge=true;
-	}
+          CI!=CE && !hasEdge;++CI){
+        if(*CI==ed && CI->getWeight()==edgeWt){//modf
+          hasEdge=true;
+        }
       }
 
       if(hasEdge){//so its a chord edge
-	getEdgeCode *edCd=new getEdgeCode();
-	edCd->setCond(1);
-	edCd->setInc(edIncrements[ed]);
-	instr[ed]=edCd;
+        getEdgeCode *edCd=new getEdgeCode();
+        edCd->setCond(1);
+        edCd->setInc(edIncrements[ed]);
+        instr[ed]=edCd;
       }
       else if(g.getNumberOfIncomingEdges(w)==1){
-	ws.push_back(w);
+        ws.push_back(w);
       }
       else{
-	getEdgeCode *edCd=new getEdgeCode();
-	edCd->setCond(2);
-	edCd->setInc(0);
-	instr[ed]=edCd;
+        getEdgeCode *edCd=new getEdgeCode();
+        edCd->setCond(2);
+        edCd->setInc(0);
+        instr[ed]=edCd;
       }
     }
   }
@@ -335,7 +335,7 @@
       //graphListElement *N = findNodeInList(nl, w);
       for(Graph::nodeList::const_iterator N = nl.begin(),
             NNEN = nl.end(); N!= NNEN; ++N){
-        if (*N->element == *w){	
+        if (*N->element == *w){
           Node *v=lnode;
 
           //if chords has v->w
@@ -388,8 +388,8 @@
 //and outgoing dummy edge is a->exit
 //changed
 void addDummyEdges(vector<Edge > &stDummy,
-		   vector<Edge > &exDummy,
-		   Graph &g, vector<Edge> &be){
+                   vector<Edge > &exDummy,
+                   Graph &g, vector<Edge> &be){
   for(vector<Edge >::iterator VI=be.begin(), VE=be.end(); VI!=VE; ++VI){
     Edge ed=*VI;
     Node *first=ed.getFirst();
@@ -414,7 +414,7 @@
 void printEdge(Edge ed){
   cerr<<((ed.getFirst())->getElement())
     ->getName()<<"->"<<((ed.getSecond())
-			  ->getElement())->getName()<<
+                          ->getElement())->getName()<<
     ":"<<ed.getWeight()<<" rndId::"<<ed.getRandId()<<"\n";
 }
 
@@ -424,14 +424,14 @@
                           vector<Edge> &exDummy,
                           vector<Edge> &be,
                           map<Edge, getEdgeCode *, EdgeCompare2> &insertions,
-			  Graph &g){
+                          Graph &g){
   typedef vector<Edge >::iterator vec_iter;
 
   map<Edge,getEdgeCode *, EdgeCompare2> temp;
   //iterate over edges with code
   std::vector<Edge> toErase;
   for(map<Edge,getEdgeCode *, EdgeCompare2>::iterator MI=insertions.begin(),
-	ME=insertions.end(); MI!=ME; ++MI){
+        ME=insertions.end(); MI!=ME; ++MI){
     Edge ed=MI->first;
     getEdgeCode *edCd=MI->second;
 
@@ -439,26 +439,26 @@
     //iterate over be, and check if its starts and end vertices hv code
     for(vector<Edge>::iterator BEI=be.begin(), BEE=be.end(); BEI!=BEE; ++BEI){
       if(ed.getRandId()==BEI->getRandId()){
-	
-	if(temp[*BEI]==0)
-	  temp[*BEI]=new getEdgeCode();
-	
-	//so ed is either in st, or ex!
-	if(ed.getFirst()==g.getRoot()){
-
-	  //so its in stDummy
-	  temp[*BEI]->setCdIn(edCd);
-	  toErase.push_back(ed);
-	}
-	else if(ed.getSecond()==g.getExit()){
-
-	  //so its in exDummy
-	  toErase.push_back(ed);
-	  temp[*BEI]->setCdOut(edCd);
-	}
-	else{
-	  assert(false && "Not found in either start or end! Rand failed?");
-	}
+
+        if(temp[*BEI]==0)
+          temp[*BEI]=new getEdgeCode();
+
+        //so ed is either in st, or ex!
+        if(ed.getFirst()==g.getRoot()){
+
+          //so its in stDummy
+          temp[*BEI]->setCdIn(edCd);
+          toErase.push_back(ed);
+        }
+        else if(ed.getSecond()==g.getExit()){
+
+          //so its in exDummy
+          toErase.push_back(ed);
+          temp[*BEI]->setCdOut(edCd);
+        }
+        else{
+          assert(false && "Not found in either start or end! Rand failed?");
+        }
       }
     }
   }
@@ -485,12 +485,12 @@
 //appropriate code insertions etc and insert the code at
 //appropriate locations
 void processGraph(Graph &g,
-		  Instruction *rInst,
-		  Value *countInst,
-		  vector<Edge >& be,
-		  vector<Edge >& stDummy,
-		  vector<Edge >& exDummy,
-		  int numPaths, int MethNo,
+                  Instruction *rInst,
+                  Value *countInst,
+                  vector<Edge >& be,
+                  vector<Edge >& stDummy,
+                  vector<Edge >& exDummy,
+                  int numPaths, int MethNo,
                   Value *threshold){
 
   //Given a graph: with exit->root edge, do the following in seq:
@@ -621,7 +621,7 @@
   //print edges with code for debugging
   cerr<<"Code inserted in following---------------\n";
   for(map<Edge, getEdgeCode *, EdgeCompare2>::iterator cd_i=codeInsertions.begin(),
-	cd_e=codeInsertions.end(); cd_i!=cd_e; ++cd_i){
+        cd_e=codeInsertions.end(); cd_i!=cd_e; ++cd_i){
     printEdge(cd_i->first);
     cerr<<cd_i->second->getCond()<<":"<<cd_i->second->getInc()<<"\n";
   }
@@ -639,10 +639,10 @@
   //debugging info
   cerr<<"After moving dummy code\n";
   for(map<Edge, getEdgeCode *,EdgeCompare2>::iterator cd_i=codeInsertions.begin(),
-	cd_e=codeInsertions.end(); cd_i != cd_e; ++cd_i){
+        cd_e=codeInsertions.end(); cd_i != cd_e; ++cd_i){
     printEdge(cd_i->first);
     cerr<<cd_i->second->getCond()<<":"
-	<<cd_i->second->getInc()<<"\n";
+        <<cd_i->second->getInc()<<"\n";
   }
   cerr<<"Dummy end------------\n";
 #endif
@@ -651,7 +651,7 @@
   //see what it looks like...
   //now insert code along edges which have codes on them
   for(map<Edge, getEdgeCode *,EdgeCompare2>::iterator MI=codeInsertions.begin(),
-	ME=codeInsertions.end(); MI!=ME; ++MI){
+        ME=codeInsertions.end(); MI!=ME; ++MI){
     Edge ed=MI->first;
     insertBB(ed, MI->second, rInst, countInst, numPaths, MethNo, threshold);
   }
@@ -666,10 +666,10 @@
     cerr<<((*LI)->getElement())->getName()<<"->";
     Graph::nodeList nl=g.getNodeList(*LI);
     for(Graph::nodeList::iterator NI=nl.begin();
-	NI!=nl.end(); ++NI){
+        NI!=nl.end(); ++NI){
       cerr<<":"<<"("<<(NI->element->getElement())
-	->getName()<<":"<<NI->element->getWeight()<<","<<NI->weight<<","
-	  <<NI->randId<<")";
+        ->getName()<<":"<<NI->element->getWeight()<<","<<NI->weight<<","
+          <<NI->randId<<")";
     }
     cerr<<"\n";
   }


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.20 llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.21
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp:1.20	Thu Apr 21 18:40:47 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp	Sat Apr 23 16:38:35 2005
@@ -45,9 +45,9 @@
     Function *inCountMth;
     DominatorSet *DS;
     void getBackEdgesVisit(BasicBlock *u,
-			   std::map<BasicBlock *, Color > &color,
-			   std::map<BasicBlock *, int > &d,
-			   int &time, BBMap &be);
+                           std::map<BasicBlock *, Color > &color,
+                           std::map<BasicBlock *, int > &d,
+                           int &time, BBMap &be);
     void removeRedundant(BBMap &be);
     void findAndInstrumentBackEdges(Function &F);
   public:
@@ -79,8 +79,8 @@
     else if(color[BB]==GREY){
       //so v is ancestor of u if time of u > time of v
       if(d[u] >= d[BB]){
-	//u->BB is a backedge
-	be[u] = BB;
+        //u->BB is a backedge
+        be[u] = BB;
       }
     }
   }
@@ -92,13 +92,13 @@
 void InstLoops::removeRedundant(BBMap &be) {
   std::vector<BasicBlock *> toDelete;
   for(std::map<BasicBlock *, BasicBlock *>::iterator MI = be.begin(),
-	ME = be.end(); MI != ME; ++MI)
+        ME = be.end(); MI != ME; ++MI)
     for(BBMap::iterator MMI = be.begin(), MME = be.end(); MMI != MME; ++MMI)
       if(DS->properlyDominates(MI->first, MMI->first))
-	toDelete.push_back(MMI->first);
+        toDelete.push_back(MMI->first);
   // Remove all the back-edges we found from be.
   for(std::vector<BasicBlock *>::iterator VI = toDelete.begin(),
-	VE = toDelete.end(); VI != VE; ++VI)
+        VE = toDelete.end(); VI != VE; ++VI)
     be.erase(*VI);
 }
 
@@ -123,7 +123,7 @@
   removeRedundant(be);
 
   for(std::map<BasicBlock *, BasicBlock *>::iterator MI = be.begin(),
-	ME = be.end(); MI != ME; ++MI){
+        ME = be.end(); MI != ME; ++MI){
     BasicBlock *u = MI->first;
     BasicBlock *BB = MI->second;
     // We have a back-edge from BB --> u.


Index: llvm/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp:1.12 llvm/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp:1.13
--- llvm/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp:1.12	Thu Apr 21 18:40:47 2005
+++ llvm/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp	Sat Apr 23 16:38:35 2005
@@ -26,9 +26,9 @@
 //Routines to get the path trace!
 
 void getPathFrmNode(Node *n, vector<BasicBlock*> &vBB, int pathNo, Graph &g,
-		    vector<Edge> &stDummy, vector<Edge> &exDummy,
-		    vector<Edge> &be,
-		    double strand){
+                    vector<Edge> &stDummy, vector<Edge> &exDummy,
+                    vector<Edge> &be,
+                    double strand){
   Graph::nodeList &nlist = g.getNodeList(n);
 
   //printGraph(g);
@@ -48,7 +48,7 @@
       nextRoot=NLI->element;
       edgeRnd=NLI->randId;
       if(isStart)
-	strand=NLI->randId;
+        strand=NLI->randId;
     }
   }
 
@@ -66,43 +66,43 @@
     bool has1=false, has2=false;
     //check if exit has it
     for(vector<Edge>::iterator VI=exDummy.begin(), VE=exDummy.end(); VI!=VE;
-	++VI){
+        ++VI){
       if(VI->getRandId()==edgeRnd){
-	has2=true;
-	break;
+        has2=true;
+        break;
       }
     }
 
     //check if start has it
     for(vector<Edge>::iterator VI=stDummy.begin(), VE=stDummy.end(); VI!=VE;
-	++VI){
+        ++VI){
       if(VI->getRandId()==strand){
-	has1=true;
-	break;
+        has1=true;
+        break;
       }
     }
 
     if(has1){
       //find backedge with endpoint vBB[1]
       for(vector<Edge>::iterator VI=be.begin(), VE=be.end(); VI!=VE; ++VI){
-	assert(vBB.size()>0 && "vector too small");
-	if( VI->getSecond()->getElement() == vBB[1] ){
-	  //vBB[0]=VI->getFirst()->getElement();
+        assert(vBB.size()>0 && "vector too small");
+        if( VI->getSecond()->getElement() == vBB[1] ){
+          //vBB[0]=VI->getFirst()->getElement();
           vBB.erase(vBB.begin());
-	  break;
-	}
+          break;
+        }
       }
     }
 
     if(has2){
       //find backedge with startpoint vBB[vBB.size()-1]
       for(vector<Edge>::iterator VI=be.begin(), VE=be.end(); VI!=VE; ++VI){
-	assert(vBB.size()>0 && "vector too small");
-	if( VI->getFirst()->getElement() == vBB[vBB.size()-1] &&
+        assert(vBB.size()>0 && "vector too small");
+        if( VI->getFirst()->getElement() == vBB[vBB.size()-1] &&
             VI->getSecond()->getElement() == vBB[0]){
-	  //vBB.push_back(VI->getSecond()->getElement());
-	  break;
-	}
+          //vBB.push_back(VI->getSecond()->getElement());
+          break;
+        }
       }
     }
     else
@@ -114,7 +114,7 @@
   assert(pathNo-maxCount>=0);
 
   return getPathFrmNode(nextRoot, vBB, pathNo-maxCount, g, stDummy,
-			exDummy, be, strand);
+                        exDummy, be, strand);
 }
 
 






More information about the llvm-commits mailing list