diff options
author | Tanya Lattner <tonic@nondot.org> | 2004-11-24 01:49:10 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2004-11-24 01:49:10 +0000 |
commit | a6ec8f5548d5f60a93a436fc3e5bdd20bdc047cf (patch) | |
tree | 15397aa0dc4214ec5bfd1a294ce45a6c0c551a29 /lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp | |
parent | 8599d385a2f1fbafaaead903ea5be5a9b33a6509 (diff) |
Forced branches to be first to be scheduled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18195 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp')
-rw-r--r-- | lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp | 69 |
1 files changed, 51 insertions, 18 deletions
diff --git a/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp b/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp index eb73a3b093..e39a9fbb28 100644 --- a/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp +++ b/lib/Target/SparcV9/ModuloScheduling/ModuloScheduling.cpp @@ -748,7 +748,11 @@ void ModuloSchedulingPass::findAllReccurrences(MSchedGraphNode *node, void ModuloSchedulingPass::computePartialOrder() { - + + //Only push BA branches onto the final node order, we put other branches after it + //FIXME: Should we really be pushing branches on it a specific order instead of relying + //on BA being there? + std::vector<MSchedGraphNode*> otherBranch; //Loop over all recurrences and add to our partial order //be sure to remove nodes that are already in the partial order in @@ -772,8 +776,15 @@ void ModuloSchedulingPass::computePartialOrder() { found = true; } if(!found) { - new_recurrence.insert(*N); - + if((*N)->isBranch()) { + if((*N)->getInst()->getOpcode() == V9::BA) + FinalNodeOrder.push_back(*N); + else + otherBranch.push_back(*N); + } + else + new_recurrence.insert(*N); + } if(partialOrder.size() == 0) //For each predecessors, add it to this recurrence ONLY if it is not already in it for(MSchedGraphNode::pred_iterator P = (*N)->pred_begin(), @@ -791,15 +802,21 @@ void ModuloSchedulingPass::computePartialOrder() { } if(!predFound) - if(!new_recurrence.count(*P)) - new_recurrence.insert(*P); - + if(!new_recurrence.count(*P)) { + if((*P)->isBranch()) { + if((*P)->getInst()->getOpcode() == V9::BA) + FinalNodeOrder.push_back(*P); + else + otherBranch.push_back(*P); + } + else + new_recurrence.insert(*P); + + } } } - } } - - + if(new_recurrence.size() > 0) partialOrder.push_back(new_recurrence); } @@ -814,8 +831,17 @@ void ModuloSchedulingPass::computePartialOrder() { if(PO->count(I->first)) found = true; } - if(!found) - lastNodes.insert(I->first); + if(!found) { + if(I->first->isBranch()) { + if(std::find(FinalNodeOrder.begin(), FinalNodeOrder.end(), I->first) == FinalNodeOrder.end()) + if((I->first)->getInst()->getOpcode() == V9::BA) + FinalNodeOrder.push_back(I->first); + else + otherBranch.push_back(I->first); + } + else + lastNodes.insert(I->first); + } } //Break up remaining nodes that are not in the partial order @@ -829,15 +855,22 @@ void ModuloSchedulingPass::computePartialOrder() { //if(lastNodes.size() > 0) //partialOrder.push_back(lastNodes); + //Clean up branches by putting them in final order + for(std::vector<MSchedGraphNode*>::iterator I = otherBranch.begin(), E = otherBranch.end(); I != E; ++I) + FinalNodeOrder.push_back(*I); + } void ModuloSchedulingPass::connectedComponentSet(MSchedGraphNode *node, std::set<MSchedGraphNode*> &ccSet, std::set<MSchedGraphNode*> &lastNodes) { - //Add to final set - if( !ccSet.count(node) && lastNodes.count(node)) { +//Add to final set +if( !ccSet.count(node) && lastNodes.count(node)) { lastNodes.erase(node); - ccSet.insert(node); +if(node->isBranch()) + FinalNodeOrder.push_back(node); + else + ccSet.insert(node); } else return; @@ -904,7 +937,7 @@ void ModuloSchedulingPass::orderNodes() { //Set default order int order = BOTTOM_UP; - + //Loop over all the sets and place them in the final node order for(std::vector<std::set<MSchedGraphNode*> >::iterator CurrentSet = partialOrder.begin(), E= partialOrder.end(); CurrentSet != E; ++CurrentSet) { @@ -1120,7 +1153,7 @@ void ModuloSchedulingPass::computeSchedule() { int capII = 30; while(!success) { - + //Loop over the final node order and process each node for(std::vector<MSchedGraphNode*>::iterator I = FinalNodeOrder.begin(), E = FinalNodeOrder.end(); I != E; ++I) { @@ -1170,8 +1203,8 @@ void ModuloSchedulingPass::computeSchedule() { LateStart = II-1; } else { - EarlyStart = II-1; - LateStart = II-1; + EarlyStart = II-2; + LateStart = 0; assert( (EarlyStart >= 0) && (LateStart >=0) && "EarlyStart and LateStart must be greater then 0"); } hasPred = 1; |