[llvm-commits] CVS: llvm/lib/Target/TargetSchedInfo.cpp

Tanya Brethour tbrethou at cs.uiuc.edu
Sat May 8 11:13:04 PDT 2004


Changes in directory llvm/lib/Target:

TargetSchedInfo.cpp updated: 1.16 -> 1.17

---
Log message:

Changed CPUResource to allow access to maxnum users.


---
Diffs of the changes:  (+16 -6)

Index: llvm/lib/Target/TargetSchedInfo.cpp
diff -u llvm/lib/Target/TargetSchedInfo.cpp:1.16 llvm/lib/Target/TargetSchedInfo.cpp:1.17
--- llvm/lib/Target/TargetSchedInfo.cpp:1.16	Sat May  1 06:17:13 2004
+++ llvm/lib/Target/TargetSchedInfo.cpp	Sat May  8 11:12:50 2004
@@ -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 @@
       assert(r >= 0 && "Resource to remove was unused in cycle c!");
     }
 }
-
-} // End llvm namespace





More information about the llvm-commits mailing list