summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-07-24 18:54:23 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-07-24 18:54:23 +0000
commit5a49c5406195be8caa56a6b14b16e83eb7f19e68 (patch)
tree45fab8ef9729f18eaa6e48b1c94e796285db4b2e
parent73f665143992e7bfbbce08cb30fd12e3916567f7 (diff)
downloadbcm5719-llvm-5a49c5406195be8caa56a6b14b16e83eb7f19e68.tar.gz
bcm5719-llvm-5a49c5406195be8caa56a6b14b16e83eb7f19e68.zip
Add a workaround for Darwin assembler bug where it's not setting the thumb bit in Thumb2 jumptable entries. We now pass Olden.
llvm-svn: 76991
-rw-r--r--llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
index 43f33602a14..4d21d5cfd90 100644
--- a/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
+++ b/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
@@ -922,11 +922,23 @@ void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) {
const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
bool UseSet= TAI->getSetDirective() && TM.getRelocationModel() == Reloc::PIC_;
+ bool NeedBit0 = Subtarget->isTargetDarwin() && Subtarget->isThumb2();
SmallPtrSet<MachineBasicBlock*, 8> JTSets;
for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) {
MachineBasicBlock *MBB = JTBBs[i];
- if (UseSet && JTSets.insert(MBB))
- printPICJumpTableSetLabel(JTI, MO2.getImm(), MBB);
+ if (UseSet && JTSets.insert(MBB)) {
+ // FIXME: Temporary workaround for an assembler bug. The assembler isn't
+ // setting the bit zero to 1 even though it is a thumb address.
+ if (NeedBit0) {
+ O << TAI->getSetDirective() << ' ' << TAI->getPrivateGlobalPrefix()
+ << getFunctionNumber() << '_' << JTI << '_' << MO2.getImm()
+ << "_set_" << MBB->getNumber() << ",(";
+ printBasicBlockLabel(MBB, false, false, false);
+ O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
+ << '_' << JTI << '_' << MO2.getImm() << "+1)\n";
+ } else
+ printPICJumpTableSetLabel(JTI, MO2.getImm(), MBB);
+ }
O << JTEntryDirective << ' ';
if (UseSet)
@@ -940,7 +952,13 @@ void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) {
O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
<< getFunctionNumber() << '_' << JTI << '_' << MO2.getImm();
} else {
+ // FIXME: Temporary workaround for an assembler bug. The assembler isn't
+ // setting the bit zero to 1 even though it is a thumb address.
+ if (NeedBit0)
+ O << '(';
printBasicBlockLabel(MBB, false, false, false);
+ if (NeedBit0)
+ O << "+1)";
}
if (i != e-1)
O << '\n';
OpenPOWER on IntegriCloud