Eliminate SetDirective, and replace it with HasSetDirective.
authorChris Lattner <sabre@nondot.org>
Tue, 26 Jan 2010 20:40:54 +0000 (20:40 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 26 Jan 2010 20:40:54 +0000 (20:40 +0000)
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.

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

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

index 1703a69adbc7c2c3841b7d54e9157e8c1d880f20..633b6019a927445f76608314da3a988479b6e50b 100644 (file)
@@ -173,13 +173,12 @@ namespace llvm {
     ///
     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 @@ namespace llvm {
     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 {
index 42bf35213e3bf1fc40fd858efec58afb6dea985d..d2c1721012a6ef779d1483a8adcd9625eb57abd6 100644 (file)
@@ -318,7 +318,7 @@ bool AsmPrinter::doFinalization(Module &M) {
     }
   }
 
-  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 @@ bool AsmPrinter::doFinalization(Module &M) {
 
       printVisibility(Name, I->getVisibility());
 
-      O << MAI->getSetDirective() << ' ' << *Name << ", " << *Target << '\n';
+      O << "\t.set\t" << *Name << ", " << *Target << '\n';
     }
   }
 
@@ -516,7 +516,7 @@ void AsmPrinter::EmitJumpTableInfo(MachineFunction &MF) {
     // .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 @@ void AsmPrinter::EmitJumpTableInfo(MachineFunction &MF) {
         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 @@ void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI,
     // 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);
index 28e0d97ae71d4a12c986dc4c4d608f162dba4d45..f659c51908b106680dd5c3e369ddefb710df65b8 100644 (file)
@@ -200,7 +200,7 @@ void DwarfPrinter::EmitReference(const MCSymbol *Sym, bool IsPCRelative,
 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 @@ void DwarfPrinter::EmitSectionOffset(const char* Label, const char* Section,
   else
     printAbsolute = MAI->isAbsoluteDebugSectionOffsets();
 
-  if (MAI->getSetDirective() != 0 && useSet) {
+  if (MAI->hasSetDirective() && useSet) {
     O << "\t.set\t";
     PrintLabelName("set", SetCounter, Flavor);
     O << ",";
index 12d2fcbadc6efa9b8765f234d7dcbf40afb58248..74bacfc9d3f290df5f966c164d07ff6dae9e8fb1 100644 (file)
@@ -49,7 +49,7 @@ MCAsmInfo::MCAsmInfo() {
   TextAlignFillValue = 0;
   GPRel32Directive = 0;
   GlobalDirective = "\t.globl\t";
-  SetDirective = 0;
+  HasSetDirective = true;
   HasLCOMMDirective = false;
   COMMDirectiveAlignmentIsInBytes = true;
   HasDotTypeDotSizeDirective = true;
index ab8a585480f1ca7afbb830abb6ce7bf83e05c978..ace7ba1e793db523003b0f02b4c7d94d7b222a7d 100644 (file)
@@ -25,7 +25,6 @@ MCAsmInfoCOFF::MCAsmInfoCOFF() {
   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;
index e84131f5990d2b146f95427ef5d5727347413c09..da865ad9dc7790a8e3d942e2742a23850a7efc79 100644 (file)
@@ -36,7 +36,6 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() {
   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.
index 911a71fbdd86dd196c73cd248204820db59de6a5..ccd6addd82bea01f10b33f5ecd4e6544fb1e245e 100644 (file)
@@ -62,7 +62,6 @@ ARMELFMCAsmInfo::ARMELFMCAsmInfo() {
   AbsoluteDebugSectionOffsets = true;
   PrivateGlobalPrefix = ".L";
   WeakRefDirective = "\t.weak\t";
-  SetDirective = "\t.set\t";
   HasLCOMMDirective = true;
 
   DwarfRequiresFrameSection = false;
index bb6fc2f2dfae8f63f7eabc615680be2e55dd9783..2b0b77acdb73647b46f808c6a793587126b6a182 100644 (file)
@@ -939,14 +939,14 @@ void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) {
   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';
     }
index 0e63582facabb40e1c36ebdf7e9d165dbfd2ade9..c67c6a235b11aea8930a2d06d7260b07a4111fb8 100644 (file)
@@ -19,4 +19,5 @@ AlphaMCAsmInfo::AlphaMCAsmInfo(const Target &T, const StringRef &TT) {
   PrivateGlobalPrefix = "$";
   GPRel32Directive = ".gprel32";
   WeakRefDirective = "\t.weak\t";
+  HasSetDirective = false;
 }
index 6d0f66cd7a5d127ca6c2feb1597821c1a4d0ac2d..31470fb35b9684903309cc29a9a6f8cc2ad176ef 100644 (file)
@@ -18,4 +18,5 @@ using namespace llvm;
 BlackfinMCAsmInfo::BlackfinMCAsmInfo(const Target &T, const StringRef &TT) {
   GlobalPrefix = "_";
   CommentString = "//";
+  HasSetDirective = false;
 }
index c10b460e733929eab6363827e234f161e49b5741..5ef3c6b24de746d0edf97c6b27364f0de902dc8e 100644 (file)
@@ -16,7 +16,6 @@ using namespace llvm;
 
 SPULinuxMCAsmInfo::SPULinuxMCAsmInfo(const Target &T, const StringRef &TT) {
   ZeroDirective = "\t.space\t";
-  SetDirective = "\t.set";
   Data64bitsDirective = "\t.quad\t";
   AlignmentIsInBytes = false;
   HasLCOMMDirective = true;
index 516eacb535641a4e0c1b7e4d5211a3910b7b1473..cfb499d132353f693249e41ac1cf43f0f44c5ac1 100644 (file)
@@ -17,7 +17,6 @@ using namespace llvm;
 MSP430MCAsmInfo::MSP430MCAsmInfo(const Target &T, const StringRef &TT) {
   PrivateGlobalPrefix = ".L";
   WeakRefDirective ="\t.weak\t";
-  SetDirective = "\t.set\t";
   PCSymbol=".";
   CommentString = ";";
 
index c5356f0e23a84b4c1a1724daece87b6258087495..89e3e11b0a7c2a59ebd5f409c355f0cb807560e6 100644 (file)
@@ -23,4 +23,5 @@ MipsMCAsmInfo::MipsMCAsmInfo(const Target &T, const StringRef &TT) {
   CommentString               = "#";
   ZeroDirective               = "\t.space\t";
   GPRel32Directive            = "\t.gpword\t";
+  HasSetDirective             = false;
 }
index 827315e13b721b0526c42aeec6533ed5052650c1..b08054270ceed7ba51e04b5b57b92baedbea1735 100644 (file)
@@ -37,7 +37,7 @@ PIC16MCAsmInfo::PIC16MCAsmInfo(const Target &T, const StringRef &TT) {
   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.
index c61627ec533c1c3b72bea5aade9a7a214c9a71c4..b0d04e46e09007ff6598e35e35689a875269d2c3 100644 (file)
@@ -49,7 +49,6 @@ PPCLinuxMCAsmInfo::PPCLinuxMCAsmInfo(bool is64Bit) {
   AbsoluteEHSectionOffsets = false;
     
   ZeroDirective = "\t.space\t";
-  SetDirective = "\t.set";
   Data64bitsDirective = is64Bit ? "\t.quad\t" : 0;
   HasLCOMMDirective = true;
   AssemblerDialect = 0;           // Old-Style mnemonics.
index 923181d7e4439702c5925b8b0ca5fab5451f4aed..53a9bde9252679945f4f3e871ca7fa404eb1d3c3 100644 (file)
@@ -29,7 +29,6 @@ SparcELFMCAsmInfo::SparcELFMCAsmInfo(const Target &T, const StringRef &TT) {
   UsesELFSectionDirectiveForBSS = true;
 
   WeakRefDirective = "\t.weak\t";
-  SetDirective = "\t.set\t";
 
   PrivateGlobalPrefix = ".L";
 }
index 52d4d5149c6d828ea3e0ae8d63075e1504a62f61..1a0920609b1552e33d703b85914492062b11c96b 100644 (file)
@@ -18,7 +18,6 @@ using namespace llvm;
 SystemZMCAsmInfo::SystemZMCAsmInfo(const Target &T, const StringRef &TT) {
   PrivateGlobalPrefix = ".L";
   WeakRefDirective = "\t.weak\t";
-  SetDirective = "\t.set\t";
   PCSymbol = ".";
 }
 
index c0cab869794ac04aeac88b06a9a7d626b8be8973..d3b00521aa0c072ea9f2dada8870048b78032087 100644 (file)
@@ -72,7 +72,6 @@ X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &Triple) {
 
   PrivateGlobalPrefix = ".L";
   WeakRefDirective = "\t.weak\t";
-  SetDirective = "\t.set\t";
   PCSymbol = ".";
 
   // Set up DWARF directives
index e955ef96ee0a684816a67fad045102e9312893ef..15b454861e39444313d178dcb96470ff8296a9fe 100644 (file)
@@ -106,7 +106,7 @@ void XCoreAsmPrinter::emitArrayBound(const MCSymbol *Sym,
     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
index dffdda9a1fd09622512ede4f08157ae93c51e95c..bf785755db4e5235975ccc11c0134a66d48e0144 100644 (file)
@@ -22,7 +22,6 @@ XCoreMCAsmInfo::XCoreMCAsmInfo(const Target &T, const StringRef &TT) {
   AscizDirective = ".asciiz";
   WeakDefDirective = "\t.weak\t";
   WeakRefDirective = "\t.weak\t";
-  SetDirective = "\t.set\t";
 
   // Debug
   HasLEB128 = true;