Split register class "Methods" into MethodProtos and MethodBodies

llvm-svn: 22928
This commit is contained in:
Chris Lattner 2005-08-19 19:12:51 +00:00
parent 248933eb39
commit 73ec2cb0f5
3 changed files with 13 additions and 6 deletions

View File

@ -36,7 +36,7 @@ namespace llvm {
std::vector<Record*> Elements;
unsigned SpillSize;
unsigned SpillAlignment;
std::string MethodDefinitions;
std::string MethodProtos, MethodBodies;
const std::string &getName() const;

View File

@ -153,12 +153,18 @@ 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();
if (CodeInit *CI = dynamic_cast<CodeInit*>(R->getValueInit("MethodBodies")))
MethodBodies = CI->getValue();
else
throw "Expected 'code' fragment for 'Methods' value in register class '"+
getName() + "'!";
throw "Expected 'code' fragment for 'MethodBodies' value in register "
"class '" + getName() + "'!";
if (CodeInit *CI = dynamic_cast<CodeInit*>(R->getValueInit("MethodProtos")))
MethodProtos = CI->getValue();
else
throw "Expected 'code' fragment for 'MethodProtos' 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

@ -126,7 +126,8 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
<< " " << Name << "Class() : TargetRegisterClass("
<< RC.SpillSize/8 << ", " << RC.SpillAlignment/8 << ", " << Name << ", "
<< Name << " + " << RC.Elements.size() << ") {}\n"
<< RC.MethodDefinitions << " };\n\n";
<< RC.MethodProtos << " };\n";
OS << RC.MethodBodies << "\n";
}
OS << "} // end anonymous namespace\n\n";