[llvm-commits] [llvm] r89833 - in /llvm/trunk/utils/TableGen: CMakeLists.txt DisassemblerEmitter.cpp DisassemblerEmitter.h TableGen.cpp
Daniel Dunbar
daniel at zuster.org
Tue Nov 24 18:13:23 PST 2009
Author: ddunbar
Date: Tue Nov 24 20:13:23 2009
New Revision: 89833
URL: http://llvm.org/viewvc/llvm-project?rev=89833&view=rev
Log:
Sketch TableGen disassembler emitter, based on patch by Sean Callanan.
Added:
llvm/trunk/utils/TableGen/DisassemblerEmitter.cpp
llvm/trunk/utils/TableGen/DisassemblerEmitter.h
Modified:
llvm/trunk/utils/TableGen/CMakeLists.txt
llvm/trunk/utils/TableGen/TableGen.cpp
Modified: llvm/trunk/utils/TableGen/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CMakeLists.txt?rev=89833&r1=89832&r2=89833&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CMakeLists.txt (original)
+++ llvm/trunk/utils/TableGen/CMakeLists.txt Tue Nov 24 20:13:23 2009
@@ -8,6 +8,7 @@
CodeGenInstruction.cpp
CodeGenTarget.cpp
DAGISelEmitter.cpp
+ DisassemblerEmitter.cpp
FastISelEmitter.cpp
InstrEnumEmitter.cpp
InstrInfoEmitter.cpp
Added: llvm/trunk/utils/TableGen/DisassemblerEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DisassemblerEmitter.cpp?rev=89833&view=auto
==============================================================================
--- llvm/trunk/utils/TableGen/DisassemblerEmitter.cpp (added)
+++ llvm/trunk/utils/TableGen/DisassemblerEmitter.cpp Tue Nov 24 20:13:23 2009
@@ -0,0 +1,30 @@
+//===- DisassemblerEmitter.cpp - Generate a disassembler ------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "DisassemblerEmitter.h"
+#include "CodeGenTarget.h"
+#include "Record.h"
+using namespace llvm;
+
+void DisassemblerEmitter::run(raw_ostream &OS) {
+ CodeGenTarget Target;
+
+ OS << "/*===- TableGen'erated file "
+ << "---------------------------------------*- C -*-===*\n"
+ << " *\n"
+ << " * " << Target.getName() << " Disassembler\n"
+ << " *\n"
+ << " * Automatically generated file, do not edit!\n"
+ << " *\n"
+ << " *===---------------------------------------------------------------"
+ << "-------===*/\n";
+
+ throw TGError(Target.getTargetRecord()->getLoc(),
+ "Unable to generate disassembler for this target");
+}
Added: llvm/trunk/utils/TableGen/DisassemblerEmitter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DisassemblerEmitter.h?rev=89833&view=auto
==============================================================================
--- llvm/trunk/utils/TableGen/DisassemblerEmitter.h (added)
+++ llvm/trunk/utils/TableGen/DisassemblerEmitter.h Tue Nov 24 20:13:23 2009
@@ -0,0 +1,28 @@
+//===- DisassemblerEmitter.h - Disassembler Generator -----------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DISASSEMBLEREMITTER_H
+#define DISASSEMBLEREMITTER_H
+
+#include "TableGenBackend.h"
+
+namespace llvm {
+
+ class DisassemblerEmitter : public TableGenBackend {
+ RecordKeeper &Records;
+ public:
+ DisassemblerEmitter(RecordKeeper &R) : Records(R) {}
+
+ /// run - Output the disassembler.
+ void run(raw_ostream &o);
+ };
+
+} // end llvm namespace
+
+#endif
Modified: llvm/trunk/utils/TableGen/TableGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGen.cpp?rev=89833&r1=89832&r2=89833&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TableGen.cpp (original)
+++ llvm/trunk/utils/TableGen/TableGen.cpp Tue Nov 24 20:13:23 2009
@@ -21,6 +21,7 @@
#include "ClangDiagnosticsEmitter.h"
#include "CodeEmitterGen.h"
#include "DAGISelEmitter.h"
+#include "DisassemblerEmitter.h"
#include "FastISelEmitter.h"
#include "InstrEnumEmitter.h"
#include "InstrInfoEmitter.h"
@@ -46,6 +47,7 @@
GenEmitter,
GenRegisterEnums, GenRegister, GenRegisterHeader,
GenInstrEnums, GenInstrs, GenAsmWriter, GenAsmMatcher,
+ GenDisassembler,
GenCallingConv,
GenClangDiagsDefs,
GenClangDiagGroups,
@@ -80,6 +82,8 @@
"Generate calling convention descriptions"),
clEnumValN(GenAsmWriter, "gen-asm-writer",
"Generate assembly writer"),
+ clEnumValN(GenDisassembler, "gen-disassembler",
+ "Generate disassembler"),
clEnumValN(GenAsmMatcher, "gen-asm-matcher",
"Generate assembly instruction matcher"),
clEnumValN(GenDAGISel, "gen-dag-isel",
@@ -228,6 +232,9 @@
case GenClangDiagGroups:
ClangDiagGroupsEmitter(Records).run(*Out);
break;
+ case GenDisassembler:
+ DisassemblerEmitter(Records).run(*Out);
+ break;
case GenOptParserDefs:
OptParserEmitter(Records, true).run(*Out);
break;
More information about the llvm-commits
mailing list