mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-29 22:50:47 +00:00
factor MBB label lowering better
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81630 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e9434dbff4
commit
d8d2050637
@ -45,13 +45,12 @@ MCSymbol *X86MCInstLower::GetPICBaseSymbol() const {
|
||||
return Ctx.GetOrCreateSymbol(Name.str());
|
||||
}
|
||||
|
||||
MCOperand X86MCInstLower::LowerMBBOperand(const MachineOperand &MO) const {
|
||||
MCSymbol *X86MCInstLower::GetMBBSymbol(unsigned MBBID) const {
|
||||
SmallString<60> Name;
|
||||
raw_svector_ostream(Name) << AsmPrinter.MAI->getPrivateGlobalPrefix() << "BB"
|
||||
<< AsmPrinter.getFunctionNumber() << '_' << MO.getMBB()->getNumber();
|
||||
<< AsmPrinter.getFunctionNumber() << '_' << MBBID;
|
||||
|
||||
MCSymbol *Sym = Ctx.GetOrCreateSymbol(Name.str());
|
||||
return MCOperand::CreateExpr(MCSymbolRefExpr::Create(Sym, Ctx));
|
||||
return Ctx.GetOrCreateSymbol(Name.str());
|
||||
}
|
||||
|
||||
|
||||
@ -320,7 +319,8 @@ void X86MCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
|
||||
MCOp = MCOperand::CreateImm(MO.getImm());
|
||||
break;
|
||||
case MachineOperand::MO_MachineBasicBlock:
|
||||
MCOp = LowerMBBOperand(MO);
|
||||
MCOp = MCOperand::CreateExpr(MCSymbolRefExpr::Create(
|
||||
GetMBBSymbol(MO.getMBB()->getNumber()), Ctx));
|
||||
break;
|
||||
case MachineOperand::MO_GlobalAddress:
|
||||
MCOp = LowerSymbolOperand(MO, GetGlobalAddressSymbol(MO));
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
|
||||
MCSymbol *GetPICBaseSymbol() const;
|
||||
|
||||
MCOperand LowerMBBOperand(const MachineOperand &MO) const;
|
||||
MCSymbol *GetMBBSymbol(unsigned MBBID) const;
|
||||
MCSymbol *GetGlobalAddressSymbol(const MachineOperand &MO) const;
|
||||
MCSymbol *GetExternalSymbolSymbol(const MachineOperand &MO) const;
|
||||
MCSymbol *GetJumpTableSymbol(const MachineOperand &MO) const;
|
||||
|
Loading…
Reference in New Issue
Block a user