Go to the documentation of this file.
23 enum class DWARFSectionKindV2 {
29 DW_SECT_STR_OFFSETS = 6,
38 return ID >= DW_SECT_INFO &&
ID <= DW_SECT_RNGLISTS &&
43 unsigned IndexVersion) {
44 if (IndexVersion == 5) {
52 return static_cast<uint32_t>(DWARFSectionKindV2::DW_SECT_##T)
58 CASE(STR_OFFSETS, STR_OFFSETS);
59 CASE(EXT_MACINFO, MACINFO);
69 unsigned IndexVersion) {
70 if (IndexVersion == 5)
75 switch (
static_cast<DWARFSectionKindV2
>(
Value)) {
77 case DWARFSectionKindV2::DW_SECT_##S: \
84 CASE(STR_OFFSETS, STR_OFFSETS);
85 CASE(MACINFO, EXT_MACINFO);
94 const uint64_t BeginOffset = *OffsetPtr;
103 *OffsetPtr = BeginOffset;
109 NumColumns = IndexData.
getU32(OffsetPtr);
110 NumUnits = IndexData.
getU32(OffsetPtr);
111 NumBuckets = IndexData.
getU32(OffsetPtr);
116 OS <<
format(
"version = %u, units = %u, slots = %u\n\n",
Version, NumUnits, NumBuckets);
120 bool b = parseImpl(IndexData);
123 Header.NumBuckets = 0;
133 if (!Header.parse(IndexData, &Offset))
137 if (Header.Version == 5)
138 InfoColumnKind = DW_SECT_INFO;
141 Offset, Header.NumBuckets * (8 + 4) +
142 (2 * Header.NumUnits + 1) * 4 * Header.NumColumns))
145 Rows = std::make_unique<Entry[]>(Header.NumBuckets);
147 std::make_unique<Entry::SectionContribution *[]>(Header.NumUnits);
148 ColumnKinds = std::make_unique<DWARFSectionKind[]>(Header.NumColumns);
149 RawSectionIds = std::make_unique<uint32_t[]>(Header.NumColumns);
152 for (
unsigned i = 0;
i != Header.NumBuckets; ++
i)
153 Rows[
i].Signature = IndexData.
getU64(&Offset);
156 for (
unsigned i = 0;
i != Header.NumBuckets; ++
i) {
157 auto Index = IndexData.
getU32(&Offset);
160 Rows[
i].Index =
this;
161 Rows[
i].Contributions =
162 std::make_unique<Entry::SectionContribution[]>(Header.NumColumns);
163 Contribs[Index - 1] = Rows[
i].Contributions.get();
167 for (
unsigned i = 0;
i != Header.NumColumns; ++
i) {
168 RawSectionIds[
i] = IndexData.
getU32(&Offset);
170 if (ColumnKinds[
i] == InfoColumnKind) {
171 if (InfoColumn != -1)
177 if (InfoColumn == -1)
181 for (
unsigned i = 0;
i != Header.NumUnits; ++
i) {
182 auto *Contrib = Contribs[
i];
183 for (
unsigned i = 0;
i != Header.NumColumns; ++
i)
184 Contrib[
i].Offset = IndexData.
getU32(&Offset);
188 for (
unsigned i = 0;
i != Header.NumUnits; ++
i) {
189 auto *Contrib = Contribs[
i];
190 for (
unsigned i = 0;
i != Header.NumColumns; ++
i)
191 Contrib[
i].Length = IndexData.
getU32(&Offset);
199 #define HANDLE_DW_SECT(ID, NAME) \
200 case DW_SECT_##NAME: \
202 #include "llvm/BinaryFormat/Dwarf.def"
220 OS <<
"Index Signature ";
221 for (
unsigned i = 0;
i != Header.NumColumns; ++
i) {
227 OS <<
format(
" Unknown: %-15" PRIu32, RawSectionIds[
i]);
229 OS <<
"\n----- ------------------";
230 for (
unsigned i = 0;
i != Header.NumColumns; ++
i)
231 OS <<
" ------------------------";
233 for (
unsigned i = 0;
i != Header.NumBuckets; ++
i) {
235 if (
auto *Contribs = Row.Contributions.get()) {
236 OS <<
format(
"%5u 0x%016" PRIx64
" ",
i + 1, Row.Signature);
237 for (
unsigned i = 0;
i != Header.NumColumns; ++
i) {
238 auto &Contrib = Contribs[
i];
239 OS <<
format(
"[0x%08x, 0x%08x) ", Contrib.Offset,
240 Contrib.Offset + Contrib.Length);
250 for (;
i != Index->Header.NumColumns; ++
i)
251 if (Index->ColumnKinds[
i] == Sec)
252 return &Contributions[
i];
258 return &Contributions[Index->InfoColumn];
263 if (OffsetLookup.empty()) {
265 if (Rows[
i].Contributions)
266 OffsetLookup.push_back(&Rows[
i]);
268 return E1->Contributions[InfoColumn].Offset <
269 E2->Contributions[InfoColumn].Offset;
273 return E2->Contributions[InfoColumn].Offset <= Offset;
275 if (
I == OffsetLookup.begin())
279 const auto &InfoContrib =
E->Contributions[InfoColumn];
280 if ((InfoContrib.Offset + InfoContrib.Length) <= Offset)
289 auto HP = ((
S >> 32) &
Mask) | 1;
297 if (Rows[
H].Index ==
nullptr)
constexpr bool isKnownV5SectionID(uint32_t ID)
This is an optimization pass for GlobalISel generic memory operations.
static std::string getSignature(FunctionType *FTy)
@ DW_SECT_EXT_unknown
Denotes a value read from an index section that does not correspond to any of the supported standards...
void dump(raw_ostream &OS) const
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
uint32_t serializeSectionKind(DWARFSectionKind Kind, unsigned IndexVersion)
Convert the internal value for a section kind to an on-disk value.
const Entry * getFromHash(uint64_t Offset) const
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
DWARFSectionKind
The enum of section identifiers to be used in internal interfaces.
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int b
bool parse(DataExtractor IndexData)
This class implements an extremely fast bulk output stream that can only output to a stream.
const Entry * getFromOffset(uint32_t Offset) const
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static llvm::Error parse(DataExtractor &Data, uint64_t BaseAddr, LineEntryCallback const &Callback)
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
DWARFSectionKind deserializeSectionKind(uint32_t Value, unsigned IndexVersion)
Convert a value read from an index section to the internal representation.
FormattedString left_justify(StringRef Str, unsigned Width)
left_justify - append spaces after string so total output is Width characters.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
auto partition_point(R &&Range, Predicate P)
Binary search for the first iterator in a range where a predicate is false.
void sort(IteratorTy Start, IteratorTy End)
LLVM Value Representation.
const SectionContribution * getContribution() const