29 #define DEBUG_TYPE "dwarfdebug" 36 for (
const auto &V : Die.
values())
37 if (V.getAttribute() == Attr)
38 return V.getDIEString().getString();
58 uint8_t Byte = Value & 0x7f;
70 uint8_t Byte = Value & 0x7f;
72 More = !((((Value == 0) && ((Byte & 0x40) == 0)) ||
73 ((Value == -1) && ((Byte & 0x40) != 0))));
81 void DIEHash::addParentContext(
const DIE &Parent) {
88 const DIE *Cur = &Parent;
94 Cur->
getTag() == dwarf::DW_TAG_type_unit);
101 const DIE &Die = **
I;
118 void DIEHash::collectAttributes(
const DIE &Die, DIEAttrs &
Attrs) {
120 for (
const auto &V : Die.
values()) {
124 switch (V.getAttribute()) {
125 #define HANDLE_DIE_HASH_ATTR(NAME) \ 129 #include "DIEHashAttributes.def" 146 addParentContext(*Parent);
163 unsigned DieNumber) {
177 assert(
Tag != dwarf::DW_TAG_friend &&
"No current LLVM clients emit friend " 178 "tags. Add support here when there's " 182 if ((
Tag == dwarf::DW_TAG_pointer_type ||
183 Tag == dwarf::DW_TAG_reference_type ||
184 Tag == dwarf::DW_TAG_rvalue_reference_type ||
185 Tag == dwarf::DW_TAG_ptr_to_member_type) &&
194 hashShallowTypeReference(
Attribute, Entry, Name);
199 unsigned &DieNumber = Numbering[&Entry];
201 hashRepeatedTypeReference(
Attribute, DieNumber);
212 DieNumber = Numbering.size();
219 for (
const auto &V : Values)
220 Hash.
update((uint64_t)V.getDIEInteger().getValue());
224 void DIEHash::hashLocList(
const DIELocList &LocList) {
251 case DIEValue::isEntry:
252 hashDIEEntry(Attribute, Tag, Value.getDIEEntry().getEntry());
254 case DIEValue::isInteger: {
258 case dwarf::DW_FORM_data1:
259 case dwarf::DW_FORM_data2:
260 case dwarf::DW_FORM_data4:
261 case dwarf::DW_FORM_data8:
262 case dwarf::DW_FORM_udata:
263 case dwarf::DW_FORM_sdata:
265 addSLEB128((int64_t)Value.getDIEInteger().getValue());
269 case dwarf::DW_FORM_flag_present:
270 case dwarf::DW_FORM_flag:
272 addULEB128((int64_t)Value.getDIEInteger().getValue());
279 case DIEValue::isString:
283 addString(Value.getDIEString().getString());
285 case DIEValue::isInlineString:
289 addString(Value.getDIEInlineString().getString());
291 case DIEValue::isBlock:
292 case DIEValue::isLoc:
293 case DIEValue::isLocList:
297 if (Value.
getType() == DIEValue::isBlock) {
298 addULEB128(Value.getDIEBlock().ComputeSize(AP));
299 hashBlockData(Value.getDIEBlock().values());
300 }
else if (Value.
getType() == DIEValue::isLoc) {
301 addULEB128(Value.getDIELoc().ComputeSize(AP));
302 hashBlockData(Value.getDIELoc().values());
307 hashLocList(Value.getDIELocList());
311 case DIEValue::isExpr:
312 case DIEValue::isLabel:
313 case DIEValue::isDelta:
321 #define HANDLE_DIE_HASH_ATTR(NAME) \ 324 hashAttribute(Attrs.NAME, Tag); \ 326 #include "DIEHashAttributes.def" 331 void DIEHash::addAttributes(
const DIE &Die) {
333 collectAttributes(Die, Attrs);
334 hashAttributes(Attrs, Die.
getTag());
337 void DIEHash::hashNestedType(
const DIE &Die,
StringRef Name) {
352 void DIEHash::computeHash(
const DIE &Die) {
364 if (
isType(
C.getTag()) ||
C.getTag() == dwarf::DW_TAG_subprogram) {
368 hashNestedType(
C, Name);
387 if (!DWOName.
empty())
399 return Result.
high();
411 addParentContext(*Parent);
423 return Result.
high();
This class represents lattice values for constants.
void push_back(const T &Elt)
const DebugLocStream & getDebugLocs() const
Returns the entries for the .debug_loc section.
void addULEB128(uint64_t Value)
Encodes and adds.
Collects and handles dwarf debug information.
Represents a pointer to a location list in the debug_loc section.
size_t getValue() const
Grab the current index out.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
void update(ArrayRef< uint8_t > Data)
Updates the hash for the byte stream provided.
uint64_t computeCUSignature(StringRef DWOName, const DIE &Die)
Computes the CU signature.
StringRef AttributeString(unsigned Attribute)
uint64_t computeTypeSignature(const DIE &Die)
Computes the type signature.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
A structured debug information entry.
std::reverse_iterator< iterator > reverse_iterator
DwarfDebug * getDwarfDebug()
ArrayRef< Entry > getEntries(const List &L) const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
const List & getList(size_t LI) const
void emitDebugLocEntry(ByteStreamer &Streamer, const DebugLocStream::Entry &Entry)
Emit an entry for the debug loc section.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
A range adaptor for a pair of iterators.
This file contains constants used for implementing Dwarf debug support.
dwarf::Tag getTag() const
void addSLEB128(int64_t Value)
Encodes and adds.
dwarf::Attribute getAttribute() const
reverse_iterator rbegin()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Type getType() const
Accessors.
LLVM Value Representation.
void final(MD5Result &Result)
Finishes off the hash and puts the result in result.
StringRef - Represent a constant reference to a string, i.e.
Byte stream of .debug_loc entries.
dwarf::Form getForm() const
static StringRef getDIEStringAttr(const DIE &Die, uint16_t Attr)
Grabs the string in whichever attribute is passed in and returns a reference to it.
static bool isType(const Metadata *MD)