From: Evan Cheng Date: Fri, 24 Jul 2009 18:54:23 +0000 (+0000) Subject: Add a workaround for Darwin assembler bug where it's not setting the thumb bit in... X-Git-Tag: android-x86-6.0-r1~1003^2~17907 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=49f846805efe101ae8e6dcff6311cc480072845b;p=android-x86%2Fexternal-llvm.git Add a workaround for Darwin assembler bug where it's not setting the thumb bit in Thumb2 jumptable entries. We now pass Olden. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76991 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index 43f33602a14..4d21d5cfd90 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -922,11 +922,23 @@ void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) { const std::vector &JT = MJTI->getJumpTables(); const std::vector &JTBBs = JT[JTI].MBBs; bool UseSet= TAI->getSetDirective() && TM.getRelocationModel() == Reloc::PIC_; + bool NeedBit0 = Subtarget->isTargetDarwin() && Subtarget->isThumb2(); SmallPtrSet 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';