28 #define DEBUG_TYPE "dwarfdebug" 35 for (
const auto &V : Die.
values())
36 if (V.getAttribute() == Attr)
37 return V.getDIEString().getString();
57 uint8_t Byte = Value & 0x7f;
69 uint8_t Byte = Value & 0x7f;
71 More = !((((Value == 0) && ((Byte & 0x40) == 0)) ||
72 ((Value == -1) && ((Byte & 0x40) != 0))));
80 void DIEHash::addParentContext(
const DIE &Parent) {
87 const DIE *Cur = &Parent;
93 Cur->
getTag() == dwarf::DW_TAG_type_unit);
100 const DIE &Die = **
I;
117 void DIEHash::collectAttributes(
const DIE &Die, DIEAttrs &
Attrs) {
119 for (
const auto &V : Die.
values()) {
123 switch (V.getAttribute()) {
124 #define HANDLE_DIE_HASH_ATTR(NAME) \ 128 #include "DIEHashAttributes.def" 145 addParentContext(*Parent);
162 unsigned DieNumber) {
176 assert(
Tag != dwarf::DW_TAG_friend &&
"No current LLVM clients emit friend " 177 "tags. Add support here when there's " 181 if ((
Tag == dwarf::DW_TAG_pointer_type ||
182 Tag == dwarf::DW_TAG_reference_type ||
183 Tag == dwarf::DW_TAG_rvalue_reference_type ||
184 Tag == dwarf::DW_TAG_ptr_to_member_type) &&
193 hashShallowTypeReference(
Attribute, Entry, Name);
198 unsigned &DieNumber = Numbering[&Entry];
200 hashRepeatedTypeReference(
Attribute, DieNumber);
211 DieNumber = Numbering.size();
218 for (
const auto &V : Values)
219 Hash.
update((uint64_t)V.getDIEInteger().getValue());
223 void DIEHash::hashLocList(
const DIELocList &LocList) {
250 case DIEValue::isEntry:
251 hashDIEEntry(Attribute, Tag, Value.getDIEEntry().getEntry());
253 case DIEValue::isInteger: {
257 case dwarf::DW_FORM_data1:
258 case dwarf::DW_FORM_data2:
259 case dwarf::DW_FORM_data4:
260 case dwarf::DW_FORM_data8:
261 case dwarf::DW_FORM_udata:
262 case dwarf::DW_FORM_sdata:
264 addSLEB128((int64_t)Value.getDIEInteger().getValue());
268 case dwarf::DW_FORM_flag_present:
269 case dwarf::DW_FORM_flag:
271 addULEB128((int64_t)Value.getDIEInteger().getValue());
278 case DIEValue::isString:
282 addString(Value.getDIEString().getString());
284 case DIEValue::isInlineString:
288 addString(Value.getDIEInlineString().getString());
291 case DIEValue::isLoc:
292 case DIEValue::isLocList:
297 addULEB128(Value.getDIEBlock().ComputeSize(AP));
298 hashBlockData(Value.getDIEBlock().values());
299 }
else if (Value.
getType() == DIEValue::isLoc) {
300 addULEB128(Value.getDIELoc().ComputeSize(AP));
301 hashBlockData(Value.getDIELoc().values());
306 hashLocList(Value.getDIELocList());
310 case DIEValue::isExpr:
311 case DIEValue::isLabel:
312 case DIEValue::isBaseTypeRef:
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.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
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.
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.
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
StringRef AttributeString(unsigned Attribute)
uint64_t computeTypeSignature(const DIE &Die)
Computes the type signature.
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...
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
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)