mcize lcomm, simplify .comm, extend both to support 64-bit sizes.
[oota-llvm.git] / include / llvm / MC / MCAsmInfo.h
index 0be27530f27149af10f1f6129599644ea23b4935..5e31dfeb0dacf62847b5416633b1e7b8074c5f82 100644 (file)
 #ifndef LLVM_TARGET_ASM_INFO_H
 #define LLVM_TARGET_ASM_INFO_H
 
+#include "llvm/MC/MCDirectives.h"
 #include <cassert>
 
 namespace llvm {
+  class MCSection;
+  class MCContext;
+  
   /// MCAsmInfo - This class is intended to be used as a base class for asm
   /// properties and features specific to the target.
   namespace ExceptionHandling { enum ExceptionsType { None, Dwarf, SjLj }; }
@@ -29,11 +33,10 @@ namespace llvm {
     // Properties to be set by the target writer, used to configure asm printer.
     //
 
-    /// NonexecutableStackDirective - Directive for declaring to the
-    /// linker and beyond that the emitted code does not require stack
-    /// memory to be executable.
-    const char *NonexecutableStackDirective; // Default is null.
-
+    /// HasSubsectionsViaSymbols - True if this target has the MachO
+    /// .subsections_via_symbols directive.
+    bool HasSubsectionsViaSymbols;           // Default is false.
+    
     /// HasMachoZeroFillDirective - True if this is a MachO target that supports
     /// the macho-specific .zerofill directive for emitting BSS Symbols.
     bool HasMachoZeroFillDirective;               // Default is false.
@@ -188,15 +191,10 @@ namespace llvm {
     /// the assembler to set the value of a variable to some expression.
     const char *SetDirective;                // Defaults to null.
     
-    /// LCOMMDirective - This is the name of a directive (if supported) that can
-    /// be used to efficiently declare a local (internal) block of zero
-    /// initialized data in the .bss/.data section.  The syntax expected is:
-    /// @verbatim <LCOMMDirective> SYMBOLNAME LENGTHINBYTES
-    /// @endverbatim
-    const char *LCOMMDirective;              // Defaults to null.
+    /// HasLCOMMDirective - This is true if the target supports the .lcomm
+    /// directive.
+    bool HasLCOMMDirective;              // Defaults to false.
     
-    const char *COMMDirective;               // Defaults to "\t.comm\t".
-
     /// COMMDirectiveTakesAlignment - True if COMMDirective take a third
     /// argument that specifies the alignment of the declaration.
     bool COMMDirectiveTakesAlignment;        // Defaults to true.
@@ -209,10 +207,9 @@ namespace llvm {
     /// .file directive, this is true for ELF targets.
     bool HasSingleParameterDotFile;          // Defaults to true.
 
-    /// UsedDirective - This directive, if non-null, is used to declare a global
-    /// as being used somehow that the assembler can't see.  This prevents dead
-    /// code elimination on some targets.
-    const char *UsedDirective;               // Defaults to NULL.
+    /// HasNoDeadStrip - True if this target supports the MachO .no_dead_strip
+    /// directive.
+    bool HasNoDeadStrip;                     // Defaults to false.
 
     /// WeakRefDirective - This directive, if non-null, is used to declare a
     /// global as being a weak undefined symbol.
@@ -226,13 +223,13 @@ namespace llvm {
     /// global as being a weak defined symbol.  This is used on cygwin/mingw.
     const char *LinkOnceDirective;           // Defaults to NULL.
     
-    /// HiddenDirective - This directive, if non-null, is used to declare a
-    /// global or function as having hidden visibility.
-    const char *HiddenDirective;             // Defaults to "\t.hidden\t".
+    /// HiddenVisibilityAttr - This attribute, if not MCSA_Invalid, is used to
+    /// declare a symbol as having hidden visibility.
+    MCSymbolAttr HiddenVisibilityAttr;       // Defaults to MCSA_Hidden.
 
-    /// ProtectedDirective - This directive, if non-null, is used to declare a
-    /// global or function as having protected visibility.
-    const char *ProtectedDirective;          // Defaults to "\t.protected\t".
+    /// ProtectedVisibilityAttr - This attribute, if not MCSA_Invalid, is used
+    /// to declare a symbol as having protected visibility.
+    MCSymbolAttr ProtectedVisibilityAttr;    // Defaults to MCSA_Protected
 
     //===--- Dwarf Emission Directives -----------------------------------===//
 
@@ -288,14 +285,12 @@ namespace llvm {
     explicit MCAsmInfo();
     virtual ~MCAsmInfo();
 
-    /// getSLEB128Size - Compute the number of bytes required for a signed
-    /// leb128 value.
+    // FIXME: move these methods to DwarfPrinter when the JIT stops using them.
     static unsigned getSLEB128Size(int Value);
-
-    /// getULEB128Size - Compute the number of bytes required for an unsigned
-    /// leb128 value.
     static unsigned getULEB128Size(unsigned Value);
 
+    bool hasSubsectionsViaSymbols() const { return HasSubsectionsViaSymbols; }
+    
     // Data directive accessors.
     //
     const char *getData8bitsDirective(unsigned AS = 0) const {
@@ -311,6 +306,12 @@ namespace llvm {
       return AS == 0 ? Data64bitsDirective : getDataASDirective(64, AS);
     }
 
+    /// getNonexecutableStackSection - Targets can implement this method to
+    /// specify a section to switch to if the translation unit doesn't have any
+    /// trampolines that require an executable stack.
+    virtual MCSection *getNonexecutableStackSection(MCContext &Ctx) const {
+      return 0;
+    }
     
     bool usesSunStyleELFSectionSwitchSyntax() const {
       return SunStyleELFSectionSwitchSyntax;
@@ -326,9 +327,6 @@ namespace llvm {
     bool hasStaticCtorDtorReferenceInStaticMode() const {
       return HasStaticCtorDtorReferenceInStaticMode;
     }
-    const char *getNonexecutableStackDirective() const {
-      return NonexecutableStackDirective;
-    }
     bool needsSet() const {
       return NeedsSet;
     }
@@ -401,32 +399,20 @@ namespace llvm {
     const char *getSetDirective() const {
       return SetDirective;
     }
-    const char *getLCOMMDirective() const {
-      return LCOMMDirective;
-    }
-    const char *getCOMMDirective() const {
-      return COMMDirective;
-    }
+    bool hasLCOMMDirective() const { return HasLCOMMDirective; }
     bool getCOMMDirectiveTakesAlignment() const {
       return COMMDirectiveTakesAlignment;
     }
-    bool hasDotTypeDotSizeDirective() const {
-      return HasDotTypeDotSizeDirective;
-    }
-    bool hasSingleParameterDotFile() const {
-      return HasSingleParameterDotFile;
-    }
-    const char *getUsedDirective() const {
-      return UsedDirective;
-    }
+    bool hasDotTypeDotSizeDirective() const {return HasDotTypeDotSizeDirective;}
+    bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; }
+    bool hasNoDeadStrip() const { return HasNoDeadStrip; }
     const char *getWeakRefDirective() const { return WeakRefDirective; }
     const char *getWeakDefDirective() const { return WeakDefDirective; }
     const char *getLinkOnceDirective() const { return LinkOnceDirective; }
-    const char *getHiddenDirective() const {
-      return HiddenDirective;
-    }
-    const char *getProtectedDirective() const {
-      return ProtectedDirective;
+    
+    MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr;}
+    MCSymbolAttr getProtectedVisibilityAttr() const {
+      return ProtectedVisibilityAttr;
     }
     bool isAbsoluteDebugSectionOffsets() const {
       return AbsoluteDebugSectionOffsets;