mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Support "Methods" in register classes in CodgeGenRegisterClass
llvm-svn: 15965
This commit is contained in:
parent
23a0219a11
commit
75ca702833
@ -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