21 uint64_t *OffsetPtr) {
25 NumColumns = IndexData.
getU32(OffsetPtr);
26 NumUnits = IndexData.
getU32(OffsetPtr);
27 NumBuckets = IndexData.
getU32(OffsetPtr);
32 OS <<
format(
"version = %u slots = %u\n\n",
Version, NumBuckets);
36 bool b = parseImpl(IndexData);
39 Header.NumBuckets = 0;
49 if (!Header.parse(IndexData, &Offset))
53 Offset, Header.NumBuckets * (8 + 4) +
54 (2 * Header.NumUnits + 1) * 4 * Header.NumColumns))
57 Rows = std::make_unique<Entry[]>(Header.NumBuckets);
59 std::make_unique<Entry::SectionContribution *[]>(Header.NumUnits);
60 ColumnKinds = std::make_unique<DWARFSectionKind[]>(Header.NumColumns);
63 for (
unsigned i = 0; i != Header.NumBuckets; ++i)
64 Rows[i].Signature = IndexData.
getU64(&Offset);
67 for (
unsigned i = 0; i != Header.NumBuckets; ++i) {
72 Rows[i].Contributions =
73 std::make_unique<Entry::SectionContribution[]>(Header.NumColumns);
74 Contribs[
Index - 1] = Rows[i].Contributions.get();
78 for (
unsigned i = 0; i != Header.NumColumns; ++i) {
80 if (ColumnKinds[i] == InfoColumnKind) {
91 for (
unsigned i = 0; i != Header.NumUnits; ++i) {
92 auto *Contrib = Contribs[i];
93 for (
unsigned i = 0; i != Header.NumColumns; ++i)
94 Contrib[i].Offset = IndexData.
getU32(&Offset);
98 for (
unsigned i = 0; i != Header.NumUnits; ++i) {
99 auto *Contrib = Contribs[i];
100 for (
unsigned i = 0; i != Header.NumColumns; ++i)
101 Contrib[i].Length = IndexData.
getU32(&Offset);
129 OS <<
"Index Signature ";
130 for (
unsigned i = 0; i != Header.NumColumns; ++i)
131 OS <<
' ' <<
left_justify(getColumnHeader(ColumnKinds[i]), 24);
132 OS <<
"\n----- ------------------";
133 for (
unsigned i = 0; i != Header.NumColumns; ++i)
134 OS <<
" ------------------------";
136 for (
unsigned i = 0; i != Header.NumBuckets; ++i) {
138 if (
auto *Contribs = Row.Contributions.get()) {
139 OS <<
format(
"%5u 0x%016" PRIx64
" ", i + 1, Row.Signature);
140 for (
unsigned i = 0; i != Header.NumColumns; ++i) {
141 auto &Contrib = Contribs[i];
142 OS <<
format(
"[0x%08x, 0x%08x) ", Contrib.Offset,
143 Contrib.Offset + Contrib.Length);
153 for (; i !=
Index->Header.NumColumns; ++i)
154 if (
Index->ColumnKinds[i] == Sec)
155 return &Contributions[i];
161 return &Contributions[
Index->InfoColumn];
166 if (OffsetLookup.empty()) {
167 for (
uint32_t i = 0; i != Header.NumBuckets; ++i)
168 if (Rows[i].Contributions)
169 OffsetLookup.push_back(&Rows[i]);
171 return E1->Contributions[InfoColumn].Offset <
172 E2->Contributions[InfoColumn].Offset;
176 return E2->Contributions[InfoColumn].Offset <=
Offset;
178 if (I == OffsetLookup.begin())
182 const auto &InfoContrib =
E->Contributions[InfoColumn];
183 if ((InfoContrib.Offset + InfoContrib.Length) <=
Offset)
189 uint64_t
Mask = Header.NumBuckets - 1;
192 auto HP = ((S >> 32) & Mask) | 1;
193 while (Rows[
H].
getSignature() != S && Rows[
H].getSignature() != 0)
FormattedString left_justify(StringRef Str, unsigned Width)
left_justify - append spaces after string so total output is Width characters.
This class represents lattice values for constants.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
static void dump(StringRef Title, SpillInfo const &Spills)
const SectionContribution * getOffset() const
auto partition_point(R &&Range, Predicate P) -> decltype(adl_begin(Range))
Binary search for the first iterator in a range where a predicate is false.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void sort(IteratorTy Start, IteratorTy End)
void dump(raw_ostream &OS) const
const Entry * getFromHash(uint64_t Offset) const
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
const Entry * getFromOffset(uint32_t Offset) const
This class implements an extremely fast bulk output stream that can only output to a stream...
bool parse(DataExtractor IndexData)
StringRef - Represent a constant reference to a string, i.e.
static llvm::Error parse(DataExtractor &Data, uint64_t BaseAddr, LineEntryCallback const &Callback)
static std::string getSignature(FunctionType *FTy)