rename printPICJumpTableEntry -> EmitJumpTableEntry,

make it private and non-virtual.  It handles the non-pic
case too, so just use it, simplifying EmitJumpTableInfo.

llvm-svn: 94517
This commit is contained in:
Chris Lattner 2010-01-26 05:10:10 +00:00
parent 4bfbe93437
commit 279de3ef64
2 changed files with 13 additions and 22 deletions

View File

@ -352,9 +352,6 @@ namespace llvm {
/// specified MachineBasicBlock for a jumptable entry. /// specified MachineBasicBlock for a jumptable entry.
virtual void printPICJumpTableSetLabel(unsigned uid, virtual void printPICJumpTableSetLabel(unsigned uid,
const MachineBasicBlock *MBB) const; const MachineBasicBlock *MBB) const;
virtual void printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
const MachineBasicBlock *MBB,
unsigned uid) const;
/// printVisibility - This prints visibility information about symbol, if /// printVisibility - This prints visibility information about symbol, if
/// this is suported by the target. /// this is suported by the target.
@ -364,6 +361,9 @@ namespace llvm {
void printOffset(int64_t Offset) const; void printOffset(int64_t Offset) const;
private: private:
void EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
const MachineBasicBlock *MBB,
unsigned uid) const;
void EmitLLVMUsedList(Constant *List); void EmitLLVMUsedList(Constant *List);
void EmitXXStructorList(Constant *List); void EmitXXStructorList(Constant *List);
GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C); GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy *C);

View File

@ -503,7 +503,6 @@ void AsmPrinter::EmitJumpTableInfo(MachineFunction &MF) {
JTInDiffSection = true; JTInDiffSection = true;
} }
unsigned EntrySize = MJTI->getEntrySize(*TM.getTargetData());
EmitAlignment(Log2_32(MJTI->getEntryAlignment(*TM.getTargetData()))); EmitAlignment(Log2_32(MJTI->getEntryAlignment(*TM.getTargetData())));
for (unsigned i = 0, e = JT.size(); i != e; ++i) { for (unsigned i = 0, e = JT.size(); i != e; ++i) {
@ -530,28 +529,20 @@ void AsmPrinter::EmitJumpTableInfo(MachineFunction &MF) {
OutStreamer.EmitLabel(GetJTISymbol(i)); OutStreamer.EmitLabel(GetJTISymbol(i));
if (!IsPic) { for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii)
// In non-pic mode, the entries in the jump table are direct references EmitJumpTableEntry(MJTI, JTBBs[ii], i);
// to the basic blocks.
for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) {
MCSymbol *MBBSym = JTBBs[ii]->getSymbol(OutContext);
OutStreamer.EmitValue(MCSymbolRefExpr::Create(MBBSym, OutContext),
EntrySize, /*addrspace*/0);
}
} else {
for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii)
printPICJumpTableEntry(MJTI, JTBBs[ii], i);
}
} }
} }
void AsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI, /// EmitJumpTableEntry - Emit a jump table entry for the specified MBB to the
const MachineBasicBlock *MBB, /// current stream.
unsigned uid) const { void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
const MachineBasicBlock *MBB,
unsigned UID) const {
const MCExpr *Value = 0; const MCExpr *Value = 0;
switch (MJTI->getEntryKind()) { switch (MJTI->getEntryKind()) {
case MachineJumpTableInfo::EK_Custom32: case MachineJumpTableInfo::EK_Custom32:
Value = TM.getTargetLowering()->LowerCustomJumpTableEntry(MJTI, MBB, uid, Value = TM.getTargetLowering()->LowerCustomJumpTableEntry(MJTI, MBB, UID,
OutContext); OutContext);
break; break;
case MachineJumpTableInfo::EK_BlockAddress: case MachineJumpTableInfo::EK_BlockAddress:
@ -582,13 +573,13 @@ void AsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
// emit the table entries as differences between two text section labels. // emit the table entries as differences between two text section labels.
if (MAI->getSetDirective()) { if (MAI->getSetDirective()) {
// If we used .set, reference the .set's symbol. // If we used .set, reference the .set's symbol.
Value = MCSymbolRefExpr::Create(GetJTSetSymbol(uid, MBB->getNumber()), Value = MCSymbolRefExpr::Create(GetJTSetSymbol(UID, MBB->getNumber()),
OutContext); OutContext);
break; break;
} }
// Otherwise, use the difference as the jump table entry. // Otherwise, use the difference as the jump table entry.
Value = MCSymbolRefExpr::Create(MBB->getSymbol(OutContext), OutContext); Value = MCSymbolRefExpr::Create(MBB->getSymbol(OutContext), OutContext);
const MCExpr *JTI = MCSymbolRefExpr::Create(GetJTISymbol(uid), OutContext); const MCExpr *JTI = MCSymbolRefExpr::Create(GetJTISymbol(UID), OutContext);
Value = MCBinaryExpr::CreateSub(Value, JTI, OutContext); Value = MCBinaryExpr::CreateSub(Value, JTI, OutContext);
break; break;
} }