24 std::optional<DWARFFormValue> Location = Die.
find(dwarf::DW_AT_location);
28 std::optional<ArrayRef<uint8_t>>
Block = Location->getAsBlock();
35 U->getFormParams().Format);
38 return !
Op.isError() && (
Op.getCode() == dwarf::DW_OP_addr ||
39 Op.getCode() == dwarf::DW_OP_addrx);
44 assert(Die.
getTag() == dwarf::DW_TAG_member &&
"expected a DW_TAG_member");
54 {dwarf::DW_AT_data_member_location, dwarf::DW_AT_data_bit_offset});
59 case dwarf::DW_TAG_class_type:
60 case dwarf::DW_TAG_enumeration_type:
61 case dwarf::DW_TAG_interface_type:
62 case dwarf::DW_TAG_structure_type:
63 case dwarf::DW_TAG_union_type:
74 case dwarf::DW_TAG_member:
76 case dwarf::DW_TAG_enumerator:
77 case dwarf::DW_TAG_inheritance:
88 const char *Name =
nullptr;
93 std::optional<DWARFFormValue>
Ref;
94 if (!(
Ref = Die.
find(dwarf::DW_AT_specification)) &&
95 !(
Ref = Die.
find(dwarf::DW_AT_abstract_origin)))
110 if (!Name && Die.
getTag() == dwarf::DW_TAG_namespace)
111 Name =
"(anonymous namespace)";
117 Parent.
getTag() == dwarf::DW_TAG_module ||
121 return djbHash(Name ? Name :
"",
140 std::map<uint64_t, uint64_t> LineTableMapping;
144 if (LT.Rows.empty()) {
145 for (
const auto &[
Off, Row] : LineTableMapping)
146 SeqOffToFirstRow[
Off] = Row;
191 constexpr uint64_t DummyKey = std::numeric_limits<uint64_t>::max();
192 constexpr uint64_t DummyVal = std::numeric_limits<uint64_t>::max();
193 LineTableMapping[DummyKey] = DummyVal;
195 for (
auto [NextSeqOff, NextRow] : LineTableMapping) {
196 auto StmtAttrSmallerThanNext = [
N = NextSeqOff](
uint64_t SA) {
199 auto SeqStartSmallerThanNext = [
N = NextRow](
uint64_t Row) {
204 while (!StmtAttrsRef.
empty() && !SeqStartRowsRef.
empty() &&
205 StmtAttrSmallerThanNext(StmtAttrsRef.
front()) &&
206 SeqStartSmallerThanNext(SeqStartRowsRef.
front())) {
213 StmtAttrsRef = StmtAttrsRef.
drop_while(StmtAttrSmallerThanNext);
214 SeqStartRowsRef = SeqStartRowsRef.
drop_while(SeqStartSmallerThanNext);
215 if (NextSeqOff != DummyKey)
216 SeqOffToFirstRow[NextSeqOff] = NextRow;
219 if (!StmtAttrsRef.
empty() && StmtAttrsRef.
front() == NextSeqOff)
221 if (!SeqStartRowsRef.
empty() && SeqStartRowsRef.
front() == NextRow)
222 SeqStartRowsRef = SeqStartRowsRef.
drop_front();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the SmallPtrSet class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
ArrayRef< T > drop_while(PredicateT Pred) const
Return a copy of *this with the first N elements satisfying the given predicate removed.
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
const T & front() const
Get the first element.
bool empty() const
Check if the array is empty.
const T & consume_front()
consume_front() - Returns the first element and drops it from ArrayRef.
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
LLVM_ABI DWARFDie getParent() const
Get the parent of this DIE object.
LLVM_ABI std::optional< DWARFFormValue > find(dwarf::Attribute Attr) const
Extract the specified attribute from this DIE.
DWARFUnit * getDwarfUnit() const
const DWARFDebugInfoEntry * getDebugInfoEntry() const
LLVM_ABI const char * getName(DINameKind Kind) const
Return the DIE name resolving DW_AT_specification or DW_AT_abstract_origin references if necessary.
dwarf::Tag getTag() const
This class represents an Operation in the Expression.
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
Class representing an expression and its matching format.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An efficient, type-erasing, non-owning reference to a callable.
LLVM_ABI bool isIdentifiedByChildren(dwarf::Tag Tag)
Test if an unnamed type with tag Tag is identified by its children, which tell it apart from other un...
LLVM_ABI bool hasImplicitAddressLocation(const DWARFDie &Die)
Test if the location of variable Die contains a global address but only uses to compute the variable'...
LLVM_ABI void buildStmtSeqOffsetToFirstRowIndex(const DWARFDebugLine::LineTable <, ArrayRef< uint64_t > SortedStmtSeqOffsets, DenseMap< uint64_t, uint64_t > &SeqOffToFirstRow)
Build a map from an input DW_AT_LLVM_stmt_sequence byte offset to the first-row index (in LT....
LLVM_ABI uint32_t hashFullyQualifiedName(DWARFDie Die, function_ref< DWARFDie(const DWARFDie &, const DWARFFormValue &)> ResolveRef)
Hash the fully qualified name of type Die for the Apple accelerator tables.
Error finiteLoop(function_ref< Expected< bool >()> Iteration, size_t MaxCounter=100000)
This function calls Iteration() until it returns false.
LLVM_ABI bool isStaticDataMember(const DWARFDie &Die)
Test if the DW_TAG_member Die is a DWARF 2-4 style static data member: a declaration with no storage ...
LLVM_ABI bool isIdentifyingChild(const DWARFDie &Die)
Test if Die is a child that identifies its unnamed parent type.
bool isUnitType(uint8_t UnitType)
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 enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
@ Ref
The access may reference the value stored in memory.
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
uint32_t djbHash(StringRef Buffer, uint32_t H=5381)
The Bernstein hash function used by the DWARF accelerator tables.
void consumeError(Error Err)
Consume a Error without doing anything.
Represents a series of contiguous machine instructions.
uint64_t StmtSeqOffset
The offset into the line table where this sequence begins.