mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
X86MCInstLower now depends on AsmPrinter being around.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109154 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
456fdaf0ce
commit
0123c1da35
@ -29,7 +29,7 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
X86MCInstLower::X86MCInstLower(Mangler *mang, const MachineFunction &mf,
|
X86MCInstLower::X86MCInstLower(Mangler *mang, const MachineFunction &mf,
|
||||||
X86AsmPrinter *asmprinter)
|
X86AsmPrinter &asmprinter)
|
||||||
: Ctx(mf.getContext()), Mang(mang), MF(mf), TM(mf.getTarget()),
|
: Ctx(mf.getContext()), Mang(mang), MF(mf), TM(mf.getTarget()),
|
||||||
MAI(*TM.getMCAsmInfo()), AsmPrinter(asmprinter) {}
|
MAI(*TM.getMCAsmInfo()), AsmPrinter(asmprinter) {}
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ MCOperand X86MCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
|||||||
// local labels. This is only safe when the symbols are in the same
|
// local labels. This is only safe when the symbols are in the same
|
||||||
// section so we are restricting it to jumptable references.
|
// section so we are restricting it to jumptable references.
|
||||||
MCSymbol *Label = Ctx.CreateTempSymbol();
|
MCSymbol *Label = Ctx.CreateTempSymbol();
|
||||||
AsmPrinter->OutStreamer.EmitAssignment(Label, Expr);
|
AsmPrinter.OutStreamer.EmitAssignment(Label, Expr);
|
||||||
Expr = MCSymbolRefExpr::Create(Label, Ctx);
|
Expr = MCSymbolRefExpr::Create(Label, Ctx);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -320,38 +320,20 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
|
|||||||
MO.getMBB()->getSymbol(), Ctx));
|
MO.getMBB()->getSymbol(), Ctx));
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_GlobalAddress:
|
case MachineOperand::MO_GlobalAddress:
|
||||||
// If we don't have an asmprinter, we're converting to MCInst to get
|
MCOp = LowerSymbolOperand(MO, GetSymbolFromOperand(MO));
|
||||||
// instruction sizes, which doesn't need precise value information for
|
|
||||||
// symbols, just lower to a 0 immediate.
|
|
||||||
if (AsmPrinter != 0)
|
|
||||||
MCOp = LowerSymbolOperand(MO, GetSymbolFromOperand(MO));
|
|
||||||
else
|
|
||||||
MCOp = MCOperand::CreateImm(0);
|
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_ExternalSymbol:
|
case MachineOperand::MO_ExternalSymbol:
|
||||||
if (AsmPrinter != 0)
|
MCOp = LowerSymbolOperand(MO, GetSymbolFromOperand(MO));
|
||||||
MCOp = LowerSymbolOperand(MO, GetSymbolFromOperand(MO));
|
|
||||||
else
|
|
||||||
MCOp = MCOperand::CreateImm(0);
|
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_JumpTableIndex:
|
case MachineOperand::MO_JumpTableIndex:
|
||||||
if (AsmPrinter != 0)
|
MCOp = LowerSymbolOperand(MO, AsmPrinter.GetJTISymbol(MO.getIndex()));
|
||||||
MCOp = LowerSymbolOperand(MO, AsmPrinter->GetJTISymbol(MO.getIndex()));
|
|
||||||
else
|
|
||||||
MCOp = MCOperand::CreateImm(0);
|
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_ConstantPoolIndex:
|
case MachineOperand::MO_ConstantPoolIndex:
|
||||||
if (AsmPrinter != 0)
|
MCOp = LowerSymbolOperand(MO, AsmPrinter.GetCPISymbol(MO.getIndex()));
|
||||||
MCOp = LowerSymbolOperand(MO, AsmPrinter->GetCPISymbol(MO.getIndex()));
|
|
||||||
else
|
|
||||||
MCOp = MCOperand::CreateImm(0);
|
|
||||||
break;
|
break;
|
||||||
case MachineOperand::MO_BlockAddress:
|
case MachineOperand::MO_BlockAddress:
|
||||||
if (AsmPrinter != 0)
|
MCOp = LowerSymbolOperand(MO,
|
||||||
MCOp = LowerSymbolOperand(MO,
|
AsmPrinter.GetBlockAddressSymbol(MO.getBlockAddress()));
|
||||||
AsmPrinter->GetBlockAddressSymbol(MO.getBlockAddress()));
|
|
||||||
else
|
|
||||||
MCOp = MCOperand::CreateImm(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,7 +504,7 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
|
|||||||
|
|
||||||
|
|
||||||
void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||||
X86MCInstLower MCInstLowering(Mang, *MF, this);
|
X86MCInstLower MCInstLowering(Mang, *MF, *this);
|
||||||
switch (MI->getOpcode()) {
|
switch (MI->getOpcode()) {
|
||||||
case TargetOpcode::DBG_VALUE:
|
case TargetOpcode::DBG_VALUE:
|
||||||
if (isVerbose() && OutStreamer.hasRawTextSupport()) {
|
if (isVerbose() && OutStreamer.hasRawTextSupport()) {
|
||||||
|
@ -33,13 +33,10 @@ class LLVM_LIBRARY_VISIBILITY X86MCInstLower {
|
|||||||
const MachineFunction &MF;
|
const MachineFunction &MF;
|
||||||
const TargetMachine &TM;
|
const TargetMachine &TM;
|
||||||
const MCAsmInfo &MAI;
|
const MCAsmInfo &MAI;
|
||||||
|
X86AsmPrinter &AsmPrinter;
|
||||||
/// AsmPrinter - This is the asmprinter when emission is actually happening,
|
|
||||||
/// or null if an instruction is being lowered for some other reason.
|
|
||||||
X86AsmPrinter *AsmPrinter;
|
|
||||||
public:
|
public:
|
||||||
X86MCInstLower(Mangler *mang, const MachineFunction &MF,
|
X86MCInstLower(Mangler *mang, const MachineFunction &MF,
|
||||||
X86AsmPrinter *asmprinter);
|
X86AsmPrinter &asmprinter);
|
||||||
|
|
||||||
void Lower(const MachineInstr *MI, MCInst &OutMI) const;
|
void Lower(const MachineInstr *MI, MCInst &OutMI) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user