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
This commit is contained in:
Jakob Stoklund Olesen 2010-05-25 17:21:04 +00:00
parent c159fba712
commit 48d0c163fb
3 changed files with 9 additions and 6 deletions

View File

@ -158,7 +158,7 @@ X86RegisterInfo::getMatchingSuperRegClass(const TargetRegisterClass *A,
switch (SubIdx) {
default: return 0;
case X86::sub_8bit:
//case X86::sub_ss:
case X86::sub_ss:
if (B == &X86::GR8RegClass) {
if (A->getSize() == 2 || A->getSize() == 4 || A->getSize() == 8)
return A;
@ -195,7 +195,7 @@ X86RegisterInfo::getMatchingSuperRegClass(const TargetRegisterClass *A,
}
break;
case X86::sub_8bit_hi:
//case X86::sub_sd:
case X86::sub_sd:
if (B == &X86::GR8_ABCD_HRegClass) {
if (A == &X86::GR64RegClass || A == &X86::GR64_ABCDRegClass ||
A == &X86::GR64_NOREXRegClass ||
@ -213,7 +213,7 @@ X86RegisterInfo::getMatchingSuperRegClass(const TargetRegisterClass *A,
}
break;
case X86::sub_16bit:
//case X86::sub_xmm:
case X86::sub_xmm:
if (B == &X86::GR16RegClass) {
if (A->getSize() == 4 || A->getSize() == 8)
return A;

View File

@ -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 {

View File

@ -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())