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