18#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
39 if (U.getOrigUnit().getDIEAtIndex(
Idx).getTag() == dwarf::DW_TAG_subprogram)
41 Idx = U.getInfo(
Idx).ParentIdx;
55 if (SysRoot.empty()) {
65 for (
auto &
I : Info) {
74 if (
DIE.
getTag() != dwarf::DW_TAG_variable &&
78 std::optional<DWARFFormValue>
Value;
79 if (!(
Value =
DIE.find(dwarf::DW_AT_location))) {
80 if ((
Value =
DIE.find(dwarf::DW_AT_const_value)) &&
86 if (
auto ExprLockBlock =
Value->getAsBlock()) {
89 U->getContext().isLittleEndian(),
90 U->getAddressByteSize());
92 U->getFormParams().Format);
99 switch (It->getCode()) {
100 case dwarf::DW_OP_const2u:
101 case dwarf::DW_OP_const4u:
102 case dwarf::DW_OP_const8u:
103 case dwarf::DW_OP_const2s:
104 case dwarf::DW_OP_const4s:
105 case dwarf::DW_OP_const8s:
107 NextIt->getCode() != dwarf::DW_OP_form_tls_address)
110 case dwarf::DW_OP_constx:
111 case dwarf::DW_OP_addr:
112 case dwarf::DW_OP_addrx:
125 NextUnitOffset = StartOffset;
127 NextUnitOffset += (DwarfVersion >= 5) ? 12 : 11;
128 NextUnitOffset += NewUnit->getUnitDie().getSize();
130 return NextUnitOffset;
137 ForwardDIEReferences.emplace_back(Die, RefUnit, Ctxt, Attr);
141 for (
const auto &
Ref : ForwardDIEReferences) {
146 std::tie(RefDie, RefUnit, Ctxt, Attr) =
Ref;
149 "Canonical die offset is not set");
159 Labels.
insert({LabelLowPc, PcOffset});
164 Ranges.
insert({FuncLowPc, FuncHighPc}, PcOffset);
166 LowPc = std::min(*LowPc, FuncLowPc + PcOffset);
168 LowPc = FuncLowPc + PcOffset;
169 this->HighPc = std::max(HighPc, FuncHighPc + PcOffset);
173 if (Die.
getTag() == dwarf::DW_TAG_compile_unit) {
174 UnitRangeAttribute = Attr;
187 Namespaces.emplace_back(
Name, Die);
192 bool SkipPubSection) {
193 ObjC.emplace_back(
Name, Die, SkipPubSection);
198 bool SkipPubSection) {
199 Pubnames.emplace_back(
Name, Die, SkipPubSection);
204 bool ObjcClassImplementation,
206 Pubtypes.emplace_back(
Name, Die, QualifiedNameHash, ObjcClassImplementation);
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void insert(AddressRange Range, int64_t Value)
Stores all information relating to a compile unit, be it in its original instance in the object file ...
void addFunctionRange(uint64_t LowPC, uint64_t HighPC, int64_t PCOffset)
Add a function range [LowPC, HighPC) that is relocated by applying offset PCOffset.
void fixupForwardReferences()
Apply all fixups recorded by noteForwardReference().
void noteForwardReference(DIE *Die, const CompileUnit *RefUnit, DeclContext *Ctxt, PatchLocation Attr)
Keep track of a forward reference to DIE Die in RefUnit by Attr.
void noteLocationAttribute(PatchLocation Attr)
Keep track of a location attribute pointing to a location list in the debug_loc section.
void addNameAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name, bool SkipPubnamesSection=false)
Add a name accelerator entry for Die with Name.
void addNamespaceAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name)
Add a name accelerator entry for Die with Name.
DWARFUnit & getOrigUnit() const
StringRef getSysRoot()
Return the DW_AT_LLVM_sysroot of the compile unit or an empty StringRef.
void noteRangeAttribute(const DIE &Die, PatchLocation Attr)
Keep track of a DW_AT_range attribute that we will need to patch up later.
void addObjCAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name, bool SkipPubnamesSection=false)
Add various accelerator entries for Die with Name which is stored in the string table at Offset.
void addTypeAccelerator(const DIE *Die, DwarfStringPoolEntryRef Name, bool ObjcClassImplementation, uint32_t QualifiedNameHash)
Add a type accelerator entry for Die with Name which is stored in the string table at Offset.
uint64_t getStartOffset() const
uint64_t computeNextUnitOffset(uint16_t DwarfVersion)
Compute the end offset for this unit.
void addLabelLowPc(uint64_t LabelLowPc, int64_t PcOffset)
Add the low_pc of a label that is relocated by applying offset PCOffset.
void markEverythingAsKept()
Mark every DIE in this unit as kept.
A structured debug information entry.
unsigned getOffset() const
Get the compile/type unit relative offset of this DIE.
dwarf::Tag getTag() const
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
An iterator to go through the expression operations.
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly=true)
DWARFDie getDIEAtIndex(unsigned Index)
Return the DIE object at the given index Index.
A DeclContext is a named program scope that is used for ODR uniquing of types.
uint32_t getCanonicalDIEOffset() const
bool hasCanonicalDIE() const
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
DwarfStringPoolEntryRef: Dwarf string pool entry reference.
Class representing an expression and its matching format.
reference emplace_back(ArgTypes &&... Args)
StringRef - Represent a constant reference to a string, i.e.
std::string str() const
str - Get the contents as an std::string.
LLVM Value Representation.
StringRef toStringRef(const std::optional< DWARFFormValue > &V, StringRef Default={})
Take an optional DWARFFormValue and try to extract a string value from it.
std::optional< uint64_t > toUnsigned(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract an unsigned constant.
This is an optimization pass for GlobalISel generic memory operations.
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
static bool inFunctionScope(CompileUnit &U, unsigned Idx)
Check if the DIE at Idx is in the scope of a function.
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
@ Ref
The access may reference the value stored in memory.
DeclContext * Ctxt
ODR Declaration context.
bool InModuleScope
Is DIE in the clang module scope?
DIE * Clone
Cloned version of that DIE.
int64_t AddrAdjust
Address offset to apply to the described entity.
uint32_t ParentIdx
The index of this DIE's parent.
bool UnclonedReference
Is this a reference to a DIE that hasn't been cloned yet?
LLVM_DUMP_METHOD void dump()
bool ODRMarkingDone
Is ODR marking done?
bool InDebugMap
Was this DIE's entity found in the map?
bool Prune
Is this a pure forward declaration we can strip?
bool Keep
Is the DIE part of the linked output?
bool Incomplete
Does DIE transitively refer an incomplete decl?
void set(uint64_t New) const