[llvm-commits] [llvm] r77165 - in /llvm/trunk: include/llvm/Target/ lib/Target/ lib/Target/ARM/ lib/Target/CellSPU/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/SystemZ/ lib/Target/X86/

Chris Lattner sabre at nondot.org
Sun Jul 26 12:23:30 PDT 2009


Author: lattner
Date: Sun Jul 26 14:23:28 2009
New Revision: 77165

URL: http://llvm.org/viewvc/llvm-project?rev=77165&view=rev
Log:
untangle a TargetAsmInfo hack where ELFTargetAsmInfo would create a
'unnamed' bss section, but some impls would want a named one.  Since
they don't have consistent behavior, just make each target do their
own thing, instead of doing something "sortof common" then having
targets change immutable objects later.


Modified:
    llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h
    llvm/trunk/include/llvm/Target/TargetAsmInfo.h
    llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp
    llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp
    llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
    llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp
    llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.h
    llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp
    llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.h
    llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
    llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp
    llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h
    llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp
    llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.h
    llvm/trunk/lib/Target/TargetAsmInfo.cpp
    llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp

Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h?rev=77165&r1=77164&r2=77165&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h Sun Jul 26 14:23:28 2009
@@ -23,7 +23,7 @@
   class Type;
 
   struct ELFTargetAsmInfo: public TargetAsmInfo {
-    explicit ELFTargetAsmInfo(const TargetMachine &TM);
+    ELFTargetAsmInfo(const TargetMachine &TM);
 
     /// getSectionForMergeableConstant - Given a mergeable constant with the
     /// specified size and relocation information, return a section that it

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

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Sun Jul 26 14:23:28 2009
@@ -254,7 +254,6 @@
     explicit Section(unsigned F = SectionFlags::Invalid) : Flags(F) { }
 
   public:
-    
     unsigned getEntitySize() const { return (Flags >> 24) & 0xFF; }
 
     const std::string &getName() const { return Name; }
@@ -679,11 +678,9 @@
     virtual ~TargetAsmInfo();
 
     const Section* getNamedSection(const char *Name,
-                                   unsigned Flags = SectionFlags::None,
-                                   bool Override = false) const;
+                                   unsigned Flags = SectionFlags::None) const;
     const Section* getUnnamedSection(const char *Directive,
-                                     unsigned Flags = SectionFlags::None,
-                                     bool Override = false) const;
+                                     unsigned Flags = SectionFlags::None) const;
 
     /// Measure the specified inline asm to determine an approximation of its
     /// length.

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

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp Sun Jul 26 14:23:28 2009
@@ -59,6 +59,9 @@
   ARMTargetAsmInfo<ELFTargetAsmInfo>(TM) {
   Subtarget = &TM.getSubtarget<ARMSubtarget>();
 
+  BSSSection_ = getUnnamedSection("\t.bss",
+                                  SectionFlags::Writable | SectionFlags::BSS);
+
   NeedsSet = false;
   HasLEB128 = true;
   AbsoluteDebugSectionOffsets = true;

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

==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUTargetAsmInfo.cpp Sun Jul 26 14:23:28 2009
@@ -36,8 +36,7 @@
   // BSS section needs to be emitted as ".section"
   BSSSection = "\t.section\t.bss";
   BSSSection_ = getUnnamedSection("\t.section\t.bss",
-                                  SectionFlags::Writable | SectionFlags::BSS,
-                                  true);
+                                  SectionFlags::Writable | SectionFlags::BSS);
 
   SupportsDebugInformation = true;
   NeedsSet = true;

Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=77165&r1=77164&r2=77165&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Sun Jul 26 14:23:28 2009
@@ -22,14 +22,13 @@
 #include "llvm/Target/ELFTargetAsmInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetData.h"
