aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2004-11-22 20:41:24 +0000
committerTanya Lattner <tonic@nondot.org>2004-11-22 20:41:24 +0000
commite1df212fb3eb651a85ee1e0f493a9f27033901cb (patch)
tree9b82ba9a96fcc94797f41b234fa29c48f3709cff /lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp
parent54a4d6a3cd25f94d1dd2e2908ad6be2c153fbcc4 (diff)
Fixed a bug where I was trying to ModuloSchedule a loop with no instructions but a terminator.
Fixed a bug in the schedule generation that was always using the start cycle. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18123 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp')
-rw-r--r--lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp b/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp
index 02cd8b7841..25bd55f314 100644
--- a/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp
+++ b/lib/Target/SparcV9/ModuloScheduling/MSSchedule.cpp
@@ -54,6 +54,9 @@ bool MSSchedule::resourcesFree(MSchedGraphNode *node, int cycle) {
int currentCycle = cycle;
bool success = true;
+ //map for easy backtracking, resource num at a certain cycle
+ //std::map<int, int> backtrackMap;
+
//Get resource usage for this instruction
InstrRUsage rUsage = msi->getInstrRUsage(node->getInst()->getOpcode());
std::vector<std::vector<resourceId_t> > resources = rUsage.resourcesByCycle;
@@ -74,8 +77,11 @@ bool MSSchedule::resourcesFree(MSchedGraphNode *node, int cycle) {
std::map<int, int>::iterator resourceUse = resourcesForCycle->second.find(resourceNum);
if(resourceUse != resourcesForCycle->second.end()) {
//Check if there are enough of this resource and if so, increase count and move on
- if(resourceUse->second < CPUResource::getCPUResource(resourceNum)->maxNumUsers)
+ if(resourceUse->second < CPUResource::getCPUResource(resourceNum)->maxNumUsers) {
++resourceUse->second;
+ //Document that we increased the usage count for this resource at this cycle
+
+ }
else {
success = false;
}
@@ -89,7 +95,8 @@ bool MSSchedule::resourcesFree(MSchedGraphNode *node, int cycle) {
//Create a new map and put in our resource
std::map<int, int> resourceMap;
resourceMap[resourceNum] = 1;
- resourceNumPerCycle[cycle] = resourceMap;
+ resourceNumPerCycle[currentCycle] = resourceMap;
+
}
if(!success)
break;