aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/TargetSchedInfo.cpp
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
commit6b160503b502317316b688b80cde6c2fb6d71484 (patch)
treeaade1f397c28cb83fd37acd6d36a64efd3070aea /lib/Target/TargetSchedInfo.cpp
parent73e3e2e10f6a83f72651bb9e7d0a6ad107676ab9 (diff)
downloadexternal_llvm-6b160503b502317316b688b80cde6c2fb6d71484.zip
external_llvm-6b160503b502317316b688b80cde6c2fb6d71484.tar.gz
external_llvm-6b160503b502317316b688b80cde6c2fb6d71484.tar.bz2
Changed CPUResource to allow access to maxnum users.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13425 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetSchedInfo.cpp')
-rw-r--r--lib/Target/TargetSchedInfo.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/Target/TargetSchedInfo.cpp b/lib/Target/TargetSchedInfo.cpp
index 1f5a57d..29b74d8 100644
--- a/lib/Target/TargetSchedInfo.cpp
+++ b/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