aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-06 04:36:35 +0000
committerChris Lattner <sabre@nondot.org>2003-08-06 04:36:35 +0000
commit0e5e49e6888c354ff95fc9e56d0881af78cb4269 (patch)
treee7204237ce6a61039d330f64f40ac05df9cbf371 /utils
parentbc01723605de979e67b1aea67385a029f851de34 (diff)
downloadexternal_llvm-0e5e49e6888c354ff95fc9e56d0881af78cb4269.zip
external_llvm-0e5e49e6888c354ff95fc9e56d0881af78cb4269.tar.gz
external_llvm-0e5e49e6888c354ff95fc9e56d0881af78cb4269.tar.bz2
convert over to using TableGen backends
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7628 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/CodeEmitterGen.cpp2
-rw-r--r--utils/TableGen/CodeEmitterGen.h6
-rw-r--r--utils/TableGen/RegisterInfoEmitter.cpp27
-rw-r--r--utils/TableGen/RegisterInfoEmitter.h5
4 files changed, 9 insertions, 31 deletions
diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp
index b3928b8..0769456 100644
--- a/utils/TableGen/CodeEmitterGen.cpp
+++ b/utils/TableGen/CodeEmitterGen.cpp
@@ -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::";
diff --git a/utils/TableGen/CodeEmitterGen.h b/utils/TableGen/CodeEmitterGen.h
index 7ae3ef8..4b87da5 100644
--- a/utils/TableGen/CodeEmitterGen.h
+++ b/utils/TableGen/CodeEmitterGen.h
@@ -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) {}
diff --git a/utils/TableGen/RegisterInfoEmitter.cpp b/utils/TableGen/RegisterInfoEmitter.cpp
index 043fb3b..a4ad8d5 100644
--- a/utils/TableGen/RegisterInfoEmitter.cpp
+++ b/utils/TableGen/RegisterInfoEmitter.cpp
@@ -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 @@ void RegisterInfoEmitter::runEnums(std::ostream &OS) {
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 @@ void RegisterInfoEmitter::runEnums(std::ostream &OS) {
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 @@ void RegisterInfoEmitter::runHeader(std::ostream &OS) {
// 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
diff --git a/utils/TableGen/RegisterInfoEmitter.h b/utils/TableGen/RegisterInfoEmitter.h
index 79e9309..65a0330 100644
--- a/utils/TableGen/RegisterInfoEmitter.h
+++ b/utils/TableGen/RegisterInfoEmitter.h
@@ -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) {}