summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp
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
commit82639853c07c0119fdf38bed29fc4db55f893d5f (patch)
tree7e42f4bec2b385bce91d30a93055fece1256f074 /llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp
parent8047f13a888189189f1efde5509462b80a967bd1 (diff)
downloadbcm5719-llvm-82639853c07c0119fdf38bed29fc4db55f893d5f.tar.gz
bcm5719-llvm-82639853c07c0119fdf38bed29fc4db55f893d5f.zip
Eliminate tabs and trailing spaces
llvm-svn: 21480
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp100
1 files changed, 50 insertions, 50 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp b/llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp
index e592d286533..5e4264ebfd5 100644
--- a/llvm/lib/Transforms/Instrumentation/ProfilePaths/CombineBranch.cpp
+++ b/llvm/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);
}
}
}
OpenPOWER on IntegriCloud