summaryrefslogtreecommitdiff
path: root/utils/TableGen
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-05-25 17:21:04 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-05-25 17:21:04 +0000
commit48d0c163fb60f7da7ef3657df242bf11dbdb0617 (patch)
tree359d7fa330d379d973b2d6cd207109d374d6af12 /utils/TableGen
parentc159fba712292f9a3de4f6841dbd6a3f3cefb2d2 (diff)
downloadllvm-48d0c163fb60f7da7ef3657df242bf11dbdb0617.tar.gz
llvm-48d0c163fb60f7da7ef3657df242bf11dbdb0617.tar.bz2
llvm-48d0c163fb60f7da7ef3657df242bf11dbdb0617.tar.xz
Ignore NumberHack and give each SubRegIndex instance a unique enum value instead.
This passes lit tests, but I'll give it a go through the buildbots to smoke out any remaining places that depend on the old SubRegIndex numbering. Then I'll remove NumberHack entirely. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104615 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r--utils/TableGen/CodeGenTarget.h6
-rw-r--r--utils/TableGen/RegisterInfoEmitter.cpp3
2 files changed, 6 insertions, 3 deletions
diff --git a/utils/TableGen/CodeGenTarget.h b/utils/TableGen/CodeGenTarget.h
index 5b2587f3b7..6b06b66c29 100644
--- a/utils/TableGen/CodeGenTarget.h
+++ b/utils/TableGen/CodeGenTarget.h
@@ -107,7 +107,11 @@ public:
// Map a SubRegIndex Record to its number.
unsigned getSubRegIndexNo(Record *idx) const {
- return idx->getValueAsInt("NumberHack");
+ if (SubRegIndices.empty()) ReadSubRegIndices();
+ std::vector<Record*>::const_iterator i =
+ std::find(SubRegIndices.begin(), SubRegIndices.end(), idx);
+ assert(i != SubRegIndices.end() && "Not a SubRegIndex");
+ return (i - SubRegIndices.begin()) + 1;
}
const std::vector<CodeGenRegisterClass> &getRegisterClasses() const {
diff --git a/utils/TableGen/RegisterInfoEmitter.cpp b/utils/TableGen/RegisterInfoEmitter.cpp
index 85daa15f37..28429faefa 100644
--- a/utils/TableGen/RegisterInfoEmitter.cpp
+++ b/utils/TableGen/RegisterInfoEmitter.cpp
@@ -52,8 +52,7 @@ void RegisterInfoEmitter::runEnums(raw_ostream &OS) {
OS << "namespace " << Namespace << " {\n";
OS << "enum {\n NoSubRegister,\n";
for (unsigned i = 0, e = SubRegIndices.size(); i != e; ++i)
- OS << " " << SubRegIndices[i]->getName() << " = "
- << SubRegIndices[i]->getValueAsInt("NumberHack") << ",\n";
+ OS << " " << SubRegIndices[i]->getName() << ",\t// " << i+1 << "\n";
OS << " NUM_TARGET_SUBREGS = " << SubRegIndices.size()+1 << "\n";
OS << "};\n";
if (!Namespace.empty())