summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-09-17 22:18:43 +0000
committerAndrew Trick <atrick@apple.com>2012-09-17 22:18:43 +0000
commitbc4ff6e3cf129294d10c2366cb157796964c903e (patch)
tree3bf59a9cbd268ec5944ad078b024b78ec98d23f1 /utils
parentb024b7014ad13d076cfc3eb2d63c49681ad1bdd0 (diff)
downloadllvm-bc4ff6e3cf129294d10c2366cb157796964c903e.tar.gz
llvm-bc4ff6e3cf129294d10c2366cb157796964c903e.tar.bz2
llvm-bc4ff6e3cf129294d10c2366cb157796964c903e.tar.xz
TableGen subtarget parser: Add getProcResourcesIdx().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164057 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/CodeGenSchedule.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/TableGen/CodeGenSchedule.cpp b/utils/TableGen/CodeGenSchedule.cpp
index 3c6298da93..0babda3c4f 100644
--- a/utils/TableGen/CodeGenSchedule.cpp
+++ b/utils/TableGen/CodeGenSchedule.cpp
@@ -1274,6 +1274,16 @@ void CodeGenSchedModels::addReadAdvance(Record *ProcReadAdvanceDef,
RADefs.push_back(ProcReadAdvanceDef);
}
+unsigned CodeGenProcModel::getProcResourceIdx(Record *PRDef) const {
+ RecIter PRPos = std::find(ProcResourceDefs.begin(), ProcResourceDefs.end(),
+ PRDef);
+ if (PRPos == ProcResourceDefs.end())
+ throw TGError(PRDef->getLoc(), "ProcResource def is not included in "
+ "the ProcResources list for " + ModelName);
+ // Idx=0 is reserved for invalid.
+ return 1 + PRPos - ProcResourceDefs.begin();
+}
+
#ifndef NDEBUG
void CodeGenProcModel::dump() const {
dbgs() << Index << ": " << ModelName << " "