[llvm-commits] CVS: llvm/utils/TableGen/RegisterInfoEmitter.cpp InstrInfoEmitter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Aug 7 00:40:01 PDT 2003
Changes in directory llvm/utils/TableGen:
RegisterInfoEmitter.cpp updated: 1.9 -> 1.10
InstrInfoEmitter.cpp updated: 1.3 -> 1.4
---
Log message:
Start using the CodeGeneratorWrappers
---
Diffs of the changes:
Index: llvm/utils/TableGen/RegisterInfoEmitter.cpp
diff -u llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.9 llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.10
--- llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.9 Wed Aug 6 16:47:14 2003
+++ llvm/utils/TableGen/RegisterInfoEmitter.cpp Thu Aug 7 00:39:09 2003
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "RegisterInfoEmitter.h"
+#include "CodeGenWrappers.h"
#include "Record.h"
#include "Support/StringExtras.h"
#include <set>
@@ -36,7 +37,7 @@
void RegisterInfoEmitter::runHeader(std::ostream &OS) {
EmitSourceFileHeader("Register Information Header Fragment", OS);
- const std::string &TargetName = getTarget(Records)->getName();
+ const std::string &TargetName = CodeGenTarget().getName();
std::string ClassName = TargetName + "GenRegisterInfo";
OS << "#include \"llvm/Target/MRegisterInfo.h\"\n\n";
@@ -193,20 +194,20 @@
OS << " };\n"; // End of register descriptors...
OS << "}\n\n"; // End of anonymous namespace...
- Record *Target = getTarget(Records);
+ CodeGenTarget Target;
- OS << "namespace " << Target->getName() << " { // Register classes\n";
+ 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";
+ OS << "} // end of namespace " << Target.getName() << "\n\n";
- std::string ClassName = Target->getName() + "GenRegisterInfo";
+ std::string ClassName = Target.getName() + "GenRegisterInfo";
// Emit the constructor of the class...
OS << ClassName << "::" << ClassName
@@ -219,11 +220,8 @@
OS << "const unsigned* " << ClassName << "::getCalleeSaveRegs() const {\n"
<< " static const unsigned CalleeSaveRegs[] = {\n ";
- ListInit *LI = Target->getValueAsListInit("CalleeSavedRegisters");
- for (unsigned i = 0, e = LI->getSize(); i != e; ++i)
- if (DefInit *DI = dynamic_cast<DefInit*>(LI->getElement(i)))
- OS << getQualifiedName(DI->getDef()) << ", ";
- else
- throw "Expected register definition in CalleeSavedRegisters list!";
+ const std::vector<Record*> &CSR = Target.getCalleeSavedRegisters();
+ for (unsigned i = 0, e = CSR.size(); i != e; ++i)
+ OS << getQualifiedName(CSR[i]) << ", ";
OS << " 0\n };\n return CalleeSaveRegs;\n}\n\n";
}
Index: llvm/utils/TableGen/InstrInfoEmitter.cpp
diff -u llvm/utils/TableGen/InstrInfoEmitter.cpp:1.3 llvm/utils/TableGen/InstrInfoEmitter.cpp:1.4
--- llvm/utils/TableGen/InstrInfoEmitter.cpp:1.3 Tue Aug 5 23:32:07 2003
+++ llvm/utils/TableGen/InstrInfoEmitter.cpp Thu Aug 7 00:39:09 2003
@@ -6,6 +6,7 @@
//===----------------------------------------------------------------------===//
#include "InstrInfoEmitter.h"
+#include "CodeGenWrappers.h"
#include "Record.h"
// runEnums - Print out enum values for all of the instructions.
@@ -23,9 +24,10 @@
OS << "namespace " << Namespace << " {\n";
OS << " enum {\n";
+ CodeGenTarget Target;
+
// We must emit the PHI opcode first...
- Record *Target = getTarget(Records);
- Record *InstrInfo = Target->getValueAsDef("InstructionSet");
+ Record *InstrInfo = Target.getInstructionSet();
Record *PHI = InstrInfo->getValueAsDef("PHIInst");
OS << " " << PHI->getName() << ", \t// 0 (fixed for all targets)\n";
@@ -55,9 +57,9 @@
// run - Emit the main instruction description records for the target...
void InstrInfoEmitter::run(std::ostream &OS) {
EmitSourceFileHeader("Target Instruction Descriptors", OS);
- Record *Target = getTarget(Records);
- const std::string &TargetName = Target->getName();
- Record *InstrInfo = Target->getValueAsDef("InstructionSet");
+ CodeGenTarget Target;
+ const std::string &TargetName = Target.getName();
+ Record *InstrInfo = Target.getInstructionSet();
Record *PHI = InstrInfo->getValueAsDef("PHIInst");
std::vector<Record*> Instructions =
More information about the llvm-commits
mailing list