Go to the documentation of this file.
26 #define DEBUG_TYPE "dwarfdebug"
33 for (
const auto &V : Die.
values())
34 if (V.getAttribute() == Attr)
35 return V.getDIEString().getString();
55 uint8_t Byte =
Value & 0x7f;
67 uint8_t Byte =
Value & 0x7f;
69 More = !((((
Value == 0) && ((Byte & 0x40) == 0)) ||
70 ((
Value == -1) && ((Byte & 0x40) != 0))));
78 void DIEHash::addParentContext(
const DIE &Parent) {
85 const DIE *Cur = &Parent;
87 Parents.push_back(Cur);
91 Cur->
getTag() == dwarf::DW_TAG_type_unit);
111 void DIEHash::collectAttributes(
const DIE &Die, DIEAttrs &
Attrs) {
113 for (
const auto &V : Die.
values()) {
117 switch (V.getAttribute()) {
118 #define HANDLE_DIE_HASH_ATTR(NAME) \
122 #include "DIEHashAttributes.def"
138 if (
const DIE *Parent = Entry.getParent())
139 addParentContext(*Parent);
156 unsigned DieNumber) {
170 assert(
Tag != dwarf::DW_TAG_friend &&
"No current LLVM clients emit friend "
171 "tags. Add support here when there's "
175 if ((
Tag == dwarf::DW_TAG_pointer_type ||
176 Tag == dwarf::DW_TAG_reference_type ||
177 Tag == dwarf::DW_TAG_rvalue_reference_type ||
178 Tag == dwarf::DW_TAG_ptr_to_member_type) &&
192 unsigned &DieNumber = Numbering[&Entry];
194 hashRepeatedTypeReference(
Attribute, DieNumber);
205 DieNumber = Numbering.size();
210 unsigned &DieNumber = Numbering[&Entry];
216 DieNumber = Numbering.size();
224 for (
const auto &V : Values)
225 if (V.getType() == DIEValue::isBaseTypeRef) {
227 *
CU->ExprRefedBaseTypes[V.getDIEBaseTypeRef().getIndex()].Die;
230 "Base types referenced from DW_OP_convert should have a name");
231 hashNestedType(
C,
Name);
237 void DIEHash::hashLocList(
const DIELocList &LocList) {
265 case DIEValue::isEntry:
271 switch (
Value.getForm()) {
272 case dwarf::DW_FORM_data1:
273 case dwarf::DW_FORM_data2:
274 case dwarf::DW_FORM_data4:
275 case dwarf::DW_FORM_data8:
276 case dwarf::DW_FORM_udata:
277 case dwarf::DW_FORM_sdata:
283 case dwarf::DW_FORM_flag_present:
284 case dwarf::DW_FORM_flag:
293 case DIEValue::isString:
297 addString(
Value.getDIEString().getString());
299 case DIEValue::isInlineString:
303 addString(
Value.getDIEInlineString().getString());
306 case DIEValue::isLoc:
307 case DIEValue::isLocList:
313 hashBlockData(
Value.getDIEBlock().values());
316 hashBlockData(
Value.getDIELoc().values());
321 hashLocList(
Value.getDIELocList());
325 case DIEValue::isExpr:
326 case DIEValue::isLabel:
327 case DIEValue::isBaseTypeRef:
328 case DIEValue::isDelta:
329 case DIEValue::isAddrOffset:
337 #define HANDLE_DIE_HASH_ATTR(NAME) \
340 hashAttribute(Attrs.NAME, Tag); \
342 #include "DIEHashAttributes.def"
347 void DIEHash::addAttributes(
const DIE &Die) {
349 collectAttributes(Die,
Attrs);
368 void DIEHash::computeHash(
const DIE &Die) {
380 if (
isType(
C.getTag()) || (
C.getTag() == dwarf::DW_TAG_subprogram &&
isType(
C.getParent()->getTag()))) {
384 hashNestedType(
C,
Name);
403 if (!DWOName.
empty())
415 return Result.high();
427 addParentContext(*Parent);
439 return Result.high();
Byte stream of .debug_loc entries.
void hashRawTypeReference(const DIE &Entry)
This is an optimization pass for GlobalISel generic memory operations.
void update(ArrayRef< uint8_t > Data)
Updates the hash for the byte stream provided.
void emitDebugLocEntry(ByteStreamer &Streamer, const DebugLocStream::Entry &Entry, const DwarfCompileUnit *CU)
Emit an entry for the debug loc section.
const List & getList(size_t LI) const
DwarfDebug * getDwarfDebug()
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
auto reverse(ContainerTy &&C, std::enable_if_t< has_rbegin< ContainerTy >::value > *=nullptr)
A structured debug information entry.
dwarf::Tag getTag() const
void addULEB128(uint64_t Value)
Encodes and adds.
void addSLEB128(int64_t Value)
Encodes and adds.
size_t getValue() const
Grab the current index out.
static bool isInteger(StringRef Val)
static StringRef getDIEStringAttr(const DIE &Die, uint16_t Attr)
Grabs the string in whichever attribute is passed in and returns a reference to it.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
uint64_t computeTypeSignature(const DIE &Die)
Computes the type signature.
void final(MD5Result &Result)
Finishes off the hash and puts the result in result.
static bool isType(const Metadata *MD)
(vector float) vec_cmpeq(*A, *B) C
Represents a pointer to a location list in the debug_loc section.
uint64_t computeCUSignature(StringRef DWOName, const DIE &Die)
Computes the CU signature.
constexpr LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Collects and handles dwarf debug information.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const DebugLocStream & getDebugLocs() const
Returns the entries for the .debug_loc section.
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.
Type * getType() const
All values are typed, get the type of this value.
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
A range adaptor for a pair of iterators.
LLVM Value Representation.
StringRef AttributeString(unsigned Attribute)
dwarf::FormParams getDwarfFormParams() const
Returns information about the byte size of DW_FORM values.
ArrayRef< Entry > getEntries(const List &L) const