1
0
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:
Chris Lattner 2004-08-21 19:21:21 +00:00
parent 23a0219a11
commit 75ca702833
3 changed files with 10 additions and 11 deletions

View File

@ -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;

View File

@ -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));

View File

@ -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";