[llvm-commits] CVS: llvm/utils/TableGen/RegisterInfoEmitter.h RegisterInfoEmitter.cpp CodeEmitterGen.h CodeEmitterGen.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Aug 5 23:37:00 PDT 2003
Changes in directory llvm/utils/TableGen:
RegisterInfoEmitter.h updated: 1.3 -> 1.4
RegisterInfoEmitter.cpp updated: 1.7 -> 1.8
CodeEmitterGen.h updated: 1.7 -> 1.8
CodeEmitterGen.cpp updated: 1.24 -> 1.25
---
Log message:
convert over to using TableGen backends
---
Diffs of the changes:
Index: llvm/utils/TableGen/RegisterInfoEmitter.h
diff -u llvm/utils/TableGen/RegisterInfoEmitter.h:1.3 llvm/utils/TableGen/RegisterInfoEmitter.h:1.4
--- llvm/utils/TableGen/RegisterInfoEmitter.h:1.3 Sun Aug 3 11:30:24 2003
+++ llvm/utils/TableGen/RegisterInfoEmitter.h Tue Aug 5 23:36:35 2003
@@ -9,10 +9,9 @@
#ifndef REGISTER_INFO_EMITTER_H
#define REGISTER_INFO_EMITTER_H
-#include <iosfwd>
-class RecordKeeper;
+#include "TableGenBackend.h"
-class RegisterInfoEmitter {
+class RegisterInfoEmitter : public TableGenBackend {
RecordKeeper &Records;
public:
RegisterInfoEmitter(RecordKeeper &R) : Records(R) {}
Index: llvm/utils/TableGen/RegisterInfoEmitter.cpp
diff -u llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.7 llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.8
--- llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.7 Sun Aug 3 17:14:50 2003
+++ llvm/utils/TableGen/RegisterInfoEmitter.cpp Tue Aug 5 23:36:35 2003
@@ -11,13 +11,6 @@
#include "Support/StringExtras.h"
#include <set>
-static void EmitSourceHeader(const std::string &Desc, std::ostream &o) {
- o << "//===- TableGen'erated file -------------------------------------*-"
- " C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate"
- "d file, do not edit!\n//\n//===------------------------------------"
- "----------------------------------===//\n\n";
-}
-
// runEnums - Print out enum values for all of the registers.
void RegisterInfoEmitter::runEnums(std::ostream &OS) {
std::vector<Record*> Registers = Records.getAllDerivedDefinitions("Register");
@@ -27,7 +20,7 @@
std::string Namespace = Registers[0]->getValueAsString("Namespace");
- EmitSourceHeader("Target Register Enum Values", OS);
+ EmitSourceFileHeader("Target Register Enum Values", OS);
if (!Namespace.empty())
OS << "namespace " << Namespace << " {\n";
@@ -41,22 +34,8 @@
OS << "}\n";
}
-static Record *getTarget(RecordKeeper &RC) {
- std::vector<Record*> Targets = RC.getAllDerivedDefinitions("Target");
-
- if (Targets.size() != 1)
- throw std::string("ERROR: Multiple subclasses of Target defined!");
- return Targets[0];
-}
-
-static std::string getQualifiedName(Record *R) {
- std::string Namespace = R->getValueAsString("Namespace");
- if (Namespace.empty()) return R->getName();
- return Namespace + "::" + R->getName();
-}
-
void RegisterInfoEmitter::runHeader(std::ostream &OS) {
- EmitSourceHeader("Register Information Header Fragment", OS);
+ EmitSourceFileHeader("Register Information Header Fragment", OS);
std::string ClassName = getTarget(Records)->getName() + "GenRegisterInfo";
@@ -72,7 +51,7 @@
// RegisterInfoEmitter::run - Main register file description emitter.
//
void RegisterInfoEmitter::run(std::ostream &OS) {
- EmitSourceHeader("Register Information Source Fragment", OS);
+ EmitSourceFileHeader("Register Information Source Fragment", OS);
// Start out by emitting each of the register classes... to do this, we build
// a set of registers which belong to a register class, this is to ensure that
Index: llvm/utils/TableGen/CodeEmitterGen.h
diff -u llvm/utils/TableGen/CodeEmitterGen.h:1.7 llvm/utils/TableGen/CodeEmitterGen.h:1.8
--- llvm/utils/TableGen/CodeEmitterGen.h:1.7 Thu Jul 31 23:38:18 2003
+++ llvm/utils/TableGen/CodeEmitterGen.h Tue Aug 5 23:36:35 2003
@@ -7,11 +7,9 @@
#ifndef CODEMITTERGEN_H
#define CODEMITTERGEN_H
-#include <string>
-#include <iosfwd>
-class RecordKeeper;
+#include "TableGenBackend.h"
-class CodeEmitterGen {
+class CodeEmitterGen : public TableGenBackend {
RecordKeeper &Records;
public:
CodeEmitterGen(RecordKeeper &R) : Records(R) {}
Index: llvm/utils/TableGen/CodeEmitterGen.cpp
diff -u llvm/utils/TableGen/CodeEmitterGen.cpp:1.24 llvm/utils/TableGen/CodeEmitterGen.cpp:1.25
--- llvm/utils/TableGen/CodeEmitterGen.cpp:1.24 Tue Aug 5 09:35:35 2003
+++ llvm/utils/TableGen/CodeEmitterGen.cpp Tue Aug 5 23:36:35 2003
@@ -11,6 +11,8 @@
void CodeEmitterGen::run(std::ostream &o) {
std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
+ EmitSourceFileHeader("Machine Code Emitter", o);
+
std::string Namespace = "V9::";
std::string ClassName = "SparcV9CodeEmitter::";
More information about the llvm-commits
mailing list