summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2004-05-08 16:12:50 +0000
committerTanya Lattner <tonic@nondot.org>2004-05-08 16:12:50 +0000
commit39bd20d6ebf11e59428074c75873549027a64ae3 (patch)
treed087eeb77249b3a4292de21e3dd0ea1ebb0b0012 /llvm/lib
parenta6820d6704cb817717ccfde3168cafd2af960bb5 (diff)
downloadbcm5719-llvm-39bd20d6ebf11e59428074c75873549027a64ae3.tar.gz
bcm5719-llvm-39bd20d6ebf11e59428074c75873549027a64ae3.zip
Changed CPUResource to allow access to maxnum users.
llvm-svn: 13425
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/TargetSchedInfo.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/llvm/lib/Target/TargetSchedInfo.cpp b/llvm/lib/Target/TargetSchedInfo.cpp
index 1f5a57d10ca..29b74d84f93 100644
--- a/llvm/lib/Target/TargetSchedInfo.cpp
+++ b/llvm/lib/Target/TargetSchedInfo.cpp
@@ -14,13 +14,25 @@
#include "llvm/Target/TargetSchedInfo.h"
#include "llvm/Target/TargetMachine.h"
+#include <iostream>
+using namespace llvm;
-namespace llvm {
+resourceId_t llvm::CPUResource::nextId = 0;
+static std::vector<CPUResource*> *CPUResourceMap = 0;
+
+CPUResource::CPUResource(const std::string& resourceName, int maxUsers)
+ : rname(resourceName), rid(nextId++), maxNumUsers(maxUsers) {
+ if(!CPUResourceMap)
+ CPUResourceMap = new std::vector<CPUResource*>;
-resourceId_t CPUResource::nextId = 0;
+ //Put Resource in the map
+ CPUResourceMap->push_back(this);
+}
-CPUResource::CPUResource(const std::string& resourceName, int maxUsers)
- : rname(resourceName), rid(nextId++), maxNumUsers(maxUsers) {}
+///Get CPUResource if you only have the resource ID
+CPUResource* CPUResource::getCPUResource(resourceId_t id) {
+ return (*CPUResourceMap)[id];
+}
// Check if fromRVec and toRVec have *any* common entries.
// Assume the vectors are sorted in increasing order.
@@ -254,5 +266,3 @@ void InstrRUsage::addUsageDelta(const InstrRUsageDelta &delta) {
assert(r >= 0 && "Resource to remove was unused in cycle c!");
}
}
-
-} // End llvm namespace
OpenPOWER on IntegriCloud