diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-11-25 02:13:23 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-25 02:13:23 +0000 |
commit | 405887419f3954545be8da2da12000d2aa61ae16 (patch) | |
tree | 0b0aafcdfa83f95c599a4223750a8f9bd61ecdec /utils | |
parent | 37fd537544769c7f4304141745ebee4a8677e783 (diff) | |
download | external_llvm-405887419f3954545be8da2da12000d2aa61ae16.zip external_llvm-405887419f3954545be8da2da12000d2aa61ae16.tar.gz external_llvm-405887419f3954545be8da2da12000d2aa61ae16.tar.bz2 |
Sketch TableGen disassembler emitter, based on patch by Sean Callanan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89833 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/CMakeLists.txt | 1 | ||||
-rw-r--r-- | utils/TableGen/DisassemblerEmitter.cpp | 30 | ||||
-rw-r--r-- | utils/TableGen/DisassemblerEmitter.h | 28 | ||||
-rw-r--r-- | utils/TableGen/TableGen.cpp | 7 |
4 files changed, 66 insertions, 0 deletions
diff --git a/utils/TableGen/CMakeLists.txt b/utils/TableGen/CMakeLists.txt index d9ec6f7..daf8676 100644 --- a/utils/TableGen/CMakeLists.txt +++ b/utils/TableGen/CMakeLists.txt @@ -8,6 +8,7 @@ add_executable(tblgen CodeGenInstruction.cpp CodeGenTarget.cpp DAGISelEmitter.cpp + DisassemblerEmitter.cpp FastISelEmitter.cpp InstrEnumEmitter.cpp InstrInfoEmitter.cpp diff --git a/utils/TableGen/DisassemblerEmitter.cpp b/utils/TableGen/DisassemblerEmitter.cpp new file mode 100644 index 0000000..cc13125 --- /dev/null +++ b/utils/TableGen/DisassemblerEmitter.cpp @@ -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"); +} diff --git a/utils/TableGen/DisassemblerEmitter.h b/utils/TableGen/DisassemblerEmitter.h new file mode 100644 index 0000000..7229d81 --- /dev/null +++ b/utils/TableGen/DisassemblerEmitter.h @@ -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 diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp index c6c4306..7c8d288 100644 --- a/utils/TableGen/TableGen.cpp +++ b/utils/TableGen/TableGen.cpp @@ -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 @@ enum ActionType { GenEmitter, GenRegisterEnums, GenRegister, GenRegisterHeader, GenInstrEnums, GenInstrs, GenAsmWriter, GenAsmMatcher, + GenDisassembler, GenCallingConv, GenClangDiagsDefs, GenClangDiagGroups, @@ -80,6 +82,8 @@ namespace { "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 @@ int main(int argc, char **argv) { case GenClangDiagGroups: ClangDiagGroupsEmitter(Records).run(*Out); break; + case GenDisassembler: + DisassemblerEmitter(Records).run(*Out); + break; case GenOptParserDefs: OptParserEmitter(Records, true).run(*Out); break; |