Expose the derived register classes to the public header, allowing them

to be accessed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22930 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-08-19 20:23:42 +00:00
parent ecbce617ca
commit 60200e5d32

View File

@ -69,7 +69,17 @@ void RegisterInfoEmitter::runHeader(std::ostream &OS) {
<< " { // Register classes\n"; << " { // Register classes\n";
for (unsigned i = 0, e = RegisterClasses.size(); i != e; ++i) { for (unsigned i = 0, e = RegisterClasses.size(); i != e; ++i) {
const std::string &Name = RegisterClasses[i].getName(); const std::string &Name = RegisterClasses[i].getName();
OS << " extern TargetRegisterClass * const "<< Name <<"RegisterClass;\n";
// Output the register class definition.
OS << " struct " << Name << "Class : public TargetRegisterClass {\n"
<< " " << Name << "Class();\n"
<< RegisterClasses[i].MethodProtos << " };\n";
// Output the extern for the instance.
OS << " extern " << Name << "Class\t" << Name << "RegClass;\n";
// Output the extern for the pointer to the instance (should remove).
OS << " static TargetRegisterClass * const "<< Name <<"RegisterClass = &"
<< Name << "RegClass;\n";
} }
OS << "} // end of namespace " << TargetName << "\n\n"; OS << "} // end of namespace " << TargetName << "\n\n";
} }
@ -121,13 +131,6 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
RegClassesBelongedTo.insert(std::make_pair(Reg, &RC)); RegClassesBelongedTo.insert(std::make_pair(Reg, &RC));
} }
OS << "\n };\n\n"; OS << "\n };\n\n";
OS << " struct " << Name << "Class : public TargetRegisterClass {\n"
<< " " << Name << "Class() : TargetRegisterClass("
<< RC.SpillSize/8 << ", " << RC.SpillAlignment/8 << ", " << Name << ", "
<< Name << " + " << RC.Elements.size() << ") {}\n"
<< RC.MethodProtos << " };\n";
OS << RC.MethodBodies << "\n";
} }
OS << "} // end anonymous namespace\n\n"; OS << "} // end anonymous namespace\n\n";
@ -137,7 +140,17 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
<< " { // Register class instances\n"; << " { // Register class instances\n";
for (unsigned i = 0, e = RegisterClasses.size(); i != e; ++i) for (unsigned i = 0, e = RegisterClasses.size(); i != e; ++i)
OS << " " << RegisterClasses[i].getName() << "Class\t" OS << " " << RegisterClasses[i].getName() << "Class\t"
<< RegisterClasses[i].getName() << "RegClassInstance;\n"; << RegisterClasses[i].getName() << "RegClass;\n";
for (unsigned i = 0, e = RegisterClasses.size(); i != e; ++i) {
const CodeGenRegisterClass &RC = RegisterClasses[i];
OS << RC.MethodBodies << "\n";
OS << RC.getName() << "Class::" << RC.getName()
<< "Class() : TargetRegisterClass(" << RC.SpillSize/8 << ", "
<< RC.SpillAlignment/8 << ", " << RC.getName() << ", "
<< RC.getName() << " + " << RC.Elements.size() << ") {}\n";
}
OS << "}\n"; OS << "}\n";
} }
@ -145,7 +158,7 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
OS << " const TargetRegisterClass* const RegisterClasses[] = {\n"; OS << " const TargetRegisterClass* const RegisterClasses[] = {\n";
for (unsigned i = 0, e = RegisterClasses.size(); i != e; ++i) for (unsigned i = 0, e = RegisterClasses.size(); i != e; ++i)
OS << " &" << getQualifiedName(RegisterClasses[i].TheDef) OS << " &" << getQualifiedName(RegisterClasses[i].TheDef)
<< "RegClassInstance,\n"; << "RegClass,\n";
OS << " };\n"; OS << " };\n";
// Emit register class aliases... // Emit register class aliases...
@ -238,18 +251,6 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
OS << " };\n"; // End of register descriptors... OS << " };\n"; // End of register descriptors...
OS << "}\n\n"; // End of anonymous namespace... OS << "}\n\n"; // End of anonymous namespace...
if (!RegisterClasses.empty()) {
OS << "namespace " << RegisterClasses[0].Namespace
<< " { // Register classes\n";
for (unsigned i = 0, e = RegisterClasses.size(); i != e; ++i) {
OS << " TargetRegisterClass * const " << RegisterClasses[i].getName()
<< "RegisterClass = &" << getQualifiedName(RegisterClasses[i].TheDef)
<< "RegClassInstance;\n";
}
OS << "} // end of namespace " << RegisterClasses[0].Namespace << "\n\n";
}
std::string ClassName = Target.getName() + "GenRegisterInfo"; std::string ClassName = Target.getName() + "GenRegisterInfo";
// Emit the constructor of the class... // Emit the constructor of the class...