summaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/DwarfAccelTable.h
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-09-05 16:46:43 +0000
committerEric Christopher <echristo@gmail.com>2013-09-05 16:46:43 +0000
commit5b9544b526fb655a8abcbb2034206e1a25aa4690 (patch)
treeb721fec91b846b6b58263ed4945635b585bd4039 /lib/CodeGen/AsmPrinter/DwarfAccelTable.h
parent67990fa3ba3b0d61f7f94cadfebd7c78ed8f6a71 (diff)
downloadllvm-5b9544b526fb655a8abcbb2034206e1a25aa4690.tar.gz
llvm-5b9544b526fb655a8abcbb2034206e1a25aa4690.tar.bz2
llvm-5b9544b526fb655a8abcbb2034206e1a25aa4690.tar.xz
Reformat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190064 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfAccelTable.h')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfAccelTable.h113
1 files changed, 53 insertions, 60 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfAccelTable.h b/lib/CodeGen/AsmPrinter/DwarfAccelTable.h
index 3ef1dc5544..0acd289c05 100644
--- a/lib/CodeGen/AsmPrinter/DwarfAccelTable.h
+++ b/lib/CodeGen/AsmPrinter/DwarfAccelTable.h
@@ -71,7 +71,7 @@ class DwarfAccelTable {
eHashFunctionDJB = 0u
};
- static uint32_t HashDJB (StringRef Str) {
+ static uint32_t HashDJB(StringRef Str) {
uint32_t h = 5381;
for (unsigned i = 0, e = Str.size(); i != e; ++i)
h = ((h << 5) + h) + Str[i];
@@ -80,25 +80,24 @@ class DwarfAccelTable {
// Helper function to compute the number of buckets needed based on
// the number of unique hashes.
- void ComputeBucketCount (void);
+ void ComputeBucketCount(void);
struct TableHeader {
- uint32_t magic; // 'HASH' magic value to allow endian detection
- uint16_t version; // Version number.
- uint16_t hash_function; // The hash function enumeration that was used.
- uint32_t bucket_count; // The number of buckets in this hash table.
- uint32_t hashes_count; // The total number of unique hash values
- // and hash data offsets in this table.
- uint32_t header_data_len; // The bytes to skip to get to the hash
- // indexes (buckets) for correct alignment.
+ uint32_t magic; // 'HASH' magic value to allow endian detection
+ uint16_t version; // Version number.
+ uint16_t hash_function; // The hash function enumeration that was used.
+ uint32_t bucket_count; // The number of buckets in this hash table.
+ uint32_t hashes_count; // The total number of unique hash values
+ // and hash data offsets in this table.
+ uint32_t header_data_len; // The bytes to skip to get to the hash
+ // indexes (buckets) for correct alignment.
// Also written to disk is the implementation specific header data.
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)
- {}
+ TableHeader(uint32_t data_len)
+ : magic(MagicHash), version(1), hash_function(eHashFunctionDJB),
+ bucket_count(0), hashes_count(0), header_data_len(data_len) {}
#ifndef NDEBUG
void print(raw_ostream &O) {
@@ -125,15 +124,15 @@ public:
// 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
+ 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 {
@@ -141,7 +140,7 @@ public:
// Always set for C++, only set for ObjC if this is the
// @implementation for a class.
- eTypeFlagClassIsImplementation = ( 1u << 1 )
+ eTypeFlagClassIsImplementation = (1u << 1)
};
// Make these public so that they can be used as a general interface to
@@ -151,35 +150,31 @@ public:
uint16_t form; // DWARF DW_FORM_ defines
Atom(AtomType type, uint16_t form) : type(type), form(form) {}
- static const char * AtomTypeString(enum AtomType);
+ static const char *AtomTypeString(enum AtomType);
#ifndef NDEBUG
void print(raw_ostream &O) {
O << "Type: " << AtomTypeString(type) << "\n"
<< "Form: " << dwarf::FormEncodingString(form) << "\n";
}
- void dump() {
- print(dbgs());
- }
+ void dump() { print(dbgs()); }
#endif
};
- private:
+private:
struct TableHeaderData {
uint32_t die_offset_base;
SmallVector<Atom, 1> Atoms;
TableHeaderData(ArrayRef<Atom> AtomList, uint32_t offset = 0)
- : die_offset_base(offset), Atoms(AtomList.begin(), AtomList.end()) { }
+ : die_offset_base(offset), Atoms(AtomList.begin(), AtomList.end()) {}
#ifndef NDEBUG
- void print (raw_ostream &O) {
+ void print(raw_ostream &O) {
O << "die_offset_base: " << die_offset_base << "\n";
for (size_t i = 0; i < Atoms.size(); i++)
Atoms[i].print(O);
}
- void dump() {
- print(dbgs());
- }
+ void dump() { print(dbgs()); }
#endif
};
@@ -193,37 +188,38 @@ public:
// HashData[hash_data_count]
public:
struct HashDataContents {
- DIE *Die; // Offsets
+ DIE *Die; // Offsets
char Flags; // Specific flags to output
- HashDataContents(DIE *D, char Flags) :
- Die(D),
- Flags(Flags) { }
- #ifndef NDEBUG
+ HashDataContents(DIE *D, char Flags) : Die(D), Flags(Flags) {}
+#ifndef NDEBUG
void print(raw_ostream &O) const {
O << " Offset: " << Die->getOffset() << "\n";
O << " Tag: " << dwarf::TagString(Die->getTag()) << "\n";
O << " Flags: " << Flags << "\n";
}
- #endif
+#endif
};
+
private:
struct HashData {
StringRef Str;
uint32_t HashValue;
MCSymbol *Sym;
- ArrayRef<HashDataContents*> Data; // offsets
- HashData(StringRef S, ArrayRef<HashDataContents*> Data)
- : Str(S), Data(Data) {
+ ArrayRef<HashDataContents *> Data; // offsets
+ HashData(StringRef S, ArrayRef<HashDataContents *> Data)
+ : Str(S), Data(Data) {
HashValue = DwarfAccelTable::HashDJB(S);
}
- #ifndef NDEBUG
+#ifndef NDEBUG
void print(raw_ostream &O) {
O << "Name: " << Str << "\n";
O << " Hash Value: " << format("0x%x", HashValue) << "\n";
- O << " Symbol: " ;
- if (Sym) Sym->print(O);
- else O << "<none>";
+ O << " Symbol: ";
+ if (Sym)
+ Sym->print(O);
+ else
+ O << "<none>";
O << "\n";
for (size_t i = 0; i < Data.size(); i++) {
O << " Offset: " << Data[i]->Die->getOffset() << "\n";
@@ -231,14 +227,12 @@ private:
O << " Flags: " << Data[i]->Flags << "\n";
}
}
- void dump() {
- print(dbgs());
- }
- #endif
+ void dump() { print(dbgs()); }
+#endif
};
- DwarfAccelTable(const DwarfAccelTable&) LLVM_DELETED_FUNCTION;
- void operator=(const DwarfAccelTable&) LLVM_DELETED_FUNCTION;
+ DwarfAccelTable(const DwarfAccelTable &) LLVM_DELETED_FUNCTION;
+ void operator=(const DwarfAccelTable &) LLVM_DELETED_FUNCTION;
// Internal Functions
void EmitHeader(AsmPrinter *);
@@ -253,24 +247,24 @@ private:
// Output Variables
TableHeader Header;
TableHeaderData HeaderData;
- std::vector<HashData*> Data;
+ std::vector<HashData *> Data;
// String Data
- typedef std::vector<HashDataContents*> DataArray;
- typedef StringMap<DataArray, BumpPtrAllocator&> StringEntries;
+ typedef std::vector<HashDataContents *> DataArray;
+ typedef StringMap<DataArray, BumpPtrAllocator &> StringEntries;
StringEntries Entries;
// Buckets/Hashes/Offsets
- typedef std::vector<HashData*> HashList;
+ typedef std::vector<HashData *> HashList;
typedef std::vector<HashList> BucketList;
BucketList Buckets;
HashList Hashes;
// Public Implementation
- public:
+public:
DwarfAccelTable(ArrayRef<DwarfAccelTable::Atom>);
~DwarfAccelTable();
- void AddName(StringRef, DIE*, char = 0);
+ void AddName(StringRef, DIE *, char = 0);
void FinalizeTable(AsmPrinter *, StringRef);
void Emit(AsmPrinter *, MCSymbol *, DwarfUnits *);
#ifndef NDEBUG
@@ -278,6 +272,5 @@ private:
void dump() { print(dbgs()); }
#endif
};
-
}
#endif