-
 using namespace llvm;
 
 ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM)
   : TargetAsmInfo(TM) {
 
-  BSSSection_  = getUnnamedSection("\t.bss",
-                                   SectionFlags::Writable | SectionFlags::BSS);
+  BSSSection_ = getUnnamedSection("\t.bss",
+                                  SectionFlags::Writable | SectionFlags::BSS);
   ReadOnlySection = getNamedSection("\t.rodata", SectionFlags::None);
   TLSDataSection = getNamedSection("\t.tdata",
                                    SectionFlags::Writable | SectionFlags::TLS);

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

==============================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.cpp Sun Jul 26 14:23:28 2009
@@ -12,11 +12,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "MSP430TargetAsmInfo.h"
-#include "MSP430TargetMachine.h"
-
 using namespace llvm;
 
-MSP430TargetAsmInfo::MSP430TargetAsmInfo(const MSP430TargetMachine &TM)
+MSP430TargetAsmInfo::MSP430TargetAsmInfo(const TargetMachine &TM)
   : ELFTargetAsmInfo(TM) {
   AlignmentIsInBytes = false;
+    
+  BSSSection_ = getUnnamedSection("\t.bss",
+                                  SectionFlags::Writable | SectionFlags::BSS);
 }

Modified: llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.h?rev=77165&r1=77164&r2=77165&view=diff

==============================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/MSP430/MSP430TargetAsmInfo.h Sun Jul 26 14:23:28 2009
@@ -14,16 +14,11 @@
 #ifndef MSP430TARGETASMINFO_H
 #define MSP430TARGETASMINFO_H
 
-#include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Target/ELFTargetAsmInfo.h"
 
 namespace llvm {
-
-  // Forward declaration.
-  class MSP430TargetMachine;
-
   struct MSP430TargetAsmInfo : public ELFTargetAsmInfo {
-    explicit MSP430TargetAsmInfo(const MSP430TargetMachine &TM);
+    explicit MSP430TargetAsmInfo(const TargetMachine &TM);
   };
 
 } // namespace llvm

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

==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Sun Jul 26 14:23:28 2009
@@ -13,8 +13,6 @@
 
 #include "MipsTargetAsmInfo.h"
 #include "MipsTargetMachine.h"
-#include "llvm/GlobalVariable.h"
-
 using namespace llvm;
 
 MipsTargetAsmInfo::MipsTargetAsmInfo(const MipsTargetMachine &TM)
@@ -32,6 +30,9 @@
   BSSSection                  = "\t.section\t.bss";
   CStringSection              = ".rodata.str";
 
+  BSSSection_ = getUnnamedSection("\t.bss",
+                                  SectionFlags::Writable | SectionFlags::BSS);
+    
   if (!TM.getSubtarget<MipsSubtarget>().hasABICall())
     JumpTableDirective = "\t.word\t";
   else

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

==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.h Sun Jul 26 14:23:28 2009
@@ -14,23 +14,14 @@
 #ifndef MIPSTARGETASMINFO_H
 #define MIPSTARGETASMINFO_H
 
-#include "MipsSubtarget.h"
-#include "llvm/DerivedTypes.h"
-#include "llvm/Target/TargetAsmInfo.h"
-#include "llvm/Target/TargetOptions.h"
 #include "llvm/Target/ELFTargetAsmInfo.h"
 
 namespace llvm {
-
   // Forward declaration.
-  class GlobalValue;
   class MipsTargetMachine;
 
   struct MipsTargetAsmInfo : public ELFTargetAsmInfo {
     explicit MipsTargetAsmInfo(const MipsTargetMachine &TM);
-
-    private:
-      const MipsSubtarget *Subtarget;
   };
 
 } // namespace llvm

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

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Sun Jul 26 14:23:28 2009
@@ -50,13 +50,11 @@
 }
 
 const char *
