summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/AsmWriterEmitter.cpp
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
commit4a57b76eea99aa112c42595a49f17ef69b75ca79 (patch)
tree4251c25181b32654334a96ecd58bdd631624b56e /llvm/utils/TableGen/AsmWriterEmitter.cpp
parent832d2333a5e087649464ac7f61194feed10b2135 (diff)
downloadbcm5719-llvm-4a57b76eea99aa112c42595a49f17ef69b75ca79.tar.gz
bcm5719-llvm-4a57b76eea99aa112c42595a49f17ef69b75ca79.zip
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. llvm-svn: 115126
Diffstat (limited to 'llvm/utils/TableGen/AsmWriterEmitter.cpp')
-rw-r--r--llvm/utils/TableGen/AsmWriterEmitter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp
index 6ae0b39c8dd..1bca6607449 100644
--- a/llvm/utils/TableGen/AsmWriterEmitter.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud