forked from OSchip/llvm-project
Sketch TableGen disassembler emitter, based on patch by Sean Callanan.
llvm-svn: 89833
This commit is contained in:
parent
3d9e90ae3e
commit
e502433d7f
|
@ -8,6 +8,7 @@ add_executable(tblgen
|
|||
CodeGenInstruction.cpp
|
||||
CodeGenTarget.cpp
|
||||
DAGISelEmitter.cpp
|
||||
DisassemblerEmitter.cpp
|
||||
FastISelEmitter.cpp
|
||||
InstrEnumEmitter.cpp
|
||||
InstrInfoEmitter.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");
|
||||
}
|
|
@ -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
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue