diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2006-09-24 19:45:58 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2006-09-24 19:45:58 +0000 |
commit | 783a4a9d86565b5993efbb86c401097579d04369 (patch) | |
tree | 9f0461e03ea430e222d0ed78a149fa87c003f87e /llvm/lib/CodeGen/AsmPrinter.cpp | |
parent | 3cec4952ab21ffe32c3b0629c2fbe80064d75c8a (diff) | |
download | bcm5719-llvm-783a4a9d86565b5993efbb86c401097579d04369.tar.gz bcm5719-llvm-783a4a9d86565b5993efbb86c401097579d04369.zip |
Add support for other relocation bases to jump tables, as well as custom asm directives
llvm-svn: 30593
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp index f6b4bfcbfe3..bcdb393c239 100644 --- a/llvm/lib/CodeGen/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter.cpp @@ -187,7 +187,10 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI) { // JTEntryDirective is a string to print sizeof(ptr) for non-PIC jump tables, // and 32 bits for PIC since PIC jump table entries are differences, not // pointers to blocks. - const char *JTEntryDirective = TAI->getData32bitsDirective(); + // Use the architecture specific relocation directive, if it is set + const char *JTEntryDirective = TAI->getJumpTableDirective(); + if (!JTEntryDirective) + JTEntryDirective = TAI->getData32bitsDirective(); // Pick the directive to use to print the jump table entries, and switch to // the appropriate section. @@ -227,8 +230,10 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI) { << '_' << i << "_set_" << JTBBs[ii]->getNumber(); } else if (TM.getRelocationModel() == Reloc::PIC_) { printBasicBlockLabel(JTBBs[ii], false, false); - O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" - << getFunctionNumber() << '_' << i; + //If the arch uses custom Jump Table directives, don't calc relative to JT + if (!TAI->getJumpTableDirective()) + O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" + << getFunctionNumber() << '_' << i; } else { printBasicBlockLabel(JTBBs[ii], false, false); } |