diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-06-26 20:59:16 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-06-26 20:59:16 +0000 |
commit | c4f2fe06946b9037ce82eca309d9f2c631050cee (patch) | |
tree | 0d0a1c97a7f780dc0b900626ae0a37304d3a5ed0 /utils/TableGen | |
parent | e2446c607611ce868857d9b853aa8703bf0da4b8 (diff) | |
download | external_llvm-c4f2fe06946b9037ce82eca309d9f2c631050cee.zip external_llvm-c4f2fe06946b9037ce82eca309d9f2c631050cee.tar.gz external_llvm-c4f2fe06946b9037ce82eca309d9f2c631050cee.tar.bz2 |
Add immediate sub-registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37738 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r-- | utils/TableGen/RegisterInfoEmitter.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/utils/TableGen/RegisterInfoEmitter.cpp b/utils/TableGen/RegisterInfoEmitter.cpp index a2269a8..9a1ef85 100644 --- a/utils/TableGen/RegisterInfoEmitter.cpp +++ b/utils/TableGen/RegisterInfoEmitter.cpp @@ -359,6 +359,7 @@ void RegisterInfoEmitter::run(std::ostream &OS) { OS << " };\n"; // Emit register sub-registers / super-registers, aliases... + std::map<Record*, std::set<Record*> > RegisterImmSubRegs; std::map<Record*, std::set<Record*> > RegisterSubRegs; std::map<Record*, std::set<Record*> > RegisterSuperRegs; std::map<Record*, std::set<Record*> > RegisterAliases; @@ -397,6 +398,7 @@ void RegisterInfoEmitter::run(std::ostream &OS) { cerr << "Warning: register " << getQualifiedName(SubReg) << " specified as a sub-register of " << getQualifiedName(R) << " multiple times!\n"; + RegisterImmSubRegs[R].insert(SubReg); addSubSuperReg(R, SubReg, RegisterSubRegs, RegisterSuperRegs, RegisterAliases, *this); } @@ -434,6 +436,21 @@ void RegisterInfoEmitter::run(std::ostream &OS) { OS << "0 };\n"; } + if (!RegisterImmSubRegs.empty()) + OS << "\n\n // Register Immediate Sub-registers Sets...\n"; + + // Loop over all of the registers which have sub-registers, emitting the + // sub-registers list to memory. + for (std::map<Record*, std::set<Record*> >::iterator + I = RegisterImmSubRegs.begin(), E = RegisterImmSubRegs.end(); + I != E; ++I) { + OS << " const unsigned " << I->first->getName() << "_ImmSubRegsSet[] = { "; + for (std::set<Record*>::iterator ASI = I->second.begin(), + E = I->second.end(); ASI != E; ++ASI) + OS << getQualifiedName(*ASI) << ", "; + OS << "0 };\n"; + } + if (!RegisterSuperRegs.empty()) OS << "\n\n // Register Super-registers Sets...\n"; @@ -472,6 +489,10 @@ void RegisterInfoEmitter::run(std::ostream &OS) { OS << Reg.getName() << "_SubRegsSet,\t"; else OS << "Empty_SubRegsSet,\t"; + if (RegisterImmSubRegs.count(Reg.TheDef)) + OS << Reg.getName() << "_ImmSubRegsSet,\t"; + else + OS << "Empty_SubRegsSet,\t"; if (RegisterSuperRegs.count(Reg.TheDef)) OS << Reg.getName() << "_SuperRegsSet },\n"; else |