26 NumColumns = IndexData.
getU32(OffsetPtr);
27 NumUnits = IndexData.
getU32(OffsetPtr);
28 NumBuckets = IndexData.
getU32(OffsetPtr);
33 OS <<
format(
"version = %u slots = %u\n\n",
Version, NumBuckets);
37 bool b = parseImpl(IndexData);
40 Header.NumBuckets = 0;
50 if (!Header.parse(IndexData, &Offset))
54 Offset, Header.NumBuckets * (8 + 4) +
55 (2 * Header.NumUnits + 1) * 4 * Header.NumColumns))
58 Rows = llvm::make_unique<Entry[]>(Header.NumBuckets);
60 llvm::make_unique<Entry::SectionContribution *[]>(Header.NumUnits);
61 ColumnKinds = llvm::make_unique<DWARFSectionKind[]>(Header.NumColumns);
64 for (
unsigned i = 0; i != Header.NumBuckets; ++i)
65 Rows[i].Signature = IndexData.
getU64(&Offset);
68 for (
unsigned i = 0; i != Header.NumBuckets; ++i) {
73 Rows[i].Contributions =
74 llvm::make_unique<Entry::SectionContribution[]>(Header.NumColumns);
75 Contribs[
Index - 1] = Rows[i].Contributions.get();
79 for (
unsigned i = 0; i != Header.NumColumns; ++i) {
81 if (ColumnKinds[i] == InfoColumnKind) {
92 for (
unsigned i = 0; i != Header.NumUnits; ++i) {
93 auto *Contrib = Contribs[i];
94 for (
unsigned i = 0; i != Header.NumColumns; ++i)
95 Contrib[i].Offset = IndexData.
getU32(&Offset);
99 for (
unsigned i = 0; i != Header.NumUnits; ++i) {
100 auto *Contrib = Contribs[i];
101 for (
unsigned i = 0; i != Header.NumColumns; ++i)
102 Contrib[i].Length = IndexData.
getU32(&Offset);
130 OS <<
"Index Signature ";
131 for (
unsigned i = 0; i != Header.NumColumns; ++i)
132 OS <<
' ' <<
left_justify(getColumnHeader(ColumnKinds[i]), 24);
133 OS <<
"\n----- ------------------";
134 for (
unsigned i = 0; i != Header.NumColumns; ++i)
135 OS <<
" ------------------------";
137 for (
unsigned i = 0; i != Header.NumBuckets; ++i) {
139 if (
auto *Contribs = Row.Contributions.get()) {
140 OS <<
format(
"%5u 0x%016" PRIx64
" ", i + 1, Row.Signature);
141 for (
unsigned i = 0; i != Header.NumColumns; ++i) {
142 auto &Contrib = Contribs[i];
143 OS <<
format(
"[0x%08x, 0x%08x) ", Contrib.Offset,
144 Contrib.Offset + Contrib.Length);
154 for (; i !=
Index->Header.NumColumns; ++i)
155 if (
Index->ColumnKinds[i] == Sec)
156 return &Contributions[i];
162 return &Contributions[
Index->InfoColumn];
167 if (OffsetLookup.empty()) {
168 for (
uint32_t i = 0; i != Header.NumBuckets; ++i)
169 if (Rows[i].Contributions)
170 OffsetLookup.push_back(&Rows[i]);
172 return E1->Contributions[InfoColumn].Offset <
173 E2->Contributions[InfoColumn].Offset;
178 return Offset < E2->Contributions[InfoColumn].Offset;
180 if (I == OffsetLookup.begin())
184 const auto &InfoContrib =
E->Contributions[InfoColumn];
185 if ((InfoContrib.Offset + InfoContrib.Length) <=
Offset)
191 uint64_t
Mask = Header.NumBuckets - 1;
194 auto HP = ((S >> 32) & Mask) | 1;
195 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
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::Expected< Value > parse(llvm::StringRef JSON)
Parses the provided JSON source, or returns a ParseError.
#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
auto upper_bound(R &&Range, ForwardIt I) -> decltype(adl_begin(Range))
Provide wrappers to std::upper_bound which take ranges instead of having to pass begin/end explicitly...
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 std::string getSignature(FunctionType *FTy)