Go to the documentation of this file.
22 using namespace dwarf;
24 void DWARFAbbreviationDeclaration::clear() {
29 AttributeSpecs.clear();
30 FixedAttributeSize.reset();
42 Code =
Data.getULEB128(OffsetPtr);
46 CodeByteSize = *OffsetPtr - Offset;
48 if (
Tag == DW_TAG_null) {
52 uint8_t ChildrenByte =
Data.getU8(OffsetPtr);
57 FixedAttributeSize = FixedSizeInfo();
62 auto F =
static_cast<Form>(
Data.getULEB128(OffsetPtr));
64 bool IsImplicitConst = (
F == DW_FORM_implicit_const);
65 if (IsImplicitConst) {
66 int64_t V =
Data.getSLEB128(OffsetPtr);
70 std::optional<uint8_t> ByteSize;
75 if (FixedAttributeSize)
76 ++FixedAttributeSize->NumAddrs;
79 case DW_FORM_ref_addr:
80 if (FixedAttributeSize)
81 ++FixedAttributeSize->NumRefAddrs;
85 case DW_FORM_GNU_ref_alt:
86 case DW_FORM_GNU_strp_alt:
87 case DW_FORM_line_strp:
88 case DW_FORM_sec_offset:
89 case DW_FORM_strp_sup:
90 if (FixedAttributeSize)
91 ++FixedAttributeSize->NumDwarfOffsets;
98 if (FixedAttributeSize)
99 FixedAttributeSize->NumBytes += *ByteSize;
105 FixedAttributeSize.reset();
110 }
else if (A == 0 &&
F == 0) {
127 OS <<
'[' << getCode() <<
"] ";
129 OS <<
"\tDW_CHILDREN_" << (hasChildren() ?
"yes" :
"no") <<
'\n';
132 if (
Spec.isImplicitConst())
133 OS <<
'\t' <<
Spec.getImplicitConstValue();
139 std::optional<uint32_t>
141 for (
uint32_t i = 0,
e = AttributeSpecs.size();
i !=
e; ++
i) {
142 if (AttributeSpecs[
i].Attr == Attr)
154 uint64_t Offset = DIEOffset + CodeByteSize;
155 for (
uint32_t CurAttrIdx = 0; CurAttrIdx != AttrIndex; ++CurAttrIdx)
157 if (
auto FixedSize = AttributeSpecs[CurAttrIdx].getByteSize(U))
158 Offset += *FixedSize;
165 std::optional<DWARFFormValue>
168 assert(AttributeSpecs.size() > AttrIndex &&
169 "Attribute Index is out of bounds.");
173 if (
Spec.isImplicitConst())
175 Spec.getImplicitConstValue());
184 std::optional<DWARFFormValue>
190 std::optional<uint32_t> MatchAttrIndex = findAttributeIndex(Attr);
194 uint64_t Offset = getAttributeOffsetFromIndex(*MatchAttrIndex, DIEOffset, U);
196 return getAttributeValueFromOffset(*MatchAttrIndex, Offset, U);
199 size_t DWARFAbbreviationDeclaration::FixedSizeInfo::getByteSize(
201 size_t ByteSize = NumBytes;
213 if (isImplicitConst())
215 if (ByteSize.HasByteSize)
216 return ByteSize.ByteSize;
217 std::optional<int64_t>
S;
226 if (FixedAttributeSize)
227 return FixedAttributeSize->getByteSize(U);
std::optional< size_t > getFixedAttributesByteSize(const DWARFUnit &U) const
This is an optimization pass for GlobalISel generic memory operations.
void dump(raw_ostream &OS) const
std::optional< uint32_t > findAttributeIndex(dwarf::Attribute attr) const
Get the index of the specified attribute.
const dwarf::FormParams & getFormParams() const
static void clear(coro::Shape &Shape)
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
unsigned getTag(StringRef TagString)
This class implements an extremely fast bulk output stream that can only output to a stream.
DWARFAbbreviationDeclaration::AttributeSpec AttributeSpec
bool extract(DataExtractor Data, uint64_t *OffsetPtr)
DWARFDataExtractor getDebugInfoExtractor() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
uint8_t getRefAddrByteSize() const
std::optional< DWARFFormValue > getAttributeValueFromOffset(uint32_t AttrIndex, uint64_t Offset, const DWARFUnit &U) const
Extract a DWARF form value from a DIE speccified by attribute index and its offset.
std::optional< uint8_t > getFixedFormByteSize(dwarf::Form Form, FormParams Params)
Get the fixed byte size for a given form.
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
uint8_t getDwarfOffsetByteSize() const
uint8_t getAddressByteSize() const
DWARFAbbreviationDeclaration()
uint64_t getAttributeOffsetFromIndex(uint32_t AttrIndex, uint64_t DIEOffset, const DWARFUnit &U) const
Compute an offset from a DIE specified by DIE offset and attribute index.
std::optional< int64_t > getByteSize(const DWARFUnit &U) const
Get the fixed byte size of this Form if possible.
std::optional< DWARFFormValue > getAttributeValue(const uint64_t DIEOffset, const dwarf::Attribute Attr, const DWARFUnit &U) const
Extract a DWARF form value from a DIE specified by DIE offset.