LLVM  4.0.0
DWARFUnitIndex.h
Go to the documentation of this file.
1 //===-- DWARFUnitIndex.h --------------------------------------------------===//
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_LIB_DEBUGINFO_DWARFUNITINDEX_H
11 #define LLVM_LIB_DEBUGINFO_DWARFUNITINDEX_H
12 
13 #include "llvm/ADT/ArrayRef.h"
15 #include "llvm/Support/Format.h"
17 #include <cstdint>
18 
19 namespace llvm {
20 
30 };
31 
33  struct Header {
35  uint32_t NumColumns;
36  uint32_t NumUnits;
37  uint32_t NumBuckets = 0;
38 
39  bool parse(DataExtractor IndexData, uint32_t *OffsetPtr);
40  void dump(raw_ostream &OS) const;
41  };
42 
43 public:
44  class Entry {
45  public:
49  };
50 
51  private:
52  const DWARFUnitIndex *Index;
53  uint64_t Signature;
54  std::unique_ptr<SectionContribution[]> Contributions;
55  friend class DWARFUnitIndex;
56 
57  public:
59  const SectionContribution *getOffset() const;
61  return Contributions.get();
62  }
63  uint64_t getSignature() const { return Signature; }
64  };
65 
66 private:
67  struct Header Header;
68 
69  DWARFSectionKind InfoColumnKind;
70  int InfoColumn = -1;
71  std::unique_ptr<DWARFSectionKind[]> ColumnKinds;
72  std::unique_ptr<Entry[]> Rows;
73 
74  static StringRef getColumnHeader(DWARFSectionKind DS);
75  bool parseImpl(DataExtractor IndexData);
76 
77 public:
78  bool parse(DataExtractor IndexData);
80  : InfoColumnKind(InfoColumnKind) {}
81  void dump(raw_ostream &OS) const;
82  const Entry *getFromOffset(uint32_t Offset) const;
84  return makeArrayRef(ColumnKinds.get(), Header.NumColumns);
85  }
87  return makeArrayRef(Rows.get(), Header.NumBuckets);
88  }
89 };
90 }
91 
92 #endif
ArrayRef< Entry > getRows() const
const SectionContribution * getOffsets() const
const Entry * getFromOffset(uint32_t Offset) const
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:440
bool parse(DataExtractor IndexData)
ArrayRef< DWARFSectionKind > getColumnKinds() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
DWARFSectionKind
uint32_t Offset
DWARFUnitIndex(DWARFSectionKind InfoColumnKind)
const SectionContribution * getOffset() const
void dump(raw_ostream &OS) const
uint64_t getSignature() const
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
const uint64_t Version
Definition: InstrProf.h:799