mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 21:32:10 +00:00
Export the register classes so that the instruction selector can get at them as needed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7651 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6a80975505
commit
38aa542f36
@ -10,11 +10,11 @@
|
||||
|
||||
NodeType::ArgResultTypes NodeType::Translate(Record *R) {
|
||||
const std::string &Name = R->getName();
|
||||
if (Name == "DNRT_void") return Void;
|
||||
if (Name == "DNRT_val" || Name == "DNAT_val") return Val;
|
||||
if (Name == "DNRT_arg0" || Name == "DNAT_arg0") return Arg0;
|
||||
if (Name == "DNAT_ptr") return Ptr;
|
||||
throw "Unknown DagNodeResult Type '" + Name + "'!";
|
||||
if (Name == "DNVT_void") return Void;
|
||||
if (Name == "DNVT_val" ) return Val;
|
||||
if (Name == "DNVT_arg0") return Arg0;
|
||||
if (Name == "DNVT_ptr" ) return Ptr;
|
||||
throw "Unknown DagNodeValType '" + Name + "'!";
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,8 +36,8 @@ void RegisterInfoEmitter::runEnums(std::ostream &OS) {
|
||||
|
||||
void RegisterInfoEmitter::runHeader(std::ostream &OS) {
|
||||
EmitSourceFileHeader("Register Information Header Fragment", OS);
|
||||
|
||||
std::string ClassName = getTarget(Records)->getName() + "GenRegisterInfo";
|
||||
const std::string &TargetName = getTarget(Records)->getName();
|
||||
std::string ClassName = TargetName + "GenRegisterInfo";
|
||||
|
||||
OS << "#include \"llvm/Target/MRegisterInfo.h\"\n\n";
|
||||
|
||||
@ -46,6 +46,17 @@ void RegisterInfoEmitter::runHeader(std::ostream &OS) {
|
||||
<< "(int CallFrameSetupOpcode = -1, int CallFrameDestroyOpcode = -1);\n"
|
||||
<< " const unsigned* getCalleeSaveRegs() const;\n"
|
||||
<< "};\n\n";
|
||||
|
||||
std::vector<Record*> RegisterClasses =
|
||||
Records.getAllDerivedDefinitions("RegisterClass");
|
||||
|
||||
OS << "namespace " << TargetName << " { // Register classes\n";
|
||||
for (unsigned i = 0, e = RegisterClasses.size(); i != e; ++i) {
|
||||
const std::string &Name = RegisterClasses[i]->getName();
|
||||
if (Name.size() < 9 || Name[9] != '.') // Ignore anonymous classes
|
||||
OS << " extern TargetRegisterClass *" << Name << "RegisterClass;\n";
|
||||
}
|
||||
OS << "} // end of namespace " << TargetName << "\n\n";
|
||||
}
|
||||
|
||||
// RegisterInfoEmitter::run - Main register file description emitter.
|
||||
@ -183,6 +194,18 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
OS << "}\n\n"; // End of anonymous namespace...
|
||||
|
||||
Record *Target = getTarget(Records);
|
||||
|
||||
OS << "namespace " << Target->getName() << " { // Register classes\n";
|
||||
for (unsigned i = 0, e = RegisterClasses.size(); i != e; ++i) {
|
||||
const std::string &Name = RegisterClasses[i]->getName();
|
||||
if (Name.size() < 9 || Name[9] != '.') // Ignore anonymous classes
|
||||
OS << " TargetRegisterClass *" << Name << "RegisterClass = &"
|
||||
<< Name << "Instance;\n";
|
||||
}
|
||||
OS << "} // end of namespace " << Target->getName() << "\n\n";
|
||||
|
||||
|
||||
|
||||
std::string ClassName = Target->getName() + "GenRegisterInfo";
|
||||
|
||||
// Emit the constructor of the class...
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
NodeType::ArgResultTypes NodeType::Translate(Record *R) {
|
||||
const std::string &Name = R->getName();
|
||||
if (Name == "DNRT_void") return Void;
|
||||
if (Name == "DNRT_val" || Name == "DNAT_val") return Val;
|
||||
if (Name == "DNRT_arg0" || Name == "DNAT_arg0") return Arg0;
|
||||
if (Name == "DNAT_ptr") return Ptr;
|
||||
throw "Unknown DagNodeResult Type '" + Name + "'!";
|
||||
if (Name == "DNVT_void") return Void;
|
||||
if (Name == "DNVT_val" ) return Val;
|
||||
if (Name == "DNVT_arg0") return Arg0;
|
||||
if (Name == "DNVT_ptr" ) return Ptr;
|
||||
throw "Unknown DagNodeValType '" + Name + "'!";
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,8 +36,8 @@ void RegisterInfoEmitter::runEnums(std::ostream &OS) {
|
||||
|
||||
void RegisterInfoEmitter::runHeader(std::ostream &OS) {
|
||||
EmitSourceFileHeader("Register Information Header Fragment", OS);
|
||||
|
||||
std::string ClassName = getTarget(Records)->getName() + "GenRegisterInfo";
|
||||
const std::string &TargetName = getTarget(Records)->getName();
|
||||
std::string ClassName = TargetName + "GenRegisterInfo";
|
||||
|
||||
OS << "#include \"llvm/Target/MRegisterInfo.h\"\n\n";
|
||||
|
||||
@ -46,6 +46,17 @@ void RegisterInfoEmitter::runHeader(std::ostream &OS) {
|
||||
<< "(int CallFrameSetupOpcode = -1, int CallFrameDestroyOpcode = -1);\n"
|
||||
<< " const unsigned* getCalleeSaveRegs() const;\n"
|
||||
<< "};\n\n";
|
||||
|
||||
std::vector<Record*> RegisterClasses =
|
||||
Records.getAllDerivedDefinitions("RegisterClass");
|
||||
|
||||
OS << "namespace " << TargetName << " { // Register classes\n";
|
||||
for (unsigned i = 0, e = RegisterClasses.size(); i != e; ++i) {
|
||||
const std::string &Name = RegisterClasses[i]->getName();
|
||||
if (Name.size() < 9 || Name[9] != '.') // Ignore anonymous classes
|
||||
OS << " extern TargetRegisterClass *" << Name << "RegisterClass;\n";
|
||||
}
|
||||
OS << "} // end of namespace " << TargetName << "\n\n";
|
||||
}
|
||||
|
||||
// RegisterInfoEmitter::run - Main register file description emitter.
|
||||
@ -183,6 +194,18 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
OS << "}\n\n"; // End of anonymous namespace...
|
||||
|
||||
Record *Target = getTarget(Records);
|
||||
|
||||
OS << "namespace " << Target->getName() << " { // Register classes\n";
|
||||
for (unsigned i = 0, e = RegisterClasses.size(); i != e; ++i) {
|
||||
const std::string &Name = RegisterClasses[i]->getName();
|
||||
if (Name.size() < 9 || Name[9] != '.') // Ignore anonymous classes
|
||||
OS << " TargetRegisterClass *" << Name << "RegisterClass = &"
|
||||
<< Name << "Instance;\n";
|
||||
}
|
||||
OS << "} // end of namespace " << Target->getName() << "\n\n";
|
||||
|
||||
|
||||
|
||||
std::string ClassName = Target->getName() + "GenRegisterInfo";
|
||||
|
||||
// Emit the constructor of the class...
|
||||
|
Loading…
Reference in New Issue
Block a user