rename MAI::PICJumpTableDirective to MAI::GPRel32Directive to
authorChris Lattner <sabre@nondot.org>
Mon, 25 Jan 2010 21:10:10 +0000 (21:10 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 25 Jan 2010 21:10:10 +0000 (21:10 +0000)
make it clear what it is, instead of how it is used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94448 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 8a3ab738100d2503b6ea1ee4826ee652d4023d00..c4f15a09e70e9181d5d848fa7eeedd7083f9f332 100644 (file)
@@ -134,6 +134,11 @@ namespace llvm {
     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 @@ namespace llvm {
     /// 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 @@ namespace llvm {
     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 @@ namespace llvm {
     const char *getAscizDirective() const {
       return AscizDirective;
     }
-    const char *getPICJumpTableDirective() const {
-      return PICJumpTableDirective;
-    }
     const char *getAlignDirective() const {
       return AlignDirective;
     }
index 3077ae371d6a6cdd7c13f8deb538dcf146c64b2c..7a44a01656053fb617fc9b4c2bc59192f5146e79 100644 (file)
@@ -541,15 +541,14 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI,
 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 @@ void AsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI,
     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';
 }
index 0f3c46ba826dfd81fcd559f35495cdf1f0c0cdb8..796dcc4d330a82c1e67b71499a08d1d4410ca24d 100644 (file)
@@ -48,7 +48,7 @@ MCAsmInfo::MCAsmInfo() {
   AlignDirective = "\t.align\t";
   AlignmentIsInBytes = true;
   TextAlignFillValue = 0;
-  PICJumpTableDirective = 0;
+  GPRel32Directive = 0;
   GlobalDirective = "\t.globl\t";
   SetDirective = 0;
   HasLCOMMDirective = false;
index b652a5305a018118842844677bf09e7b858b6d42..0e63582facabb40e1c36ebdf7e9d165dbfd2ade9 100644 (file)
@@ -17,6 +17,6 @@ using namespace llvm;
 AlphaMCAsmInfo::AlphaMCAsmInfo(const Target &T, const StringRef &TT) {
   AlignmentIsInBytes = false;
   PrivateGlobalPrefix = "$";
-  PICJumpTableDirective = ".gprel32";
+  GPRel32Directive = ".gprel32";
   WeakRefDirective = "\t.weak\t";
 }
index 2fa276298e576c8640fd9854a91790c02458817b..c5356f0e23a84b4c1a1724daece87b6258087495 100644 (file)
@@ -22,5 +22,5 @@ MipsMCAsmInfo::MipsMCAsmInfo(const Target &T, const StringRef &TT) {
   PrivateGlobalPrefix         = "$";
   CommentString               = "#";
   ZeroDirective               = "\t.space\t";
-  PICJumpTableDirective       = "\t.gpword\t";
+  GPRel32Directive            = "\t.gpword\t";
 }