aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-09-12 21:06:08 +0000
committerChris Lattner <sabre@nondot.org>2009-09-12 21:06:08 +0000
commitd8d20506371a11f38bc39dfc5201a61acaa4e0be (patch)
treee5ee3ecbb411401873b05cb678e5d315c2b34891
parente9434dbff40aafcd7e33210f88ff79e0dc7c833d (diff)
factor MBB label lowering better
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81630 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/AsmPrinter/X86MCInstLower.cpp10
-rw-r--r--lib/Target/X86/AsmPrinter/X86MCInstLower.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
index 625be15390..023882ce5d 100644
--- a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
+++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
@@ -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));
diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.h b/lib/Target/X86/AsmPrinter/X86MCInstLower.h
index 2f9691ed09..3329b90cda 100644
--- a/lib/Target/X86/AsmPrinter/X86MCInstLower.h
+++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.h
@@ -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;