mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
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
This commit is contained in:
parent
5e3655cd74
commit
046ae5dbac
@ -565,6 +565,11 @@ class AsmWriter {
|
||||
|
||||
// OperandSpacing - Space between operand columns.
|
||||
int OperandSpacing = -1;
|
||||
|
||||
// isMCAsmWriter - Is this assembly writer for an MC emitter? This controls
|
||||
// generation of the printInstruction() method. For MC printers, it takes
|
||||
// an MCInstr* operand, otherwise it takes a MachineInstr*.
|
||||
bit isMCAsmWriter = 0;
|
||||
}
|
||||
def DefaultAsmWriter : AsmWriter;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user