diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-25 21:01:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-25 21:01:58 +0000 |
commit | 360aeb76a2c0fbec95381494774e61d98e8536fd (patch) | |
tree | 2551e7713844a87a834b1d07eed02d77e92a4b9c /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
parent | ccabcd7f85023b9a0fe3791361307a5e47f77cd8 (diff) | |
download | bcm5719-llvm-360aeb76a2c0fbec95381494774e61d98e8536fd.tar.gz bcm5719-llvm-360aeb76a2c0fbec95381494774e61d98e8536fd.zip |
pull the non-pic jump table case out of printPICJumpTableEntry
and MCize the non-pic case. Now printPICJumpTableEntry really
is just about printing PIC entries.
llvm-svn: 94446
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 39712ded4c2..3077ae371d6 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -524,9 +524,16 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI, OutStreamer.EmitLabel(GetJTISymbol(i)); - for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) { - printPICJumpTableEntry(MJTI, JTBBs[ii], i); - O << '\n'; + if (!IsPic) { + unsigned EntrySize = MJTI->getEntrySize(); + for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) { + MCSymbol *MBBSym = GetMBBSymbol(JTBBs[ii]->getNumber()); + 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); } } } @@ -534,12 +541,9 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI, void AsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI, const MachineBasicBlock *MBB, unsigned uid) const { - bool isPIC = TM.getRelocationModel() == Reloc::PIC_; - // Use JumpTableDirective otherwise honor the entry size from the jump table // info. - const char *JTEntryDirective = 0; - if (isPIC) JTEntryDirective = MAI->getPICJumpTableDirective(); + const char *JTEntryDirective = MAI->getPICJumpTableDirective(); bool HadJTEntryDirective = JTEntryDirective != NULL; if (!HadJTEntryDirective) { JTEntryDirective = MJTI->getEntrySize() == 4 ? @@ -553,9 +557,7 @@ void AsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI, // emit the table entries as differences between two text section labels. // If we're emitting non-PIC code, then emit the entries as direct // references to the target basic blocks. - if (!isPIC) { - O << *GetMBBSymbol(MBB->getNumber()); - } else if (MAI->getSetDirective()) { + if (MAI->getSetDirective()) { O << MAI->getPrivateGlobalPrefix() << getFunctionNumber() << '_' << uid << "_set_" << MBB->getNumber(); } else { @@ -565,6 +567,7 @@ void AsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI, if (!HadJTEntryDirective) O << '-' << *GetJTISymbol(uid); } + O << '\n'; } |