LLVM  6.0.0svn
DWARFUnitIndex.h
Go to the documentation of this file.
1 //===- DWARFUnitIndex.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_DWARF_DWARFUNITINDEX_H
11 #define LLVM_DEBUGINFO_DWARF_DWARFUNITINDEX_H
12 
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/StringRef.h"
16 #include <cstdint>
17 #include <memory>
18 
19 namespace llvm {
20 
21 class raw_ostream;
22 
32 };
33 
35  struct Header {
37  uint32_t NumColumns;
38  uint32_t NumUnits;
39  uint32_t NumBuckets = 0;
40 
41  bool parse(DataExtractor IndexData, uint32_t *OffsetPtr);
42  void dump(raw_ostream &OS) const;
43  };
44 
45 public:
46  class Entry {
47  public:
51  };
52 
53  private:
54  const DWARFUnitIndex *Index;
55  uint64_t Signature;
56  std::unique_ptr<SectionContribution[]> Contributions;
57  friend class DWARFUnitIndex;
58 
59  public:
61  const SectionContribution *getOffset() const;
62 
64  return Contributions.get();
65  }
66 
67  uint64_t getSignature() const { return Signature; }
68  };
69 
70 private:
71  struct Header Header;
72 
73  DWARFSectionKind InfoColumnKind;
74  int InfoColumn = -1;
75  std::unique_ptr<DWARFSectionKind[]> ColumnKinds;
76  std::unique_ptr<Entry[]> Rows;
77 
78  static StringRef getColumnHeader(DWARFSectionKind DS);
79 
80  bool parseImpl(DataExtractor IndexData);
81 
82 public:
84  : InfoColumnKind(InfoColumnKind) {}
85 
86  explicit operator bool() const { return Header.NumBuckets; }
87 
88  bool parse(DataExtractor IndexData);
89  void dump(raw_ostream &OS) const;
90 
91  const Entry *getFromOffset(uint32_t Offset) const;
92  const Entry *getFromHash(uint64_t Offset) const;
93 
95  return makeArrayRef(ColumnKinds.get(), Header.NumColumns);
96  }
97 
99  return makeArrayRef(Rows.get(), Header.NumBuckets);
100  }
101 };
102 
103 } // end namespace llvm
104 
105 #endif // LLVM_DEBUGINFO_DWARF_DWARFUNITINDEX_H
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
ArrayRef< DWARFSectionKind > getColumnKinds() const
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:451
ArrayRef< Entry > getRows() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
const SectionContribution * getOffsets() const
DWARFSectionKind
DWARFUnitIndex(DWARFSectionKind InfoColumnKind)
void dump(raw_ostream &OS) const
const Entry * getFromHash(uint64_t Offset) const
const Entry * getFromOffset(uint32_t Offset) const
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
bool parse(DataExtractor IndexData)
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
uint64_t getSignature() const
const uint64_t Version
Definition: InstrProf.h:867