[llvm-commits] [llvm] r78709 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp lib/Target/Alpha/AlphaTargetAsmInfo.cpp lib/Target/Mips/MipsTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp

Chris Lattner sabre at nondot.org
Tue Aug 11 13:30:58 PDT 2009


Author: lattner
Date: Tue Aug 11 15:30:58 2009
New Revision: 78709

URL: http://llvm.org/viewvc/llvm-project?rev=78709&view=rev
Log:
split "JumpTableDirective" (an existing hack) into a PIC and nonPIC
version.  This allows TAI implementations to specify the directive to use
based on the mode being codegen'd for.

The real fix for this is to remove JumpTableDirective, but I don't feel
like diving into the jumptable snarl just now.

Modified:
    llvm/trunk/include/llvm/Target/TargetAsmInfo.h
    llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
    llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp
    llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp
    llvm/trunk/lib/Target/TargetAsmInfo.cpp

Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=78709&r1=78708&r2=78709&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Tue Aug 11 15:30:58 2009
@@ -184,9 +184,11 @@
 
     //===--- Section Switching Directives ---------------------------------===//
     
-    /// JumpTableDirective - if non-null, the directive to emit before a jump
-    /// table.
+    /// JumpTableDirective - if non-null, the directive to emit before jump
+    /// table entries.  FIXME: REMOVE THIS.
     const char *JumpTableDirective;
+    const char *PICJumpTableDirective;
+
 
     //===--- Global Variable Emission Directives --------------------------===//
     
@@ -418,8 +420,8 @@
     const char *getAscizDirective() const {
       return AscizDirective;
     }
-    const char *getJumpTableDirective() const {
-      return JumpTableDirective;
+    const char *getJumpTableDirective(bool isPIC) const {
+      return isPIC ? PICJumpTableDirective : JumpTableDirective;
     }
     const char *getAlignDirective() const {
       return AlignDirective;

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=78709&r1=78708&r2=78709&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Aug 11 15:30:58 2009
@@ -923,9 +923,7 @@
   O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
     << '_' << JTI << '_' << MO2.getImm() << ":\n";
 
-  const char *JTEntryDirective = TAI->getJumpTableDirective();
-  if (!JTEntryDirective)
-    JTEntryDirective = TAI->getData32bitsDirective();
+  const char *JTEntryDirective = TAI->getData32bitsDirective();
 
   const MachineFunction *MF = MI->getParent()->getParent();
   const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
@@ -947,10 +945,8 @@
         << "_set_" << MBB->getNumber();
     else if (TM.getRelocationModel() == Reloc::PIC_) {
       printBasicBlockLabel(MBB, false, false, false);
-      // If the arch uses custom Jump Table directives, don't calc relative to JT
-      if (!TAI->getJumpTableDirective()) 
-        O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
-          << getFunctionNumber() << '_' << JTI << '_' << MO2.getImm();
+      O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
+        << getFunctionNumber() << '_' << JTI << '_' << MO2.getImm();
     } else {
       printBasicBlockLabel(MBB, false, false, false);
     }

Modified: llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp?rev=78709&r1=78708&r2=78709&view=diff

==============================================================================
--- llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Alpha/AlphaTargetAsmInfo.cpp Tue Aug 11 15:30:58 2009
@@ -17,6 +17,6 @@
 AlphaTargetAsmInfo::AlphaTargetAsmInfo() {
   AlignmentIsInBytes = false;
   PrivateGlobalPrefix = "$";
-  JumpTableDirective = ".gprel32";
+  PICJumpTableDirective = ".gprel32";
   WeakRefDirective = "\t.weak\t";
 }

Modified: llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp?rev=78709&r1=78708&r2=78709&view=diff

==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Tue Aug 11 15:30:58 2009
@@ -24,7 +24,5 @@
   PrivateGlobalPrefix         = "$";
   CommentString               = "#";
   ZeroDirective               = "\t.space\t";
-
-  if (TM.getRelocationModel() == Reloc::PIC_)
-    JumpTableDirective = "\t.gpword\t";
+  PICJumpTableDirective       = "\t.gpword\t";
 }

Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=78709&r1=78708&r2=78709&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Tue Aug 11 15:30:58 2009
@@ -54,6 +54,7 @@
   AlignmentIsInBytes = true;
   TextAlignFillValue = 0;
   JumpTableDirective = 0;
+  PICJumpTableDirective = 0;
   GlobalDirective = "\t.globl\t";
   SetDirective = 0;
   LCOMMDirective = 0;





More information about the llvm-commits mailing list