[llvm-commits] [llvm] r76991 - /llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

Evan Cheng evan.cheng at apple.com
Fri Jul 24 11:54:23 PDT 2009


Author: evancheng
Date: Fri Jul 24 13:54:23 2009
New Revision: 76991

URL: http://llvm.org/viewvc/llvm-project?rev=76991&view=rev
Log:
Add a workaround for Darwin assembler bug where it's not setting the thumb bit in Thumb2 jumptable entries. We now pass Olden.

Modified:
    llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=76991&r1=76990&r2=76991&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Fri Jul 24 13:54:23 2009
@@ -922,11 +922,23 @@
   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 @@
         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';





More information about the llvm-commits mailing list