remove dead variable, patch by Nathan Howell!
[oota-llvm.git] / include / llvm / MC / MCSectionELF.h
index 31e1e6684f60d5f4edc387fe11f96236840b4a2f..cdd2f73b3484bbc741d312d2e165ce96d889c871 100644 (file)
@@ -21,7 +21,9 @@ namespace llvm {
 /// MCSectionELF - This represents a section on linux, lots of unix variants
 /// and some bare metal systems.
 class MCSectionELF : public MCSection {
-  std::string SectionName;
+  /// SectionName - This is the name of the section.  The referenced memory is
+  /// owned by TargetLoweringObjectFileELF's ELFUniqueMap.
+  StringRef SectionName;
   
   /// Type - This is the sh_type field of a section, drawn from the enums below.
   unsigned Type;
@@ -30,34 +32,32 @@ class MCSectionELF : public MCSection {
   /// below.
   unsigned Flags;
 
-  /// HasCrazyBSS - PPC/Linux doesn't support the .bss directive, it 
-  /// needs .section .bss. TODO: replace this with a TAI method.
-  bool HasCrazyBSS;
-
   /// IsExplicit - Indicates that this section comes from globals with an
-  /// explicit section specfied.
+  /// explicit section specified.
   bool IsExplicit;
   
-  MCSectionELF(const StringRef &Section, unsigned T, unsigned F, 
-               SectionKind K, bool hasCrazyBSS, bool isExplicit)
-    : MCSection(K), SectionName(Section.str()), Type(T), Flags(F), 
-      HasCrazyBSS(hasCrazyBSS), IsExplicit(isExplicit) {}
+protected:
+  MCSectionELF(StringRef Section, unsigned type, unsigned flags,
+               SectionKind K, bool isExplicit)
+    : MCSection(K), SectionName(Section), Type(type), Flags(flags), 
+      IsExplicit(isExplicit) {}
 public:
   
-  static MCSectionELF *Create(const StringRef &Section, unsigned Type, 
-                              unsigned Flags, SectionKind K, 
-                              bool hasCrazyBSS, bool isExplicit, 
+  static MCSectionELF *Create(StringRef Section, unsigned Type, 
+                              unsigned Flags, SectionKind K, bool isExplicit,
                               MCContext &Ctx);
 
   /// ShouldOmitSectionDirective - Decides whether a '.section' directive
   /// should be printed before the section name
-  bool ShouldOmitSectionDirective(const char *Name) const;
+  bool ShouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
 
   /// ShouldPrintSectionType - Only prints the section type if supported
   bool ShouldPrintSectionType(unsigned Ty) const;
 
-  /// IsCommon - True if this section contains only common symbols
-  bool IsCommon() const;
+  /// HasCommonSymbols - True if this section holds common symbols, this is
+  /// indicated on the ELF object file by a symbol with SHN_COMMON section 
+  /// header index.
+  bool HasCommonSymbols() const;
   
   /// These are the section type and flags fields.  An ELF section can have
   /// only one Type, but can have more than one of the flags specified.
@@ -95,16 +95,16 @@ public:
     SHT_REL              = 0x09U,
 
     // This section type is reserved but has unspecified semantics. 
-    SHT_SHLIB            = 0x0aU,
+    SHT_SHLIB            = 0x0AU,
 
     // This section holds a symbol table.
-    SHT_DYNSYM           = 0x0bU,
+    SHT_DYNSYM           = 0x0BU,
 
     // This section contains an array of pointers to initialization functions.
-    SHT_INIT_ARRAY       = 0x0eU,
+    SHT_INIT_ARRAY       = 0x0EU,
 
     // This section contains an array of pointers to termination functions.
-    SHT_FINI_ARRAY       = 0x0fU,
+    SHT_FINI_ARRAY       = 0x0FU,
 
     // This section contains an array of pointers to functions that are invoked
     // before all other initialization functions.
@@ -152,18 +152,36 @@ public:
     SHF_GROUP            = 0x200U,
 
     // This section holds Thread-Local Storage.
-    SHF_TLS              = 0x400U
+    SHF_TLS              = 0x400U,
+    
+    /// FIRST_TARGET_DEP_FLAG - This is the first flag that subclasses are
+    /// allowed to specify.
+    FIRST_TARGET_DEP_FLAG = 0x800U,
+
+    /// TARGET_INDEP_SHF - This is the bitmask for all the target independent
+    /// section flags.  Targets can define their own target flags above these.
+    /// If they do that, they should implement their own MCSectionELF subclasses
+    /// and implement the virtual method hooks below to handle printing needs.
+    TARGET_INDEP_SHF     = FIRST_TARGET_DEP_FLAG-1U
   };
 
-  StringRef getSectionName() const {
-    return StringRef(SectionName);
-  }
-  
+  StringRef getSectionName() const { return SectionName; }
   unsigned getType() const { return Type; }
   unsigned getFlags() const { return Flags; }
   
-  virtual void PrintSwitchToSection(const TargetAsmInfo &TAI,
+  virtual void PrintSwitchToSection(const MCAsmInfo &MAI,
                                     raw_ostream &OS) const;
+  
+  
+  /// PrintTargetSpecificSectionFlags - Targets that define their own
+  /// MCSectionELF subclasses with target specific section flags should
+  /// implement this method if they end up adding letters to the attributes
+  /// list.
+  virtual void PrintTargetSpecificSectionFlags(const MCAsmInfo &MAI,
+                                               raw_ostream &OS) const {
+  }
+                                               
+  
 };
 
 } // end namespace llvm