Move DebugInfo to DebugInfo/DWARF.
[oota-llvm.git] / 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 #include "llvm/ADT/SmallVector.h"
11 #include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
12 #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
13 #include <cstdint>
14
15 namespace llvm {
16
17 class DWARFAcceleratorTable {
18
19   struct Header {
20     uint32_t Magic;
21     uint16_t Version;
22     uint16_t HashFunction;
23     uint32_t NumBuckets;
24     uint32_t NumHashes;
25     uint32_t HeaderDataLength;
26   };
27
28   struct HeaderData {
29     typedef uint16_t AtomType;
30     typedef uint16_t Form;
31     uint32_t DIEOffsetBase;
32     SmallVector<std::pair<AtomType, Form>, 3> Atoms;
33   };
34
35   struct Header Hdr;
36   struct HeaderData HdrData;
37   DataExtractor AccelSection;
38   DataExtractor StringSection;
39   const RelocAddrMap& Relocs;
40 public:
41   DWARFAcceleratorTable(DataExtractor AccelSection, DataExtractor StringSection,
42                         const RelocAddrMap &Relocs)
43     : AccelSection(AccelSection), StringSection(StringSection), Relocs(Relocs) {}
44
45   bool extract();
46   void dump(raw_ostream &OS) const;
47 };
48
49 }