Re-enables the new vector select in the bitcode reader, by modifying the
[oota-llvm.git] / include / llvm / Target / TargetAsmInfo.h
index 04e91cb38120948bd805bddc0246e0c5b22d7402..589c9a6efc9b052f04be92297cd9a6f1c5522dea 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef LLVM_TARGET_ASM_INFO_H
 #define LLVM_TARGET_ASM_INFO_H
 
+#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/DataTypes.h"
 #include <string>
@@ -83,12 +84,23 @@ namespace llvm {
     static inline unsigned setEntitySize(unsigned Flags, unsigned Size) {
       return ((Flags & ~EntitySize) | ((Size & 0xFF) << 24));
     }
+
+    struct KeyInfo {
+      static inline unsigned getEmptyKey() { return Invalid; }
+      static inline unsigned getTombstoneKey() { return Invalid - 1; }
+      static unsigned getHashValue(const unsigned &Key) { return Key; }
+      static bool isEqual(unsigned LHS, unsigned RHS) { return LHS == RHS; }
+      static bool isPod() { return true; }
+    };
+
+    typedef DenseMap<unsigned, std::string, KeyInfo> FlagsStringsMapType;
   }
 
   class TargetMachine;
   class CallInst;
   class GlobalValue;
   class Type;
+  class Mangler;
 
   class Section {
     friend class TargetAsmInfo;
@@ -109,6 +121,7 @@ namespace llvm {
   class TargetAsmInfo {
   private:
     mutable StringMap<Section> Sections;
+    mutable SectionFlags::FlagsStringsMapType FlagsStrings;
   protected:
     //===------------------------------------------------------------------===//
     // Properties to be set by the target writer, used to configure asm printer.
@@ -204,10 +217,15 @@ namespace llvm {
     const char *GlobalPrefix;             // Defaults to ""
 
     /// PrivateGlobalPrefix - This prefix is used for globals like constant
-    /// pool entries that are completely private to the .o file and should not
+    /// pool entries that are completely private to the .s file and should not
     /// have names in the .o file.  This is often "." or "L".
     const char *PrivateGlobalPrefix;      // Defaults to "."
     
+    /// LessPrivateGlobalPrefix - This prefix is used for symbols that should
+    /// be passed through the assembler but be removed by the linker.  This
+    /// is "l" on Darwin, currently used for some ObjC metadata.
+    const char *LessPrivateGlobalPrefix;      // 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.
@@ -508,9 +526,11 @@ namespace llvm {
     virtual ~TargetAsmInfo();
 
     const Section* getNamedSection(const char *Name,
-                                   unsigned Flags = SectionFlags::None) const;
+                                   unsigned Flags = SectionFlags::None,
+                                   bool Override = false) const;
     const Section* getUnnamedSection(const char *Directive,
-                                     unsigned Flags = SectionFlags::None) const;
+                                     unsigned Flags = SectionFlags::None,
+                                     bool Override = false) const;
 
     /// Measure the specified inline asm to determine an approximation of its
     /// length.
@@ -524,6 +544,13 @@ namespace llvm {
       return false;
     }
 
+    /// emitUsedDirectiveFor - This hook allows targets to selectively decide
+    /// not to emit the UsedDirective for some symbols in llvm.used.
+    virtual bool emitUsedDirectiveFor(const GlobalValue *GV,
+                                      Mangler *Mang) const {
+      return (GV!=0);
+    }
+
     /// PreferredEHDataFormat - This hook allows the target to select data
     /// format used for encoding pointers in exception handling data. Reason is
     /// 0 for data, 1 for code labels, 2 for function pointers. Global is true
@@ -551,12 +578,23 @@ namespace llvm {
     virtual std::string UniqueSectionForGlobal(const GlobalValue* GV,
                                                SectionKind::Kind kind) const;
 
-    virtual std::string PrintSectionFlags(unsigned flags) const { return ""; }
+    const std::string& getSectionFlags(unsigned Flags) const;
+    virtual std::string printSectionFlags(unsigned flags) const { return ""; }
 
     virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
 
     virtual const Section* SelectSectionForMachineConst(const Type *Ty) const;
 
+    /// getSLEB128Size - Compute the number of bytes required for a signed
+    /// leb128 value.
+
+    static unsigned getSLEB128Size(int Value);
+
+    /// getULEB128Size - Compute the number of bytes required for an unsigned
+    /// leb128 value.
+
+    static unsigned getULEB128Size(unsigned Value);
+
     // Accessors.
     //
     const char *getTextSection() const {
@@ -628,6 +666,9 @@ namespace llvm {
     const char *getPrivateGlobalPrefix() const {
       return PrivateGlobalPrefix;
     }
+    const char *getLessPrivateGlobalPrefix() const {
+      return LessPrivateGlobalPrefix;
+    }
     const char *getJumpTableSpecialLabelPrefix() const {
       return JumpTableSpecialLabelPrefix;
     }