[llvm-commits] [llvm] r94448 - in /llvm/trunk: include/llvm/MC/MCAsmInfo.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/MC/MCAsmInfo.cpp lib/Target/Alpha/AlphaMCAsmInfo.cpp lib/Target/Mips/MipsMCAsmInfo.cpp

Chris Lattner sabre at nondot.org
Mon Jan 25 13:10:10 PST 2010


Author: lattner
Date: Mon Jan 25 15:10:10 2010
New Revision: 94448

URL: http://llvm.org/viewvc/llvm-project?rev=94448&view=rev
Log:
rename MAI::PICJumpTableDirective to MAI::GPRel32Directive to
make it clear what it is, instead of how it is used.

Modified:
    llvm/trunk/include/llvm/MC/MCAsmInfo.h
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/lib/MC/MCAsmInfo.cpp
    llvm/trunk/lib/Target/Alpha/AlphaMCAsmInfo.cpp
    llvm/trunk/lib/Target/Mips/MipsMCAsmInfo.cpp

Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=94448&r1=94447&r2=94448&view=diff

==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Mon Jan 25 15:10:10 2010
@@ -134,6 +134,11 @@
     const char *Data32bitsDirective;         // Defaults to "\t.long\t"
     const char *Data64bitsDirective;         // Defaults to "\t.quad\t"
 
+    /// GPRel32Directive - if non-null, a directive that is used to emit a word
+    /// which should be relocated as a 32-bit GP-relative offset, e.g. .gpword
+    /// on Mips or .gprel32 on Alpha.
+    const char *GPRel32Directive;            // Defaults to NULL.
+    
     /// getDataASDirective - Return the directive that should be used to emit
     /// data of the specified size to the specified numeric address space.
     virtual const char *getDataASDirective(unsigned Size, unsigned AS) const {
@@ -168,13 +173,6 @@
     /// space created as the result of a alignment directive.
     unsigned TextAlignFillValue;             // Defaults to 0
 
-    //===--- Section Switching Directives ---------------------------------===//
-    
-    /// PICJumpTableDirective - if non-null, the directive to emit before jump
-    /// table entries.  FIXME: REMOVE THIS.
-    const char *PICJumpTableDirective;       // Defaults to NULL.
-
-
     //===--- Global Variable Emission Directives --------------------------===//
     
     /// GlobalDirective - This is the directive used to declare a global entity.
@@ -300,6 +298,7 @@
     const char *getData64bitsDirective(unsigned AS = 0) const {
       return AS == 0 ? Data64bitsDirective : getDataASDirective(64, AS);
     }
+    const char *getGPRel32Directive() const { return GPRel32Directive; }
 
     /// getNonexecutableStackSection - Targets can implement this method to
     /// specify a section to switch to if the translation unit doesn't have any
@@ -373,9 +372,6 @@
     const char *getAscizDirective() const {
       return AscizDirective;
     }
-    const char *getPICJumpTableDirective() const {
-      return PICJumpTableDirective;
-    }
     const char *getAlignDirective() const {
       return AlignDirective;
     }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=94448&r1=94447&r2=94448&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Jan 25 15:10:10 2010
@@ -541,15 +541,14 @@
 void AsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
                                         const MachineBasicBlock *MBB,
                                         unsigned uid)  const {
-  // Use JumpTableDirective otherwise honor the entry size from the jump table
-  // info.
-  const char *JTEntryDirective = MAI->getPICJumpTableDirective();
-  bool HadJTEntryDirective = JTEntryDirective != NULL;
-  if (!HadJTEntryDirective) {
-    JTEntryDirective = MJTI->getEntrySize() == 4 ?
-      MAI->getData32bitsDirective() : MAI->getData64bitsDirective();
+  // If the target supports GPRel, use it.
+  if (const char *GPRel32Dir = MAI->getGPRel32Directive()) {
+    O << GPRel32Dir << *GetMBBSymbol(MBB->getNumber()) << '\n';
+    return;
   }
 
+  const char *JTEntryDirective = MJTI->getEntrySize() == 4 ?
+     MAI->getData32bitsDirective() : MAI->getData64bitsDirective();
   O << JTEntryDirective << ' ';
 
   // If we have emitted set directives for the jump table entries, print 
@@ -564,8 +563,7 @@
     O << *GetMBBSymbol(MBB->getNumber());
     // If the arch uses custom Jump Table directives, don't calc relative to
     // JT.
-    if (!HadJTEntryDirective) 
-      O << '-' << *GetJTISymbol(uid);
+    O << '-' << *GetJTISymbol(uid);
   }
   O << '\n';
 }

Modified: llvm/trunk/lib/MC/MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfo.cpp?rev=94448&r1=94447&r2=94448&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfo.cpp Mon Jan 25 15:10:10 2010
@@ -48,7 +48,7 @@
   AlignDirective = "\t.align\t";
   AlignmentIsInBytes = true;
   TextAlignFillValue = 0;
-  PICJumpTableDirective = 0;
+  GPRel32Directive = 0;
   GlobalDirective = "\t.globl\t";
   SetDirective = 0;
   HasLCOMMDirective = false;

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

==============================================================================
--- llvm/trunk/lib/Target/Alpha/AlphaMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Alpha/AlphaMCAsmInfo.cpp Mon Jan 25 15:10:10 2010
@@ -17,6 +17,6 @@
 AlphaMCAsmInfo::AlphaMCAsmInfo(const Target &T, const StringRef &TT) {
   AlignmentIsInBytes = false;
   PrivateGlobalPrefix = "$";
-  PICJumpTableDirective = ".gprel32";
+  GPRel32Directive = ".gprel32";
   WeakRefDirective = "\t.weak\t";
 }

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

==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsMCAsmInfo.cpp Mon Jan 25 15:10:10 2010
@@ -22,5 +22,5 @@
   PrivateGlobalPrefix         = "$";
   CommentString               = "#";
   ZeroDirective               = "\t.space\t";
-  PICJumpTableDirective       = "\t.gpword\t";
+  GPRel32Directive            = "\t.gpword\t";
 }





More information about the llvm-commits mailing list