aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2004-11-28 23:36:15 +0000
committerTanya Lattner <tonic@nondot.org>2004-11-28 23:36:15 +0000
commit28e5eabf65a7d5afddddbf5e90b0ed8c85140cd6 (patch)
treec2b31ebbc6217e9e441ab0f1cfbc46d980a79306 /lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp
parentb2e4cd645a3392501d41ad55c0d7753e75efe9ac (diff)
Fixed bug where instructions in the kernel were not ordered right to preserve dependencies in a cycle.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp')
-rw-r--r--lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp b/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp
index 7ee77510f0..29aba158c3 100644
--- a/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp
+++ b/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp
@@ -27,7 +27,8 @@ bool MSSchedule::insert(MSchedGraphNode *node, int cycle) {
if (schedule[cycle].size() < numIssue) {
//Now check if all the resources in their respective cycles are available
if(resourcesFree(node, cycle)) {
- schedule[cycle].push_back(node);
+ //Insert to preserve dependencies
+ addToSchedule(cycle,node);
DEBUG(std::cerr << "Found spot in map, and there is an issue slot\n");
return false;
}
@@ -49,6 +50,24 @@ bool MSSchedule::insert(MSchedGraphNode *node, int cycle) {
}
+void MSSchedule::addToSchedule(int cycle, MSchedGraphNode *node) {
+ std::vector<MSchedGraphNode*> nodesAtCycle = schedule[cycle];
+
+ std::map<unsigned, MSchedGraphNode*> indexMap;
+ for(unsigned i=0; i < nodesAtCycle.size(); ++i) {
+ indexMap[nodesAtCycle[i]->getIndex()] = nodesAtCycle[i];
+ }
+
+ indexMap[node->getIndex()] = node;
+
+ std::vector<MSchedGraphNode*> nodes;
+ for(std::map<unsigned, MSchedGraphNode*>::iterator I = indexMap.begin(), E = indexMap.end(); I != E; ++I)
+ nodes.push_back(I->second);
+
+ schedule[cycle] = nodes;
+}
+
+
bool MSSchedule::resourcesFree(MSchedGraphNode *node, int cycle) {
//Get Resource usage for this instruction