mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-03 13:31:05 +00:00
Make the register enum value part of the CodeGenRegister struct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127448 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
510207cb1e
commit
17fad045cc
@ -30,6 +30,7 @@ namespace llvm {
|
||||
Record *TheDef;
|
||||
const std::string &getName() const;
|
||||
unsigned DeclaredSpillSize, DeclaredSpillAlignment;
|
||||
unsigned EnumValue;
|
||||
CodeGenRegister(Record *R);
|
||||
};
|
||||
|
||||
|
@ -164,6 +164,9 @@ void CodeGenTarget::ReadRegisters() const {
|
||||
|
||||
Registers.reserve(Regs.size());
|
||||
Registers.assign(Regs.begin(), Regs.end());
|
||||
// Assign the enumeration values.
|
||||
for (unsigned i = 0, e = Registers.size(); i != e; ++i)
|
||||
Registers[i].EnumValue = i + 1;
|
||||
}
|
||||
|
||||
CodeGenRegister::CodeGenRegister(Record *R) : TheDef(R) {
|
||||
|
@ -38,7 +38,10 @@ void RegisterInfoEmitter::runEnums(raw_ostream &OS) {
|
||||
OS << "enum {\n NoRegister,\n";
|
||||
|
||||
for (unsigned i = 0, e = Registers.size(); i != e; ++i)
|
||||
OS << " " << Registers[i].getName() << ", \t// " << i+1 << "\n";
|
||||
OS << " " << Registers[i].getName() << " = " <<
|
||||
Registers[i].EnumValue << ",\n";
|
||||
assert(Registers.size() == Registers[Registers.size()-1].EnumValue &&
|
||||
"Register enum value mismatch!");
|
||||
OS << " NUM_TARGET_REGS \t// " << Registers.size()+1 << "\n";
|
||||
OS << "};\n";
|
||||
if (!Namespace.empty())
|
||||
|
Loading…
Reference in New Issue
Block a user