]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304149, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / DebugInfo / DWARF / DWARFAcceleratorTable.h
1 //===- DWARFAcceleratorTable.h ----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H
11 #define LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H
12
13 #include "llvm/ADT/SmallVector.h"
14 #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
15 #include "llvm/Support/DataExtractor.h"
16 #include "llvm/Support/Dwarf.h"
17 #include <cstdint>
18 #include <utility>
19
20 namespace llvm {
21
22 class raw_ostream;
23
24 class DWARFAcceleratorTable {
25   struct Header {
26     uint32_t Magic;
27     uint16_t Version;
28     uint16_t HashFunction;
29     uint32_t NumBuckets;
30     uint32_t NumHashes;
31     uint32_t HeaderDataLength;
32   };
33
34   struct HeaderData {
35     typedef uint16_t AtomType;
36     typedef dwarf::Form Form;
37     uint32_t DIEOffsetBase;
38     SmallVector<std::pair<AtomType, Form>, 3> Atoms;
39   };
40
41   struct Header Hdr;
42   struct HeaderData HdrData;
43   DataExtractor AccelSection;
44   DataExtractor StringSection;
45   const RelocAddrMap& Relocs;
46
47 public:
48   DWARFAcceleratorTable(DataExtractor AccelSection, DataExtractor StringSection,
49                         const RelocAddrMap &Relocs)
50     : AccelSection(AccelSection), StringSection(StringSection), Relocs(Relocs) {}
51
52   bool extract();
53   void dump(raw_ostream &OS) const;
54 };
55
56 } // end namespace llvm
57
58 #endif // LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H