summaryrefslogtreecommitdiff
path: root/lib/Transforms/Instrumentation
diff options
context:
space:
mode:
authorJeff Cohen <jeffc@jolt-lang.org>2005-04-23 21:38:35 +0000
committerJeff Cohen <jeffc@jolt-lang.org>2005-04-23 21:38:35 +0000
commit9d80930e950214d026afd3a3d18cda32629efdb9 (patch)
tree6141c60a18cd33eb22e06d8297482e92c0303c1a /lib/Transforms/Instrumentation
parentb02fbfc485a68cebeede24810b0cd8f0d97c9e51 (diff)
downloadllvm-9d80930e950214d026afd3a3d18cda32629efdb9.tar.gz
llvm-9d80930e950214d026afd3a3d18cda32629efdb9.tar.bz2
llvm-9d80930e950214d026afd3a3d18cda32629efdb9.tar.xz
Eliminate tabs and trailing spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21480 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation')
-rw-r--r--lib/Transforms/Instrumentation/EmitFunctions.cpp14
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp100
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp18
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp48
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/Graph.h10
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp174
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp18
-rw-r--r--lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp42
-rw-r--r--lib/Transforms/Instrumentation/TraceBasicBlocks.cpp2
-rw-r--r--lib/Transforms/Instrumentation/TraceValues.cpp2
10 files changed, 214 insertions, 214 deletions
diff --git a/lib/Transforms/Instrumentation/EmitFunctions.cpp b/lib/Transforms/Instrumentation/EmitFunctions.cpp
index 369a784a4e..a49129399d 100644
--- a/lib/Transforms/Instrumentation/EmitFunctions.cpp
+++ b/lib/Transforms/Instrumentation/EmitFunctions.cpp
@@ -53,7 +53,7 @@ static char doDFS(BasicBlock * node,std::map<BasicBlock *, Color > &color){
if(color[BB]!=GREY && color[BB]!=BLACK){
if(!doDFS(BB, color)){
- return 0;
+ return 0;
}
}
@@ -101,19 +101,19 @@ bool EmitFunctionTable::runOnModule(Module &M){
M.getGlobalList().push_back(gb);
Constant *constArray = ConstantArray::get(ArrayType::get(Type::SByteTy,
- sBCons.size()),
- sBCons);
+ sBCons.size()),
+ sBCons);
GlobalVariable *funcArray = new GlobalVariable(constArray->getType(), true,
- GlobalValue::ExternalLinkage,
- constArray, "llvmSimpleFunction");
+ GlobalValue::ExternalLinkage,
+ constArray, "llvmSimpleFunction");
M.getGlobalList().push_back(funcArray);
ConstantInt *cnst = ConstantSInt::get(Type::IntTy, counter);
GlobalVariable *fnCount = new GlobalVariable(Type::IntTy, true,
- GlobalValue::ExternalLinkage,
- cnst, "llvmFunctionCount");
+ GlobalValue::ExternalLinkage,
+ cnst, "llvmFunctionCount");
M.getGlobalList().push_back(fnCount);
return true; // Always modifies program
}
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp b/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp
index e592d28653..5e4264ebfd 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp
@@ -30,10 +30,10 @@ namespace {
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 @@ void CombineBranches::getBackEdgesVisit(BasicBlock *u,
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 @@ void CombineBranches::getBackEdgesVisit(BasicBlock *u,
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 @@ void CombineBranches::removeRedundant(std::map<BasicBlock *, BasicBlock *> &be){
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 @@ void CombineBranches::removeRedundant(std::map<BasicBlock *, BasicBlock *> &be){
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 @@ void CombineBranches::removeRedundant(std::map<BasicBlock *, BasicBlock *> &be){
std::map<PHINode *, std::vector<unsigned int> > phiMap;
for(std::vector<BasicBlock *>::iterator VBI = sameTarget.begin(),
- 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);
- }
- }
+ 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);
+ }
+ }
}
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->first->addIncoming(phiNode, newBB);
+ 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->first->addIncoming(phiNode, newBB);
}
}
}
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp
index aef4681f30..95822df002 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/EdgeCode.cpp
@@ -59,7 +59,7 @@ static void getTriggerCode(Module *M, BasicBlock *BB, int MethNo, Value *pathNo,
//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 @@ void getEdgeCode::getCode(Instruction *rInst, Value *countInst,
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 @@ void getEdgeCode::getCode(Instruction *rInst, Value *countInst,
//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 @@ void getEdgeCode::getCode(Instruction *rInst, Value *countInst,
//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 @@ void insertInTopBB(BasicBlock *front,
//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();
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp b/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp
index 21883c41b0..c8b1a0dfce 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/Graph.cpp
@@ -22,7 +22,7 @@ using std::vector;
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 @@ graphListElement *findNodeInList(Graph::nodeList &NL, Node *N) {
//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 @@ int Graph::getNumberOfIncomingEdges(Node *nd){
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 @@ Graph* Graph::getMaxSpanningTree(){
//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 @@ Graph* Graph::getMaxSpanningTree(){
//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 @@ Graph* Graph::getMaxSpanningTree(){
//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 @@ void Graph::printGraph(){
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 @@ 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)){
- DEBUG(std::cerr<<"######doesn't hv\n";
+ DEBUG(std::cerr<<"######doesn't hv\n";
printEdge(ed));
- addEdgeForce(ed);
+ addEdgeForce(ed);
}
}
}
@@ -511,7 +511,7 @@ void Graph::reverseWts(){
++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 @@ void Graph::getBackEdges(vector<Edge > &be, std::map<Node *, int> &d){
//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 @@ void Graph::getBackEdgesVisit(Node *u, vector<Edge > &be,
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 @@ void Graph::getBackEdgesVisit(Node *u, vector<Edge > &be,
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
}
}
}
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/Graph.h b/lib/Transforms/Instrumentation/ProfilePaths/Graph.h
index 203948454c..9782ab4917 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/Graph.h
+++ b/lib/Transforms/Instrumentation/ProfilePaths/Graph.h
@@ -233,10 +233,10 @@ private:
//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 @@ public:
//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);
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp b/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp
index bd7bf4fe9e..4ca1c5b92f 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/GraphAuxiliary.cpp
@@ -40,10 +40,10 @@ static void getChords(vector<Edge > &chords, Graph &g, Graph st){
++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 @@ static void removeTreeEdges(Graph &g, Graph& t){
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 valueAssignmentToEdges(Graph& g, map<Node *, int> nodePriority,
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 @@ int valueAssignmentToEdges(Graph& g, map<Node *, int> nodePriority,
}
}
- 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 @@ static int inc_Dir(Edge e, Edge f){
//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 @@ static int inc_Dir(Edge e, Edge f){
//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 @@ static void inc_DFS(Graph& g,Graph& t,map<Edge, int, EdgeCompare2>& Increment,
++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 @@ static void inc_DFS(Graph& g,Graph& t,map<Edge, int, EdgeCompare2>& Increment,
++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 @@ static void inc_DFS(Graph& g,Graph& t,map<Edge, int, EdgeCompare2>& Increment,
++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 @@ static map<Edge, int, EdgeCompare2> getEdgeIncrements(Graph& g, Graph& t,
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 @@ static map<Edge, int, EdgeCompare2> getEdgeIncrements(Graph& g, Graph& t,
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 @@ static map<Edge, int, EdgeCompare2> getEdgeIncrements(Graph& g, Graph& t,
//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 @@ static void getCodeInsertions(Graph &g, map<Edge, getEdgeCode *, EdgeCompare2> &
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 @@ static void getCodeInsertions(Graph &g, map<Edge, getEdgeCode *, EdgeCompare2> &
//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 @@ static void getCodeInsertions(Graph &g, map<Edge, getEdgeCode *, EdgeCompare2> &
//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 addDummyEdges(vector<Edge > &stDummy,
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 @@ static void moveDummyCode(vector<Edge> &stDummy,
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 @@ static void moveDummyCode(vector<Edge> &stDummy,
//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 @@ static void moveDummyCode(vector<Edge> &stDummy,
//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 @@ void processGraph(Graph &g,
//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 @@ void processGraph(Graph &g,
//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 @@ void processGraph(Graph &g,
//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 @@ void printGraph(Graph &g){
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";
}
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp b/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
index fc828977f6..860b57f7e4 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/InstLoops.cpp
@@ -45,9 +45,9 @@ namespace {
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 @@ void InstLoops::getBackEdgesVisit(BasicBlock *u,
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::getBackEdgesVisit(BasicBlock *u,
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 @@ void InstLoops::findAndInstrumentBackEdges(Function &F){
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.
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp b/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp
index c92094015d..8c343df8f6 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/RetracePath.cpp
@@ -26,9 +26,9 @@ namespace llvm {
//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 @@ void getPathFrmNode(Node *n, vector<BasicBlock*> &vBB, int pathNo, Graph &g,
nextRoot=NLI->element;
edgeRnd=NLI->randId;
if(isStart)
- strand=NLI->randId;
+ strand=NLI->randId;
}
}
@@ -66,43 +66,43 @@ void getPathFrmNode(Node *n, vector<BasicBlock*> &vBB, int pathNo, Graph &g,
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 @@ void getPathFrmNode(Node *n, vector<BasicBlock*> &vBB, int pathNo, Graph &g,
assert(pathNo-maxCount>=0);
return getPathFrmNode(nextRoot, vBB, pathNo-maxCount, g, stDummy,
- exDummy, be, strand);
+ exDummy, be, strand);
}
diff --git a/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp b/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp
index ae8a8bdb73..9018ee6c2b 100644
--- a/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp
+++ b/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp
@@ -36,7 +36,7 @@ namespace {
ModulePass *llvm::createTraceBasicBlockPass()
{
- return new TraceBasicBlocks();
+ return new TraceBasicBlocks();
}
static void InsertInstrumentationCall (BasicBlock *BB,
diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp
index 586c923077..9838ea101a 100644
--- a/lib/Transforms/Instrumentation/TraceValues.cpp
+++ b/lib/Transforms/Instrumentation/TraceValues.cpp
@@ -33,7 +33,7 @@ DisablePtrHashing("tracedisablehashdisable", cl::Hidden,
static cl::list<std::string>
TraceFuncNames("tracefunc", cl::desc("Only trace specific functions in the "
"-trace or -tracem passes"),
- cl::value_desc("function"), cl::Hidden);
+ cl::value_desc("function"), cl::Hidden);
static void TraceValuesAtBBExit(BasicBlock *BB,
Function *Printf, Function* HashPtrToSeqNum,