mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-25 14:32:53 +00:00
Support "Methods" in register classes in CodgeGenRegisterClass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15965 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
12585baf1a
commit
5767775505
@ -26,7 +26,6 @@ namespace llvm {
|
||||
Record *TheDef;
|
||||
const std::string &getName() const;
|
||||
unsigned DeclaredSpillSize, DeclaredSpillAlignment;
|
||||
|
||||
CodeGenRegister(Record *R);
|
||||
};
|
||||
|
||||
@ -36,6 +35,7 @@ namespace llvm {
|
||||
std::vector<Record*> Elements;
|
||||
unsigned SpillSize;
|
||||
unsigned SpillAlignment;
|
||||
std::string MethodDefinitions;
|
||||
|
||||
const std::string &getName() const;
|
||||
|
||||
|
@ -135,6 +135,12 @@ CodeGenRegisterClass::CodeGenRegisterClass(Record *R) : TheDef(R) {
|
||||
SpillSize = R->getValueAsInt("Size");
|
||||
SpillAlignment = R->getValueAsInt("Alignment");
|
||||
|
||||
if (CodeInit *CI = dynamic_cast<CodeInit*>(R->getValueInit("Methods")))
|
||||
MethodDefinitions = CI->getValue();
|
||||
else
|
||||
throw "Expected 'code' fragment for 'Methods' value in register class '"+
|
||||
getName() + "'!";
|
||||
|
||||
ListInit *RegList = R->getValueAsListInit("MemberList");
|
||||
for (unsigned i = 0, e = RegList->getSize(); i != e; ++i) {
|
||||
DefInit *RegDef = dynamic_cast<DefInit*>(RegList->getElement(i));
|
||||
|
@ -121,16 +121,9 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
OS << " struct " << Name << "Class : public TargetRegisterClass {\n"
|
||||
<< " " << Name << "Class() : TargetRegisterClass("
|
||||
<< RC.SpillSize/8 << ", " << RC.SpillAlignment << ", " << Name << ", "
|
||||
<< Name << " + " << RC.Elements.size() << ") {}\n";
|
||||
|
||||
if (CodeInit *CI =
|
||||
dynamic_cast<CodeInit*>(RC.TheDef->getValueInit("Methods")))
|
||||
OS << CI->getValue();
|
||||
else
|
||||
throw "Expected 'code' fragment for 'Methods' value in register class '"+
|
||||
RC.getName() + "'!";
|
||||
|
||||
OS << " } " << Name << "Instance;\n\n";
|
||||
<< Name << " + " << RC.Elements.size() << ") {}\n"
|
||||
<< RC.MethodDefinitions
|
||||
<< " } " << Name << "Instance;\n\n";
|
||||
}
|
||||
|
||||
OS << " const TargetRegisterClass* const RegisterClasses[] = {\n";
|
||||
|
Loading…
Reference in New Issue
Block a user