Go to the documentation of this file.
24 using namespace dwarf;
26 void DWARFAbbreviationDeclaration::clear() {
31 AttributeSpecs.clear();
32 FixedAttributeSize.reset();
44 Code =
Data.getULEB128(OffsetPtr);
48 CodeByteSize = *OffsetPtr - Offset;
50 if (
Tag == DW_TAG_null) {
54 uint8_t ChildrenByte =
Data.getU8(OffsetPtr);
59 FixedAttributeSize = FixedSizeInfo();
64 auto F =
static_cast<Form>(
Data.getULEB128(OffsetPtr));
66 bool IsImplicitConst = (
F == DW_FORM_implicit_const);
67 if (IsImplicitConst) {
68 int64_t V =
Data.getSLEB128(OffsetPtr);
77 if (FixedAttributeSize)
78 ++FixedAttributeSize->NumAddrs;
81 case DW_FORM_ref_addr:
82 if (FixedAttributeSize)
83 ++FixedAttributeSize->NumRefAddrs;
87 case DW_FORM_GNU_ref_alt:
88 case DW_FORM_GNU_strp_alt:
89 case DW_FORM_line_strp:
90 case DW_FORM_sec_offset:
91 case DW_FORM_strp_sup:
92 if (FixedAttributeSize)
93 ++FixedAttributeSize->NumDwarfOffsets;
100 if (FixedAttributeSize)
101 FixedAttributeSize->NumBytes += *ByteSize;
107 FixedAttributeSize.
reset();
112 }
else if (A == 0 &&
F == 0) {
129 OS <<
'[' << getCode() <<
"] ";
131 OS <<
"\tDW_CHILDREN_" << (hasChildren() ?
"yes" :
"no") <<
'\n';
133 OS <<
formatv(
"\t{0}\t{1}", Spec.Attr, Spec.Form);
134 if (Spec.isImplicitConst())
135 OS <<
'\t' << Spec.getImplicitConstValue();
143 for (
uint32_t i = 0,
e = AttributeSpecs.size();
i !=
e; ++
i) {
144 if (AttributeSpecs[
i].Attr == Attr)
156 uint64_t Offset = DIEOffset + CodeByteSize;
157 for (
uint32_t CurAttrIdx = 0; CurAttrIdx != AttrIndex; ++CurAttrIdx)
159 if (
auto FixedSize = AttributeSpecs[CurAttrIdx].getByteSize(U))
160 Offset += *FixedSize;
170 assert(AttributeSpecs.size() > AttrIndex &&
171 "Attribute Index is out of bounds.");
196 uint64_t Offset = getAttributeOffsetFromIndex(*MatchAttrIndex, DIEOffset, U);
198 return getAttributeValueFromOffset(*MatchAttrIndex, Offset, U);
201 size_t DWARFAbbreviationDeclaration::FixedSizeInfo::getByteSize(
203 size_t ByteSize = NumBytes;
215 if (isImplicitConst())
217 if (ByteSize.HasByteSize)
218 return ByteSize.ByteSize;
228 if (FixedAttributeSize)
229 return FixedAttributeSize->getByteSize(U);
Optional< size_t > getFixedAttributesByteSize(const DWARFUnit &U) const
This is an optimization pass for GlobalISel generic memory operations.
void dump(raw_ostream &OS) const
Optional< int64_t > getByteSize(const DWARFUnit &U) const
Get the fixed byte size of this Form if possible.
const dwarf::FormParams & getFormParams() const
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.
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.
bool extract(DataExtractor Data, uint64_t *OffsetPtr)
DWARFDataExtractor getDebugInfoExtractor() const
Optional< uint32_t > findAttributeIndex(dwarf::Attribute attr) const
Get the index of the specified attribute.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
uint8_t getRefAddrByteSize() const
int64_t getImplicitConstValue() const
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
Optional< uint8_t > getFixedFormByteSize(dwarf::Form Form, FormParams Params)
Get the fixed byte size for a given form.
bool isImplicitConst() 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.
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.