summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-05-24 00:17:12 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-05-24 00:17:12 +0000
commit0d817c4b2e03a05b17bc7ba98e6a3b31b88a32be (patch)
tree2fafdfd166c53ad844ba94cb0677ba9cf4eb6a98 /llvm
parenta7ec8e1a3e994a8136ed0f8500b578eec3098e3a (diff)
downloadbcm5719-llvm-0d817c4b2e03a05b17bc7ba98e6a3b31b88a32be.tar.gz
bcm5719-llvm-0d817c4b2e03a05b17bc7ba98e6a3b31b88a32be.zip
Add ability to utilize the code emitter generator (CodeEmitterGen).
llvm-svn: 6322
Diffstat (limited to 'llvm')
-rw-r--r--llvm/support/tools/TableGen/TableGen.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/llvm/support/tools/TableGen/TableGen.cpp b/llvm/support/tools/TableGen/TableGen.cpp
index 35df907c2d6..5eb5a7c4c99 100644
--- a/llvm/support/tools/TableGen/TableGen.cpp
+++ b/llvm/support/tools/TableGen/TableGen.cpp
@@ -1,9 +1,11 @@
#include "Record.h"
#include "Support/CommandLine.h"
+#include "CodeEmitterGen.h"
#include <algorithm>
static cl::opt<std::string> Class("class", cl::desc("Print Enum list for this class"));
static cl::opt<bool> Parse("parse");
+static cl::opt<bool> GenEmitter("gen-emitter");
void ParseFile();
@@ -289,6 +291,7 @@ static void PrintInstruction(Record *I, unsigned char *Ptr) {
}
static void ParseMachineCode() {
+ // X86 code
unsigned char Buffer[] = {
0x55, // push EBP
0x89, 0xE5, // mov EBP, ESP
@@ -307,7 +310,18 @@ static void ParseMachineCode() {
0x85, 0xC0, // test EAX, EAX
0xF4, // hlt
};
-
+
+#if 0
+ // SparcV9 code
+ unsigned char Buffer[] = { 0xbf, 0xe0, 0x20, 0x1f, 0x1, 0x0, 0x0, 0x1,
+ 0x0, 0x0, 0x0, 0x0, 0xc1, 0x0, 0x20, 0x1, 0x1,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x1,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0xaf, 0xe8, 0x20, 0x17
+ };
+#endif
+
std::vector<Record*> Insts;
const std::map<std::string, Record*> &Defs = Records.getDefs();
@@ -344,6 +358,12 @@ int main(int argc, char **argv) {
return 0;
}
+ if (GenEmitter) {
+ CodeEmitterGen CEG(Records);
+ CEG.createEmitter(std::cout);
+ return 0;
+ }
+
if (Class == "") {
std::cout << Records; // No argument, dump all contents
} else {
OpenPOWER on IntegriCloud