-PPCDarwinTargetAsmInfo::getEHGlobalPrefix() const
-{
+PPCDarwinTargetAsmInfo::getEHGlobalPrefix() const {
   const PPCSubtarget* Subtarget = &TM.getSubtarget<PPCSubtarget>();
   if (Subtarget->getDarwinVers() > 9)
     return PrivateGlobalPrefix;
-  else
-    return "";
+  return "";
 }
 
 PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
@@ -74,9 +72,8 @@
   BSSSection = "\t.section\t\".sbss\",\"aw\", at nobits";
 
   // PPC/Linux normally uses named section for BSS.
-  BSSSection_  = getNamedSection("\t.bss",
-                                 SectionFlags::Writable | SectionFlags::BSS,
-                                 /* Override */ true);
+  BSSSection_ = getNamedSection("\t.bss",
+                                SectionFlags::Writable | SectionFlags::BSS);
 
   // Debug Information
   AbsoluteDebugSectionOffsets = true;

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

==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.cpp Sun Jul 26 14:23:28 2009
@@ -15,8 +15,8 @@
 #include "llvm/ADT/SmallVector.h"
 using namespace llvm;
 
-SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const TargetMachine &TM):
-  ELFTargetAsmInfo(TM) {
+SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const TargetMachine &TM)
+  : ELFTargetAsmInfo(TM) {
   Data16bitsDirective = "\t.half\t";
   Data32bitsDirective = "\t.word\t";
   Data64bitsDirective = 0;  // .xword is only supported by V9.
@@ -27,9 +27,8 @@
   CStringSection=".rodata.str";
 
   // Sparc normally uses named section for BSS.
-  BSSSection_  = getNamedSection("\t.bss",
-                                 SectionFlags::Writable | SectionFlags::BSS,
-                                 /* Override */ true);
+  BSSSection_ = getNamedSection("\t.bss",
+                                SectionFlags::Writable | SectionFlags::BSS);
 }
 
 

Modified: llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h?rev=77165&r1=77164&r2=77165&view=diff

==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/Sparc/SparcTargetAsmInfo.h Sun Jul 26 14:23:28 2009
@@ -14,7 +14,6 @@
 #ifndef SPARCTARGETASMINFO_H
 #define SPARCTARGETASMINFO_H
 
-#include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Target/ELFTargetAsmInfo.h"
 
 namespace llvm {

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

==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.cpp Sun Jul 26 14:23:28 2009
@@ -27,4 +27,7 @@
   PCSymbol = ".";
 
   NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\", at progbits";
+    
+  BSSSection_ = getUnnamedSection("\t.bss",
+                                  SectionFlags::Writable | SectionFlags::BSS);
 }

Modified: llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.h?rev=77165&r1=77164&r2=77165&view=diff

==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZTargetAsmInfo.h Sun Jul 26 14:23:28 2009
@@ -14,7 +14,6 @@
 #ifndef SystemZTARGETASMINFO_H
 #define SystemZTARGETASMINFO_H
 
-#include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Target/ELFTargetAsmInfo.h"
 
 namespace llvm {

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

==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Sun Jul 26 14:23:28 2009
@@ -389,12 +389,12 @@
 }
 
 
-const Section *TargetAsmInfo::getNamedSection(const char *Name, unsigned Flags,
-                                              bool Override) const {
+const Section *TargetAsmInfo::getNamedSection(const char *Name,
+                                              unsigned Flags) const {
   Section &S = Sections[Name];
 
   // This is newly-created section, set it up properly.
-  if (S.Flags == SectionFlags::Invalid || Override) {
+  if (S.Name.empty()) {
     S.Flags = Flags | SectionFlags::Named;
     S.Name = Name;
   }
@@ -403,12 +403,11 @@
 }
 
 const Section*
-TargetAsmInfo::getUnnamedSection(const char *Directive, unsigned Flags,
-                                 bool Override) const {
+TargetAsmInfo::getUnnamedSection(const char *Directive, unsigned Flags) const {
   Section& S = Sections[Directive];
 
   // This is newly-created section, set it up properly.
-  if (S.Flags == SectionFlags::Invalid || Override) {
+  if (S.Name.empty()) {
     S.Flags = Flags & ~SectionFlags::Named;
     S.Name = Directive;
   }

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

==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Sun Jul 26 14:23:28 2009
@@ -128,6 +128,9 @@
   // Set up DWARF directives
   HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)
 
+  BSSSection_ = getUnnamedSection("\t.bss",
+                                  SectionFlags::Writable | SectionFlags::BSS);
+
   // Debug Information
   AbsoluteDebugSectionOffsets = true;
   SupportsDebugInformation = true;





More information about the llvm-commits mailing list