mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 00:24:26 +00:00
Finally eliminate printMCInst and send instructions through
the streamer. Demo: $ cat t.ll define i32 @test() nounwind { ret i32 42 } $ llc t.ll -o - ... _test: movl $42, %eax ret $ llc t.ll -o t.o -filetype=obj $ otool -tv t.o t.o: (__TEXT,__text) section _test: 00000000 movl $0x0000002a,%eax 00000005 ret git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95179 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -45,13 +45,6 @@ using namespace llvm;
|
|||||||
// Primitive Helper Functions.
|
// Primitive Helper Functions.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
void X86AsmPrinter::printMCInst(const MCInst *MI) {
|
|
||||||
if (MAI->getAssemblerDialect() == 0)
|
|
||||||
X86ATTInstPrinter(O, *MAI).printInstruction(MI);
|
|
||||||
else
|
|
||||||
X86IntelInstPrinter(O, *MAI).printInstruction(MI);
|
|
||||||
}
|
|
||||||
|
|
||||||
void X86AsmPrinter::PrintPICBaseSymbol() const {
|
void X86AsmPrinter::PrintPICBaseSymbol() const {
|
||||||
const TargetLowering *TLI = TM.getTargetLowering();
|
const TargetLowering *TLI = TM.getTargetLowering();
|
||||||
O << *static_cast<const X86TargetLowering*>(TLI)->getPICBaseSymbol(MF,
|
O << *static_cast<const X86TargetLowering*>(TLI)->getPICBaseSymbol(MF,
|
||||||
|
@ -60,8 +60,6 @@ class VISIBILITY_HIDDEN X86AsmPrinter : public AsmPrinter {
|
|||||||
|
|
||||||
virtual void EmitInstruction(const MachineInstr *MI);
|
virtual void EmitInstruction(const MachineInstr *MI);
|
||||||
|
|
||||||
void printMCInst(const MCInst *MI);
|
|
||||||
|
|
||||||
void printSymbolOperand(const MachineOperand &MO);
|
void printSymbolOperand(const MachineOperand &MO);
|
||||||
|
|
||||||
|
|
||||||
|
@ -466,8 +466,7 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
// lot of extra uniquing.
|
// lot of extra uniquing.
|
||||||
TmpInst.addOperand(MCOperand::CreateExpr(MCSymbolRefExpr::Create(PICBase,
|
TmpInst.addOperand(MCOperand::CreateExpr(MCSymbolRefExpr::Create(PICBase,
|
||||||
OutContext)));
|
OutContext)));
|
||||||
printMCInst(&TmpInst);
|
OutStreamer.EmitInstruction(TmpInst);
|
||||||
O << '\n';
|
|
||||||
|
|
||||||
// Emit the label.
|
// Emit the label.
|
||||||
OutStreamer.EmitLabel(PICBase);
|
OutStreamer.EmitLabel(PICBase);
|
||||||
@ -475,8 +474,7 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
// popl $reg
|
// popl $reg
|
||||||
TmpInst.setOpcode(X86::POP32r);
|
TmpInst.setOpcode(X86::POP32r);
|
||||||
TmpInst.getOperand(0) = MCOperand::CreateReg(MI->getOperand(0).getReg());
|
TmpInst.getOperand(0) = MCOperand::CreateReg(MI->getOperand(0).getReg());
|
||||||
printMCInst(&TmpInst);
|
OutStreamer.EmitInstruction(TmpInst);
|
||||||
O << '\n';
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,8 +511,7 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
TmpInst.addOperand(MCOperand::CreateReg(MI->getOperand(0).getReg()));
|
TmpInst.addOperand(MCOperand::CreateReg(MI->getOperand(0).getReg()));
|
||||||
TmpInst.addOperand(MCOperand::CreateReg(MI->getOperand(1).getReg()));
|
TmpInst.addOperand(MCOperand::CreateReg(MI->getOperand(1).getReg()));
|
||||||
TmpInst.addOperand(MCOperand::CreateExpr(DotExpr));
|
TmpInst.addOperand(MCOperand::CreateExpr(DotExpr));
|
||||||
printMCInst(&TmpInst);
|
OutStreamer.EmitInstruction(TmpInst);
|
||||||
O << '\n';
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -523,7 +520,6 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
MCInstLowering.Lower(MI, TmpInst);
|
MCInstLowering.Lower(MI, TmpInst);
|
||||||
|
|
||||||
|
|
||||||
printMCInst(&TmpInst);
|
OutStreamer.EmitInstruction(TmpInst);
|
||||||
O << '\n';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user