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) {
69 auto Index = IndexData.
getU32(&Offset);
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);
126 if (!Header.NumBuckets)
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 for (
uint32_t i = 0; i != Header.NumBuckets; ++i)
168 if (
const auto &Contribs = Rows[i].Contributions)
169 if (Contribs[InfoColumn].Offset == Offset)
FormattedString left_justify(StringRef Str, unsigned Width)
left_justify - append spaces after string so total output is Width characters.
static void dump(StringRef Title, SpillInfo const &Spills)
void dump(raw_ostream &OS) const
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
const SectionContribution * getOffset() const
llvm_unreachable("Unknown RegBank!")
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.