26#define DEBUG_TYPE "dwarfdebug"
33 for (
const auto &V : Die.
values())
34 if (V.getAttribute() == Attr)
35 return V.getDIEString().getString();
69 More = !((((
Value == 0) && ((Byte & 0x40) == 0)) ||
70 ((
Value == -1) && ((Byte & 0x40) != 0))));
78void DIEHash::addParentContext(
const DIE &Parent) {
85 const DIE *Cur = &Parent;
87 Parents.push_back(Cur);
91 Cur->
getTag() == dwarf::DW_TAG_type_unit);
111void 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);
237void DIEHash::hashLocList(
const DIELocList &LocList) {
265 case DIEValue::isEntry:
268 case DIEValue::isInteger: {
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());
305 case DIEValue::isBlock:
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:
336void DIEHash::hashAttributes(
const DIEAttrs &Attrs,
dwarf::Tag Tag) {
337#define HANDLE_DIE_HASH_ATTR(NAME) \
340 hashAttribute(Attrs.NAME, Tag); \
342#include "DIEHashAttributes.def"
347void DIEHash::addAttributes(
const DIE &Die) {
349 collectAttributes(Die, Attrs);
350 hashAttributes(Attrs, Die.
getTag());
368void 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();
static StringRef getDIEStringAttr(const DIE &Die, uint16_t Attr)
Grabs the string in whichever attribute is passed in and returns a reference to it.
This file contains constants used for implementing Dwarf debug support.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isType(const Metadata *MD)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
DwarfDebug * getDwarfDebug()
dwarf::FormParams getDwarfFormParams() const
Returns information about the byte size of DW_FORM values.
void hashRawTypeReference(const DIE &Entry)
uint64_t computeTypeSignature(const DIE &Die)
Computes the type signature.
void addSLEB128(int64_t Value)
Encodes and adds.
uint64_t computeCUSignature(StringRef DWOName, const DIE &Die)
Computes the CU signature.
void addULEB128(uint64_t Value)
Encodes and adds.
Represents a pointer to a location list in the debug_loc section.
size_t getValue() const
Grab the current index out.
A structured debug information entry.
dwarf::Tag getTag() const
Byte stream of .debug_loc entries.
const List & getList(size_t LI) const
ArrayRef< Entry > getEntries(const List &L) const
Collects and handles dwarf debug information.
void emitDebugLocEntry(ByteStreamer &Streamer, const DebugLocStream::Entry &Entry, const DwarfCompileUnit *CU)
Emit an entry for the debug loc section.
const DebugLocStream & getDebugLocs() const
Returns the entries for the .debug_loc section.
void update(ArrayRef< uint8_t > Data)
Updates the hash for the byte stream provided.
void final(MD5Result &Result)
Finishes off the hash and puts the result in result.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
A range adaptor for a pair of iterators.
StringRef AttributeString(unsigned Attribute)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
auto reverse(ContainerTy &&C)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.