[llvm-commits] [llvm] r94585 - in /llvm/trunk: include/llvm/MC/ lib/CodeGen/AsmPrinter/ lib/MC/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/ lib/Target/Blackfin/ lib/Target/CellSPU/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/SystemZ/ lib/Target/X86/ lib/Target/XCore/ lib/Target/XCore/AsmPrinter/

Chris Lattner sabre at nondot.org
Tue Jan 26 12:40:54 PST 2010


Author: lattner
Date: Tue Jan 26 14:40:54 2010
New Revision: 94585

URL: http://llvm.org/viewvc/llvm-project?rev=94585&view=rev
Log:
Eliminate SetDirective, and replace it with HasSetDirective.
Default HasSetDirective to true, since most targets have it.

The targets that claim to not have it probably do, or it is
spelled differently. These include Blackfin, Mips, Alpha, and
PIC16.  All of these except pic16 are normal ELF targets, so
they almost certainly have it.


Modified:
    llvm/trunk/include/llvm/MC/MCAsmInfo.h
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
    llvm/trunk/lib/MC/MCAsmInfo.cpp
    llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp
    llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp
    llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp
    llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
    llvm/trunk/lib/Target/Alpha/AlphaMCAsmInfo.cpp
    llvm/trunk/lib/Target/Blackfin/BlackfinMCAsmInfo.cpp
    llvm/trunk/lib/Target/CellSPU/SPUMCAsmInfo.cpp
    llvm/trunk/lib/Target/MSP430/MSP430MCAsmInfo.cpp
    llvm/trunk/lib/Target/Mips/MipsMCAsmInfo.cpp
    llvm/trunk/lib/Target/PIC16/PIC16MCAsmInfo.cpp
    llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp
    llvm/trunk/lib/Target/Sparc/SparcMCAsmInfo.cpp
    llvm/trunk/lib/Target/SystemZ/SystemZMCAsmInfo.cpp
    llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp
    llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp
    llvm/trunk/lib/Target/XCore/XCoreMCAsmInfo.cpp

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

==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Tue Jan 26 14:40:54 2010
@@ -173,13 +173,12 @@
     ///
     const char *ExternDirective;             // Defaults to NULL.
     
-    /// SetDirective - This is the name of a directive that can be used to tell
-    /// the assembler to set the value of a variable to some expression.
-    const char *SetDirective;                // Defaults to null.
+    /// HasSetDirective - True if the assembler supports the .set directive.
+    bool HasSetDirective;                    // Defaults to true.
     
     /// HasLCOMMDirective - This is true if the target supports the .lcomm
     /// directive.
-    bool HasLCOMMDirective;              // Defaults to false.
+    bool HasLCOMMDirective;                  // Defaults to false.
     
     /// COMMDirectiveAlignmentIsInBytes - True is COMMDirective's optional
     /// alignment is to be specified in bytes instead of log2(n).
@@ -377,9 +376,7 @@
     const char *getExternDirective() const {
       return ExternDirective;
     }
-    const char *getSetDirective() const {
-      return SetDirective;
-    }
+    bool hasSetDirective() const { return HasSetDirective; }
     bool hasLCOMMDirective() const { return HasLCOMMDirective; }
     bool hasDotTypeDotSizeDirective() const {return HasDotTypeDotSizeDirective;}
     bool getCOMMDirectiveAlignmentIsInBytes() const {

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

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Jan 26 14:40:54 2010
@@ -318,7 +318,7 @@
     }
   }
 
-  if (MAI->getSetDirective()) {
+  if (MAI->hasSetDirective()) {
     OutStreamer.AddBlankLine();
     for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end();
          I != E; ++I) {
@@ -336,7 +336,7 @@
 
       printVisibility(Name, I->getVisibility());
 
-      O << MAI->getSetDirective() << ' ' << *Name << ", " << *Target << '\n';
+      O << "\t.set\t" << *Name << ", " << *Target << '\n';
     }
   }
 
