diff options
Diffstat (limited to 'lib/Target/X86')
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp | 5 | ||||
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86MCInstLower.cpp | 14 | ||||
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86MCInstLower.h | 1 |
3 files changed, 12 insertions, 8 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp index 9841d708d8..2c0b5689ae 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp @@ -58,11 +58,6 @@ void X86ATTAsmPrinter::print_pcrel_imm(const MCInst *MI, unsigned OpNo) { O << Op.getImm(); else if (Op.isExpr()) Op.getExpr()->print(O, MAI); - else if (Op.isMBBLabel()) - // FIXME: Keep in sync with printBasicBlockLabel. printBasicBlockLabel - // should eventually call into this code, not the other way around. - O << MAI->getPrivateGlobalPrefix() << "BB" << Op.getMBBLabelFunction() - << '_' << Op.getMBBLabelBlock(); else llvm_unreachable("Unknown pcrel immediate operand"); } diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp index ed8207415f..9946506441 100644 --- a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp +++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp @@ -45,6 +45,16 @@ MCSymbol *X86MCInstLower::GetPICBaseSymbol() const { return Ctx.GetOrCreateSymbol(Name.str()); } +MCOperand X86MCInstLower::LowerMBBOperand(const MachineOperand &MO) const { + SmallString<60> Name; + raw_svector_ostream(Name) << AsmPrinter.MAI->getPrivateGlobalPrefix() << "BB" + << AsmPrinter.getFunctionNumber() << '_' << MO.getMBB()->getNumber(); + + MCSymbol *Sym = Ctx.GetOrCreateSymbol(Name.str()); + return MCOperand::CreateExpr(MCSymbolRefExpr::Create(Sym, Ctx)); +} + + /// LowerGlobalAddressOperand - Lower an MO_GlobalAddress operand to an /// MCOperand. @@ -331,9 +341,7 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const { MCOp = MCOperand::CreateImm(MO.getImm()); break; case MachineOperand::MO_MachineBasicBlock: -// FIXME: Kill MBBLabel operand type! - MCOp = MCOperand::CreateMBBLabel(AsmPrinter.getFunctionNumber(), - MO.getMBB()->getNumber()); + MCOp = LowerMBBOperand(MO); break; case MachineOperand::MO_GlobalAddress: MCOp = LowerSymbolOperand(MO, GetGlobalAddressSymbol(MO)); diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.h b/lib/Target/X86/AsmPrinter/X86MCInstLower.h index de85755d72..b7b2bb0eb4 100644 --- a/lib/Target/X86/AsmPrinter/X86MCInstLower.h +++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.h @@ -37,6 +37,7 @@ public: private: const X86Subtarget &getSubtarget() const; + MCOperand LowerMBBOperand(const MachineOperand &MO) const; MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const; MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const; MCSymbol *GetJumpTableSymbol(const MachineOperand &MO) const; |