on darwin<10, fallback to .weak_definition (PPC,X86)
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfAccelTable.h
index 0acd289c0569256eb2d7175c44f34feb4a1cf139..18d1138228a8c7893d04a5421ddfc50168778723 100644 (file)
@@ -63,14 +63,10 @@ namespace llvm {
 
 class AsmPrinter;
 class DIE;
-class DwarfUnits;
+class DwarfFile;
 
 class DwarfAccelTable {
 
-  enum HashFunctionType {
-    eHashFunctionDJB = 0u
-  };
-
   static uint32_t HashDJB(StringRef Str) {
     uint32_t h = 5381;
     for (unsigned i = 0, e = Str.size(); i != e; ++i)
@@ -96,8 +92,9 @@ class DwarfAccelTable {
     static const uint32_t MagicHash = 0x48415348;
 
     TableHeader(uint32_t data_len)
-        : magic(MagicHash), version(1), hash_function(eHashFunctionDJB),
-          bucket_count(0), hashes_count(0), header_data_len(data_len) {}
+        : magic(MagicHash), version(1),
+          hash_function(dwarf::DW_hash_function_djb), bucket_count(0),
+          hashes_count(0), header_data_len(data_len) {}
 
 #ifndef NDEBUG
     void print(raw_ostream &O) {
@@ -123,37 +120,17 @@ public:
   // uint32_t die_offset_base
   // uint32_t atom_count
   // atom_count Atoms
-  enum AtomType {
-    eAtomTypeNULL = 0u,
-    eAtomTypeDIEOffset = 1u, // DIE offset, check form for encoding
-    eAtomTypeCUOffset = 2u,  // DIE offset of the compiler unit header that
-                             // contains the item in question
-    eAtomTypeTag = 3u,       // DW_TAG_xxx value, should be encoded as
-                             // DW_FORM_data1 (if no tags exceed 255) or
-                             // DW_FORM_data2.
-    eAtomTypeNameFlags = 4u, // Flags from enum NameFlags
-    eAtomTypeTypeFlags = 5u  // Flags from enum TypeFlags
-  };
-
-  enum TypeFlags {
-    eTypeFlagClassMask = 0x0000000fu,
-
-    // Always set for C++, only set for ObjC if this is the
-    // @implementation for a class.
-    eTypeFlagClassIsImplementation = (1u << 1)
-  };
 
   // Make these public so that they can be used as a general interface to
   // the class.
   struct Atom {
-    AtomType type; // enum AtomType
+    uint16_t type; // enum AtomType
     uint16_t form; // DWARF DW_FORM_ defines
 
-    Atom(AtomType type, uint16_t form) : type(type), form(form) {}
-    static const char *AtomTypeString(enum AtomType);
+    Atom(uint16_t type, uint16_t form) : type(type), form(form) {}
 #ifndef NDEBUG
     void print(raw_ostream &O) {
-      O << "Type: " << AtomTypeString(type) << "\n"
+      O << "Type: " << dwarf::AtomTypeString(type) << "\n"
         << "Form: " << dwarf::FormEncodingString(form) << "\n";
     }
     void dump() { print(dbgs()); }
@@ -188,10 +165,10 @@ private:
   // HashData[hash_data_count]
 public:
   struct HashDataContents {
-    DIE *Die;   // Offsets
+    const DIE *Die;   // Offsets
     char Flags; // Specific flags to output
 
-    HashDataContents(DIE *D, char Flags) : Die(D), Flags(Flags) {}
+    HashDataContents(const DIE *D, char Flags) : Die(D), Flags(Flags) {}
 #ifndef NDEBUG
     void print(raw_ostream &O) const {
       O << "  Offset: " << Die->getOffset() << "\n";
@@ -239,7 +216,7 @@ private:
   void EmitBuckets(AsmPrinter *);
   void EmitHashes(AsmPrinter *);
   void EmitOffsets(AsmPrinter *, MCSymbol *);
-  void EmitData(AsmPrinter *, DwarfUnits *D);
+  void EmitData(AsmPrinter *, DwarfFile *D);
 
   // Allocator for HashData and HashDataContents.
   BumpPtrAllocator Allocator;
@@ -264,9 +241,9 @@ private:
 public:
   DwarfAccelTable(ArrayRef<DwarfAccelTable::Atom>);
   ~DwarfAccelTable();
-  void AddName(StringRef, DIE *, char = 0);
+  void AddName(StringRef, const DIE *, char = 0);
   void FinalizeTable(AsmPrinter *, StringRef);
-  void Emit(AsmPrinter *, MCSymbol *, DwarfUnits *);
+  void Emit(AsmPrinter *, MCSymbol *, DwarfFile *);
 #ifndef NDEBUG
   void print(raw_ostream &O);
   void dump() { print(dbgs()); }