@@ -516,7 +516,7 @@
     // .set directive for each unique entry.  This reduces the number of
     // relocations the assembler will generate for the jump table.
     if (MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32 &&
-        MAI->getSetDirective()) {
+        MAI->hasSetDirective()) {
       SmallPtrSet<const MachineBasicBlock*, 16> EmittedSets;
       const TargetLowering *TLI = TM.getTargetLowering();
       const MCExpr *Base = TLI->getPICJumpTableRelocBaseExpr(&MF, JTI,
@@ -525,7 +525,7 @@
         const MachineBasicBlock *MBB = JTBBs[ii];
         if (!EmittedSets.insert(MBB)) continue;
         
-        O << MAI->getSetDirective() << ' '
+        O << "\t.set\t"
           << *GetJTSetSymbol(JTI, MBB->getNumber()) << ','
           << *MBB->getSymbol(OutContext) << '-' << *Base << '\n';
       }
@@ -584,7 +584,7 @@
     // If we have emitted set directives for the jump table entries, print 
     // them rather than the entries themselves.  If we're emitting PIC, then
     // emit the table entries as differences between two text section labels.
-    if (MAI->getSetDirective()) {
+    if (MAI->hasSetDirective()) {
       // If we used .set, reference the .set's symbol.
       Value = MCSymbolRefExpr::Create(GetJTSetSymbol(UID, MBB->getNumber()),
                                       OutContext);

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

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Tue Jan 26 14:40:54 2010
@@ -200,7 +200,7 @@
 void DwarfPrinter::EmitDifference(const char *TagHi, unsigned NumberHi,
                                   const char *TagLo, unsigned NumberLo,
                                   bool IsSmall) {
-  if (MAI->getSetDirective() != 0) {
+  if (MAI->hasSetDirective()) {
     O << "\t.set\t";
     PrintLabelName("set", SetCounter, Flavor);
     O << ",";
@@ -231,7 +231,7 @@
   else
     printAbsolute = MAI->isAbsoluteDebugSectionOffsets();
 
-  if (MAI->getSetDirective() != 0 && useSet) {
+  if (MAI->hasSetDirective() && useSet) {
     O << "\t.set\t";
     PrintLabelName("set", SetCounter, Flavor);
     O << ",";

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

==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfo.cpp Tue Jan 26 14:40:54 2010
@@ -49,7 +49,7 @@
   TextAlignFillValue = 0;
   GPRel32Directive = 0;
   GlobalDirective = "\t.globl\t";
-  SetDirective = 0;
+  HasSetDirective = true;
   HasLCOMMDirective = false;
   COMMDirectiveAlignmentIsInBytes = true;
   HasDotTypeDotSizeDirective = true;

Modified: llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp?rev=94585&r1=94584&r2=94585&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp Tue Jan 26 14:40:54 2010
@@ -25,7 +25,6 @@
   PrivateGlobalPrefix = "L";  // Prefix for private global symbols
   WeakRefDirective = "\t.weak\t";
   LinkOnceDirective = "\t.linkonce same_size\n";
-  SetDirective = "\t.set\t";
   
   // Doesn't support visibility:
   HiddenVisibilityAttr = ProtectedVisibilityAttr = MCSA_Invalid;

Modified: llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp?rev=94585&r1=94584&r2=94585&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp Tue Jan 26 14:40:54 2010
@@ -36,7 +36,6 @@
   ZeroDirective = "\t.space\t";  // ".space N" emits N zeros.
   HasMachoZeroFillDirective = true;  // Uses .zerofill
   HasStaticCtorDtorReferenceInStaticMode = true;
-  SetDirective = "\t.set";
   
   HiddenVisibilityAttr = MCSA_PrivateExtern;
   // Doesn't support protected visibility.

Modified: llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp?rev=94585&r1=94584&r2=94585&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp Tue Jan 26 14:40:54 2010
@@ -62,7 +62,6 @@
   AbsoluteDebugSectionOffsets = true;
   PrivateGlobalPrefix = ".L";
   WeakRefDirective = "\t.weak\t";
-  SetDirective = "\t.set\t";
   HasLCOMMDirective = true;
 
   DwarfRequiresFrameSection = false;

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=94585&r1=94584&r2=94585&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Tue Jan 26 14:40:54 2010
@@ -939,14 +939,14 @@
   const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
   const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
   const std::vector<MachineBasicBlock*> &JTBBs = JT[JTI].MBBs;
-  bool UseSet= MAI->getSetDirective() && TM.getRelocationModel() == Reloc::PIC_;
+  bool UseSet= MAI->hasSetDirective() && TM.getRelocationModel() == Reloc::PIC_;
   SmallPtrSet<MachineBasicBlock*, 8> JTSets;
   for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) {
     MachineBasicBlock *MBB = JTBBs[i];
     bool isNew = JTSets.insert(MBB);
 
     if (UseSet && isNew) {
-      O << MAI->getSetDirective() << ' '
+      O << "\t.set\t"
         << *GetARMSetPICJumpTableLabel2(JTI, MO2.getImm(), MBB) << ','
         << *MBB->getSymbol(OutContext) << '-' << *JTISymbol << '\n';
     }

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

==============================================================================
--- llvm/trunk/lib/Target/Alpha/AlphaMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Alpha/AlphaMCAsmInfo.cpp Tue Jan 26 14:40:54 2010
@@ -19,4 +19,5 @@
   PrivateGlobalPrefix = "$";
   GPRel32Directive = ".gprel32";
   WeakRefDirective = "\t.weak\t";
+  HasSetDirective = false;
 }

Modified: llvm/trunk/lib/Target/Blackfin/BlackfinMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/BlackfinMCAsmInfo.cpp?rev=94585&r1=94584&r2=94585&view=diff

==============================================================================
--- llvm/trunk/lib/Target/Blackfin/BlackfinMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Blackfin/BlackfinMCAsmInfo.cpp Tue Jan 26 14:40:54 2010
@@ -18,4 +18,5 @@
 BlackfinMCAsmInfo::BlackfinMCAsmInfo(const Target &T, const StringRef &TT) {
   GlobalPrefix = "_";
   CommentString = "//";
+  HasSetDirective = false;
 }

Modified: llvm/trunk/lib/Target/CellSPU/SPUMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUMCAsmInfo.cpp?rev=94585&r1=94584&r2=94585&view=diff

==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUMCAsmInfo.cpp Tue Jan 26 14:40:54 2010
@@ -16,7 +16,6 @@
 
 SPULinuxMCAsmInfo::SPULinuxMCAsmInfo(const Target &T, const StringRef &TT) {
   ZeroDirective = "\t.space\t";
-  SetDirective = "\t.set";
   Data64bitsDirective = "\t.quad\t";
   AlignmentIsInBytes = false;
   HasLCOMMDirective = true;

Modified: llvm/trunk/lib/Target/MSP430/MSP430MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430MCAsmInfo.cpp?rev=94585&r1=94584&r2=94585&view=diff

==============================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/MSP430/MSP430MCAsmInfo.cpp Tue Jan 26 14:40:54 2010
@@ -17,7 +17,6 @@
 MSP430MCAsmInfo::MSP430MCAsmInfo(const Target &T, const StringRef &TT) {
   PrivateGlobalPrefix = ".L";
   WeakRefDirective ="\t.weak\t";
-  SetDirective = "\t.set\t";
   PCSymbol=".";
   CommentString = ";";
 

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

==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsMCAsmInfo.cpp Tue Jan 26 14:40:54 2010
@@ -23,4 +23,5 @@
   CommentString               = "#";
   ZeroDirective               = "\t.space\t";
   GPRel32Directive            = "\t.gpword\t";
+  HasSetDirective             = false;
 }

Modified: llvm/trunk/lib/Target/PIC16/PIC16MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16MCAsmInfo.cpp?rev=94585&r1=94584&r2=94585&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16MCAsmInfo.cpp Tue Jan 26 14:40:54 2010
@@ -37,7 +37,7 @@
   RomData8bitsDirective = " dw ";
   RomData16bitsDirective = " rom_di ";
   RomData32bitsDirective = " rom_dl ";
-    
+  HasSetDirective = false;  
     
   // Set it to false because we weed to generate c file name and not bc file
   // name.

Modified: llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp?rev=94585&r1=94584&r2=94585&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCMCAsmInfo.cpp Tue Jan 26 14:40:54 2010
@@ -49,7 +49,6 @@
   AbsoluteEHSectionOffsets = false;
     
   ZeroDirective = "\t.space\t";
-  SetDirective = "\t.set";
   Data64bitsDirective = is64Bit ? "\t.quad\t" : 0;
   HasLCOMMDirective = true;
   AssemblerDialect = 0;           // Old-Style mnemonics.

Modified: llvm/trunk/lib/Target/Sparc/SparcMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcMCAsmInfo.cpp?rev=94585&r1=94584&r2=94585&view=diff

==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/SparcMCAsmInfo.cpp Tue Jan 26 14:40:54 2010
@@ -29,7 +29,6 @@
   UsesELFSectionDirectiveForBSS = true;
 
   WeakRefDirective = "\t.weak\t";
-  SetDirective = "\t.set\t";
 
   PrivateGlobalPrefix = ".L";
 }

Modified: llvm/trunk/lib/Target/SystemZ/SystemZMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZMCAsmInfo.cpp?rev=94585&r1=94584&r2=94585&view=diff

==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZMCAsmInfo.cpp Tue Jan 26 14:40:54 2010
@@ -18,7 +18,6 @@
 SystemZMCAsmInfo::SystemZMCAsmInfo(const Target &T, const StringRef &TT) {
   PrivateGlobalPrefix = ".L";
   WeakRefDirective = "\t.weak\t";
-  SetDirective = "\t.set\t";
   PCSymbol = ".";
 }
 

Modified: llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp?rev=94585&r1=94584&r2=94585&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp Tue Jan 26 14:40:54 2010
@@ -72,7 +72,6 @@
 
   PrivateGlobalPrefix = ".L";
   WeakRefDirective = "\t.weak\t";
-  SetDirective = "\t.set\t";
   PCSymbol = ".";
 
   // Set up DWARF directives

Modified: llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp?rev=94585&r1=94584&r2=94585&view=diff

==============================================================================
--- llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp Tue Jan 26 14:40:54 2010
@@ -106,7 +106,7 @@
     cast<PointerType>(GV->getType())->getElementType())) {
     O << MAI->getGlobalDirective() << *Sym;
     O << ".globound" << "\n";
-    O << MAI->getSetDirective() << *Sym;
+    O << "\t.set\t" << *Sym;
     O << ".globound" << "," << ATy->getNumElements() << "\n";
     if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()) {
       // TODO Use COMDAT groups for LinkOnceLinkage

Modified: llvm/trunk/lib/Target/XCore/XCoreMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreMCAsmInfo.cpp?rev=94585&r1=94584&r2=94585&view=diff

==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreMCAsmInfo.cpp Tue Jan 26 14:40:54 2010
@@ -22,7 +22,6 @@
   AscizDirective = ".asciiz";
   WeakDefDirective = "\t.weak\t";
   WeakRefDirective = "\t.weak\t";
-  SetDirective = "\t.set\t";
 
   // Debug
   HasLEB128 = true;





More information about the llvm-commits mailing list