[llvm-commits] [llvm] r94528 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Chris Lattner
sabre at nondot.org
Mon Jan 25 22:42:45 PST 2010
Author: lattner
Date: Tue Jan 26 00:42:44 2010
New Revision: 94528
URL: http://llvm.org/viewvc/llvm-project?rev=94528&view=rev
Log:
Now that printPICJumpTableSetLabel is not overloaded,
inline it into its only caller, allowing us to simplify it
and hoist bits out of the loop.
Modified:
llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=94528&r1=94527&r2=94528&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Jan 26 00:42:44 2010
@@ -348,11 +348,6 @@
/// printKill - This method prints the specified kill machine instruction.
void printKill(const MachineInstr *MI) const;
- /// printPICJumpTableSetLabel - This method prints a set label for the
- /// specified MachineBasicBlock for a jumptable entry.
- virtual void printPICJumpTableSetLabel(unsigned uid,
- const MachineBasicBlock *MBB) const;
-
/// printVisibility - This prints visibility information about symbol, if
/// this is suported by the target.
void printVisibility(MCSymbol *Sym, unsigned Visibility) const;
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=94528&r1=94527&r2=94528&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Jan 26 00:42:44 2010
@@ -505,8 +505,8 @@
EmitAlignment(Log2_32(MJTI->getEntryAlignment(*TM.getTargetData())));
- for (unsigned i = 0, e = JT.size(); i != e; ++i) {
- const std::vector<MachineBasicBlock*> &JTBBs = JT[i].MBBs;
+ for (unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) {
+ const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
// If this jump table was deleted, ignore it.
if (JTBBs.empty()) continue;
@@ -516,11 +516,19 @@
// relocations the assembler will generate for the jump table.
if (MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32 &&
MAI->getSetDirective()) {
- SmallPtrSet<MachineBasicBlock*, 16> EmittedSets;
- for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii)
- if (EmittedSets.insert(JTBBs[ii]))
- printPICJumpTableSetLabel(i, JTBBs[ii]);
- }
+ SmallPtrSet<const MachineBasicBlock*, 16> EmittedSets;
+ const TargetLowering *TLI = TM.getTargetLowering();
+ const MCExpr *Base = TLI->getPICJumpTableRelocBaseExpr(&MF, JTI,
+ OutContext);
+ for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) {
+ const MachineBasicBlock *MBB = JTBBs[ii];
+ if (!EmittedSets.insert(MBB)) continue;
+
+ O << MAI->getSetDirective() << ' '
+ << *GetJTSetSymbol(JTI, MBB->getNumber()) << ','
+ << *MBB->getSymbol(OutContext) << '-' << *Base << '\n';
+ }
+ }
// On some targets (e.g. Darwin) we want to emit two consequtive labels
// before each jump table. The first label is never referenced, but tells
@@ -529,12 +537,12 @@
if (JTInDiffSection && MAI->getLinkerPrivateGlobalPrefix()[0])
// FIXME: This doesn't have to have any specific name, just any randomly
// named and numbered 'l' label would work. Simplify GetJTISymbol.
- OutStreamer.EmitLabel(GetJTISymbol(i, true));
+ OutStreamer.EmitLabel(GetJTISymbol(JTI, true));
- OutStreamer.EmitLabel(GetJTISymbol(i));
+ OutStreamer.EmitLabel(GetJTISymbol(JTI));
for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii)
- EmitJumpTableEntry(MJTI, JTBBs[ii], i);
+ EmitJumpTableEntry(MJTI, JTBBs[ii], JTI);
}
}
@@ -1542,18 +1550,6 @@
}
}
-/// printPICJumpTableSetLabel - This method prints a set label for the
-/// specified MachineBasicBlock for a jumptable entry.
-void AsmPrinter::printPICJumpTableSetLabel(unsigned uid,
- const MachineBasicBlock *MBB) const {
- const TargetLowering *TLI = TM.getTargetLowering();
- O << MAI->getSetDirective() << ' ' << MAI->getPrivateGlobalPrefix()
- << *GetJTSetSymbol(uid, MBB->getNumber()) << ','
- << *MBB->getSymbol(OutContext) << '-'
- << *TLI->getPICJumpTableRelocBaseExpr(MF, uid, OutContext)
- << '\n';
-}
-
void AsmPrinter::printVisibility(MCSymbol *Sym, unsigned Visibility) const {
MCSymbolAttr Attr = MCSA_Invalid;
More information about the llvm-commits
mailing list