Support for non-landing pad exception handling.
[oota-llvm.git] / include / llvm / Target / TargetAsmInfo.h
index 6f63ba3a31ab40ea2dce55380205d8a23f60d03c..75e797cd88a26c55ac876a41a90dfb2ef76a5aca 100644 (file)
 #include "llvm/Support/DataTypes.h"
 
 namespace llvm {
-
-  // Forward declaration.
   class TargetMachine;
+  class CallInst;
 
   /// TargetAsmInfo - This class is intended to be used as a base class for asm
   /// properties and features specific to the target.
   class TargetAsmInfo {
-  
   protected:
     //===------------------------------------------------------------------===//
     // Properties to be set by the target writer, used to configure asm printer.
-    // 
+    //
     
     /// TextSection - Section directive for standard text.
     ///
@@ -40,14 +38,36 @@ namespace llvm {
     /// DataSection - Section directive for standard data.
     ///
     const char *DataSection;              // Defaults to ".data".
+
+    /// BSSSection - Section directive for uninitialized data.  Null if this
+    /// target doesn't support a BSS section.
+    ///
+    const char *BSSSection;               // Default to ".bss".
+    
+    /// ZeroFillDirective - Directive for emitting a global to the ZeroFill
+    /// section on this target.  Null if this target doesn't support zerofill.
+    const char *ZeroFillDirective;        // Default is null.
     
     /// AddressSize - Size of addresses used in file.
     ///
     unsigned AddressSize;                 // Defaults to 4.
-
+    
     /// NeedsSet - True if target asm can't compute addresses on data
     /// directives.
     bool NeedsSet;                        // Defaults to false.
+    
+    /// MaxInstLength - This is the maximum possible length of an instruction,
+    /// which is needed to compute the size of an inline asm.
+    unsigned MaxInstLength;               // Defaults to 4.
+    
+    /// PCSymbol - The symbol used to represent the current PC.  Used in PC
+    /// relative expressions.
+    const char *PCSymbol;                 // Defaults to "$".
+
+    /// SeparatorChar - This character, if specified, is used to separate
+    /// instructions from each other when on the same line.  This is used to
+    /// measure inline asm instructions.
+    char SeparatorChar;                   // Defaults to ';'
 
     /// CommentString - This indicates the comment character used by the
     /// assembler.
@@ -62,6 +82,10 @@ namespace llvm {
     /// have names in the .o file.  This is often "." or "L".
     const char *PrivateGlobalPrefix;      // Defaults to "."
     
+    /// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is
+    /// emitted before jump tables with the specified prefix.
+    const char *JumpTableSpecialLabelPrefix;  // Default to null.
+    
     /// GlobalVarAddrPrefix/Suffix - If these are nonempty, these strings
     /// will enclose any GlobalVariable (that isn't a function)
     ///
@@ -82,7 +106,10 @@ namespace llvm {
     /// emit before and after an inline assembly statement.
     const char *InlineAsmStart;           // Defaults to "#APP\n"
     const char *InlineAsmEnd;             // Defaults to "#NO_APP\n"
-    
+
+    /// AssemblerDialect - Which dialect of an assembler variant to use.
+    unsigned AssemblerDialect;            // Defaults to 0
+
     //===--- Data Emission Directives -------------------------------------===//
 
     /// ZeroDirective - this should be set to the directive used to get some
@@ -121,7 +148,7 @@ namespace llvm {
     /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
     /// boundary.
     bool AlignmentIsInBytes;              // Defaults to true
-    
+
     //===--- Section Switching Directives ---------------------------------===//
     
     /// SwitchToSectionDirective - This is the directive used when we want to
@@ -150,11 +177,16 @@ namespace llvm {
     /// is not PIC.
     const char *JumpTableDataSection;     // Defaults to "\t.section .rodata\n"
     
-    /// JumpTableTextSection - This is the section that we SwitchToSection right
-    /// before emitting the jump tables for a function when the relocation model
-    /// is PIC.
-    const char *JumpTableTextSection;     // Defaults to "\t.text\n"
-    
+    /// JumpTableDirective - if non-null, the directive to emit before a jump
+    /// table.
+    const char *JumpTableDirective;
+
+    /// CStringSection - If not null, this allows for special handling of
+    /// cstring constants (\0 terminated string that does not contain any
+    /// other null bytes) on this target. This is commonly supported as
+    /// ".cstring".
+    const char *CStringSection;           // Defaults to NULL
+
     /// StaticCtorsSection - This is the directive that is emitted to switch to
     /// a section to emit the static constructor list.
     /// Defaults to "\t.section .ctors,\"aw\",@progbits".
@@ -174,6 +206,10 @@ namespace llvm {
     
     //===--- Global Variable Emission Directives --------------------------===//
     
+    /// GlobalDirective - This is the directive used to declare a global entity.
+    ///
+    const char *GlobalDirective;          // 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.
@@ -195,6 +231,19 @@ namespace llvm {
     /// directives, this is true for most ELF targets.
     bool HasDotTypeDotSizeDirective;      // 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.
+
+    /// WeakRefDirective - This directive, if non-null, is used to declare a
+    /// global as being a weak undefined symbol.
+    const char *WeakRefDirective;         // 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".
+    
     //===--- Dwarf Emission Directives -----------------------------------===//
 
     /// HasLEB128 - True if target asm supports leb128 directives.
@@ -209,6 +258,14 @@ namespace llvm {
     ///
     bool HasDotFile; // Defaults to false.
     
+    /// SupportsExceptionHandling - True if target supports exception handling.
+    ///
+    bool SupportsExceptionHandling; // Defaults to false.
+    
+    /// RequiresFrameSection - true if the Dwarf2 output needs a frame section
+    ///
+    bool DwarfRequiresFrameSection; // Defaults to true.
+
     /// DwarfAbbrevSection - Section directive for Dwarf abbrev.
     ///
     const char *DwarfAbbrevSection; // Defaults to ".debug_abbrev".
@@ -252,12 +309,31 @@ namespace llvm {
     /// DwarfMacInfoSection - Section directive for Dwarf info.
     ///
     const char *DwarfMacInfoSection; // Defaults to ".debug_macinfo".
+    
+    /// DwarfEHFrameSection - Section directive for Exception frames.
+    ///
+    const char *DwarfEHFrameSection; // Defaults to ".eh_frame".
 
+    //===--- CBE Asm Translation Table -----------------------------------===//
+
+    const char** AsmTransCBE; // Defaults to empty
 
   public:
     TargetAsmInfo();
-        
-    //
+    virtual ~TargetAsmInfo();
+
+    /// Measure the specified inline asm to determine an approximation of its
+    /// length.
+    unsigned getInlineAsmLength(const char *Str) const;
+
+    /// ExpandInlineAsm - This hook allows the target to expand an inline asm
+    /// call to be explicit llvm code if it wants to.  This is useful for
+    /// turning simple inline asms into LLVM intrinsics, which gives the
+    /// compiler more information about the behavior of the code.
+    virtual bool ExpandInlineAsm(CallInst *CI) const {
+      return false;
+    }
+    
     // Accessors.
     //
     const char *getTextSection() const {
@@ -266,12 +342,24 @@ namespace llvm {
     const char *getDataSection() const {
       return DataSection;
     }
+    const char *getBSSSection() const {
+      return BSSSection;
+    }
+    const char *getZeroFillDirective() const {
+      return ZeroFillDirective;
+    }
     unsigned getAddressSize() const {
       return AddressSize;
     }
     bool needsSet() const {
       return NeedsSet;
     }
+    const char *getPCSymbol() const {
+      return PCSymbol;
+    }
+    char getSeparatorChar() const {
+      return SeparatorChar;
+    }
     const char *getCommentString() const {
       return CommentString;
     }
@@ -281,6 +369,9 @@ namespace llvm {
     const char *getPrivateGlobalPrefix() const {
       return PrivateGlobalPrefix;
     }
+    const char *getJumpTableSpecialLabelPrefix() const {
+      return JumpTableSpecialLabelPrefix;
+    }
     const char *getGlobalVarAddrPrefix() const {
       return GlobalVarAddrPrefix;
     }
@@ -299,6 +390,9 @@ namespace llvm {
     const char *getInlineAsmEnd() const {
       return InlineAsmEnd;
     }
+    unsigned getAssemblerDialect() const {
+      return AssemblerDialect;
+    }
     const char *getZeroDirective() const {
       return ZeroDirective;
     }
@@ -323,6 +417,9 @@ namespace llvm {
     const char *getData64bitsDirective() const {
       return Data64bitsDirective;
     }
+    const char *getJumpTableDirective() const {
+      return JumpTableDirective;
+    }
     const char *getAlignDirective() const {
       return AlignDirective;
     }
@@ -347,8 +444,8 @@ namespace llvm {
     const char *getJumpTableDataSection() const {
       return JumpTableDataSection;
     }
-    const char *getJumpTableTextSection() const {
-      return JumpTableTextSection;
+    const char *getCStringSection() const {
+      return CStringSection;
     }
     const char *getStaticCtorsSection() const {
       return StaticCtorsSection;
@@ -365,6 +462,9 @@ namespace llvm {
     const char *getSixteenByteConstantSection() const {
       return SixteenByteConstantSection;
     }
+    const char *getGlobalDirective() const {
+      return GlobalDirective;
+    }
     const char *getSetDirective() const {
       return SetDirective;
     }
@@ -380,6 +480,15 @@ namespace llvm {
     bool hasDotTypeDotSizeDirective() const {
       return HasDotTypeDotSizeDirective;
     }
+    const char *getUsedDirective() const {
+      return UsedDirective;
+    }
+    const char *getWeakRefDirective() const {
+      return WeakRefDirective;
+    }
+    const char *getHiddenDirective() const {
+      return HiddenDirective;
+    }
     bool hasLEB128() const {
       return HasLEB128;
     }
@@ -389,6 +498,12 @@ namespace llvm {
     bool hasDotFile() const {
       return HasDotFile;
     }
+    bool getSupportsExceptionHandling() const {
+      return SupportsExceptionHandling;
+    }
+    bool getDwarfRequiresFrameSection() const {
+      return DwarfRequiresFrameSection;
+    }
     const char *getDwarfAbbrevSection() const {
       return DwarfAbbrevSection;
     }
@@ -422,8 +537,13 @@ namespace llvm {
     const char *getDwarfMacInfoSection() const {
       return DwarfMacInfoSection;
     }
+    const char *getDwarfEHFrameSection() const {
+      return DwarfEHFrameSection;
+    }
+    const char** getAsmCBE() const {
+      return AsmTransCBE;
+    }
   };
-  
 }
 
 #endif