mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Add the SubRegIndex TableGen class.
This is the beginning of purely symbolic subregister indices, but we need a bit of jiggling before the explicit numeric indices can be completely removed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104492 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -35,14 +35,31 @@ void RegisterInfoEmitter::runEnums(raw_ostream &OS) {
|
||||
|
||||
if (!Namespace.empty())
|
||||
OS << "namespace " << Namespace << " {\n";
|
||||
OS << " enum {\n NoRegister,\n";
|
||||
OS << "enum {\n NoRegister,\n";
|
||||
|
||||
for (unsigned i = 0, e = Registers.size(); i != e; ++i)
|
||||
OS << " " << Registers[i].getName() << ", \t// " << i+1 << "\n";
|
||||
OS << " NUM_TARGET_REGS \t// " << Registers.size()+1 << "\n";
|
||||
OS << " };\n";
|
||||
OS << " " << Registers[i].getName() << ", \t// " << i+1 << "\n";
|
||||
OS << " NUM_TARGET_REGS \t// " << Registers.size()+1 << "\n";
|
||||
OS << "};\n";
|
||||
if (!Namespace.empty())
|
||||
OS << "}\n";
|
||||
|
||||
const std::vector<Record*> SubRegIndices =
|
||||
Records.getAllDerivedDefinitions("SubRegIndex");
|
||||
if (!SubRegIndices.empty()) {
|
||||
OS << "\n// Subregister indices\n";
|
||||
Namespace = SubRegIndices[0]->getValueAsString("Namespace");
|
||||
if (!Namespace.empty())
|
||||
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 << " NUM_TARGET_SUBREGS = " << SubRegIndices.size()+1 << "\n";
|
||||
OS << "};\n";
|
||||
if (!Namespace.empty())
|
||||
OS << "}\n";
|
||||
}
|
||||
OS << "} // End llvm namespace \n";
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user