summaryrefslogtreecommitdiff
path: root/utils/TableGen
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-09-30 01:29:54 +0000
committerJim Grosbach <grosbach@apple.com>2010-09-30 01:29:54 +0000
commitca96a861655d3fcfc5ff047e249703930c8330bc (patch)
tree92604ea321edafed758d625ed872c0a9bd9d2d77 /utils/TableGen
parent97fe645bc29612eff47ec8841a4b3eb3442a0a0b (diff)
downloadllvm-ca96a861655d3fcfc5ff047e249703930c8330bc.tar.gz
llvm-ca96a861655d3fcfc5ff047e249703930c8330bc.tar.bz2
llvm-ca96a861655d3fcfc5ff047e249703930c8330bc.tar.xz
Let a target specify whether it wants an assembly printer to be the MC version
or not. TableGen needs to generate the printInstruction() function as taking an MCInstr* or a MachineInstr*, depending. Default to the old non-MC version so that everything not yet using MC continues to just work without fidding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115126 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r--utils/TableGen/AsmWriterEmitter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp
index 6ae0b39c8d..1bca660744 100644
--- a/utils/TableGen/AsmWriterEmitter.cpp
+++ b/utils/TableGen/AsmWriterEmitter.cpp
@@ -243,12 +243,15 @@ void AsmWriterEmitter::EmitPrintInstruction(raw_ostream &O) {
CodeGenTarget Target;
Record *AsmWriter = Target.getAsmWriter();
std::string ClassName = AsmWriter->getValueAsString("AsmWriterClassName");
+ bool isMC = AsmWriter->getValueAsBit("isMCAsmWriter");
+ const char *MachineInstrClassName = isMC ? "MCInst" : "MachineInstr";
O <<
"/// printInstruction - This method is automatically generated by tablegen\n"
"/// from the instruction set description.\n"
"void " << Target.getName() << ClassName
- << "::printInstruction(const MachineInstr *MI, raw_ostream &O) {\n";
+ << "::printInstruction(const " << MachineInstrClassName
+ << " *MI, raw_ostream &O) {\n";
std::vector<AsmWriterInst> Instructions;