[llvm-commits] [llvm] r81630 - in /llvm/trunk/lib/Target/X86/AsmPrinter: X86MCInstLower.cpp X86MCInstLower.h
Chris Lattner
sabre at nondot.org
Sat Sep 12 14:06:08 PDT 2009
Author: lattner
Date: Sat Sep 12 16:06:08 2009
New Revision: 81630
URL: http://llvm.org/viewvc/llvm-project?rev=81630&view=rev
Log:
factor MBB label lowering better
Modified:
llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=81630&r1=81629&r2=81630&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Sat Sep 12 16:06:08 2009
@@ -45,13 +45,12 @@
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 @@
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));
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h?rev=81630&r1=81629&r2=81630&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.h Sat Sep 12 16:06:08 2009
@@ -36,7 +36,7 @@
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;
More information about the llvm-commits
mailing list