28 using namespace dwarf;
29 using namespace syntax;
77 case DW_FORM_ref_udata:
78 case DW_FORM_indirect:
82 case DW_FORM_loclistx:
83 case DW_FORM_rnglistx:
84 case DW_FORM_GNU_addr_index:
85 case DW_FORM_GNU_str_index:
88 case DW_FORM_ref_addr:
110 case DW_FORM_ref_sup4:
116 case DW_FORM_GNU_ref_alt:
117 case DW_FORM_GNU_strp_alt:
118 case DW_FORM_line_strp:
119 case DW_FORM_sec_offset:
120 case DW_FORM_strp_sup:
126 case DW_FORM_ref_sig8:
127 case DW_FORM_ref_sup8:
130 case DW_FORM_flag_present:
136 case DW_FORM_implicit_const:
150 bool Indirect =
false;
155 case DW_FORM_exprloc:
156 case DW_FORM_block: {
157 uint64_t size = DebugInfoData.
getULEB128(OffsetPtr);
161 case DW_FORM_block1: {
162 uint8_t size = DebugInfoData.
getU8(OffsetPtr);
166 case DW_FORM_block2: {
167 uint16_t size = DebugInfoData.
getU16(OffsetPtr);
171 case DW_FORM_block4: {
179 DebugInfoData.
getCStr(OffsetPtr);
183 case DW_FORM_ref_addr:
184 case DW_FORM_flag_present:
194 case DW_FORM_ref_sig8:
195 case DW_FORM_ref_sup4:
196 case DW_FORM_ref_sup8:
203 case DW_FORM_sec_offset:
205 case DW_FORM_strp_sup:
206 case DW_FORM_line_strp:
207 case DW_FORM_GNU_ref_alt:
208 case DW_FORM_GNU_strp_alt:
211 *OffsetPtr += *FixedSize;
222 case DW_FORM_ref_udata:
225 case DW_FORM_loclistx:
226 case DW_FORM_rnglistx:
227 case DW_FORM_GNU_addr_index:
228 case DW_FORM_GNU_str_index:
232 case DW_FORM_indirect:
251 case DW_FORM_ref_sig8:
252 case DW_FORM_GNU_ref_alt:
253 return (FC == FC_Reference);
254 case DW_FORM_GNU_addr_index:
255 return (FC == FC_Address);
256 case DW_FORM_GNU_str_index:
257 case DW_FORM_GNU_strp_alt:
263 return (FC == FC_String);
264 case DW_FORM_implicit_const:
265 return (FC == FC_Constant);
273 return (
Form == DW_FORM_data4 ||
Form == DW_FORM_data8 ||
274 Form == DW_FORM_strp) &&
275 FC == FC_SectionOffset;
281 bool Indirect =
false;
282 bool IsBlock =
false;
283 Value.data =
nullptr;
290 case DW_FORM_ref_addr: {
293 uint16_t
Size = (
Form == DW_FORM_addr) ? U->getAddressByteSize()
294 : U->getRefAddrByteSize();
298 case DW_FORM_exprloc:
333 case DW_FORM_ref_sup4:
340 case DW_FORM_ref_sup8:
347 case DW_FORM_ref_udata:
353 case DW_FORM_indirect:
358 case DW_FORM_sec_offset:
359 case DW_FORM_GNU_ref_alt:
360 case DW_FORM_GNU_strp_alt:
361 case DW_FORM_line_strp:
362 case DW_FORM_strp_sup: {
369 case DW_FORM_flag_present:
372 case DW_FORM_ref_sig8:
375 case DW_FORM_GNU_addr_index:
376 case DW_FORM_GNU_str_index:
389 Value.data =
nullptr;
391 Value.data =
reinterpret_cast<const uint8_t *
>(Str.
data());
392 *OffsetPtr +=
Value.uval;
400 uint64_t UValue =
Value.uval;
401 bool CURelativeOffset =
false;
405 OS <<
format(
"0x%016" PRIx64, UValue);
407 case DW_FORM_GNU_addr_index: {
411 OS <<
"<invalid dwarf unit>";
412 else if (U->getAddrOffsetSectionItem(UValue, Address))
413 OS <<
format(
"0x%016" PRIx64, Address);
415 OS <<
"<no .debug_addr section>";
418 case DW_FORM_flag_present:
423 OS <<
format(
"0x%02x", (uint8_t)UValue);
426 OS <<
format(
"0x%04x", (uint16_t)UValue);
431 case DW_FORM_ref_sig8:
433 OS <<
format(
"0x%016" PRIx64, UValue);
440 case DW_FORM_exprloc:
447 case DW_FORM_exprloc:
449 OS <<
format(
"<0x%" PRIx64
"> ", UValue);
452 OS <<
format(
"<0x%2.2x> ", (uint8_t)UValue);
455 OS <<
format(
"<0x%4.4x> ", (uint16_t)UValue);
464 const uint8_t *DataPtr =
Value.data;
467 const uint8_t *EndDataPtr = DataPtr + UValue;
468 while (DataPtr < EndDataPtr) {
469 OS <<
format(
"%2.2x ", *DataPtr);
492 case DW_FORM_GNU_str_index:
496 case DW_FORM_GNU_strp_alt:
497 OS <<
format(
"alt indirect string, offset: 0x%" PRIx64
"", UValue);
500 case DW_FORM_ref_addr:
501 OS <<
format(
"0x%016" PRIx64, UValue);
504 CURelativeOffset =
true;
505 OS <<
format(
"cu + 0x%2.2x", (uint8_t)UValue);
508 CURelativeOffset =
true;
509 OS <<
format(
"cu + 0x%4.4x", (uint16_t)UValue);
512 CURelativeOffset =
true;
516 CURelativeOffset =
true;
517 OS <<
format(
"cu + 0x%8.8" PRIx64, UValue);
519 case DW_FORM_ref_udata:
520 CURelativeOffset =
true;
521 OS <<
format(
"cu + 0x%" PRIx64, UValue);
523 case DW_FORM_GNU_ref_alt:
524 OS <<
format(
"<alt 0x%" PRIx64
">", UValue);
529 case DW_FORM_indirect:
530 OS <<
"DW_FORM_indirect";
534 case DW_FORM_sec_offset:
543 if (CURelativeOffset) {
546 <<
format(
"0x%8.8" PRIx64, UValue + (U ? U->getOffset() : 0));
551 void DWARFFormValue::dumpString(
raw_ostream &OS)
const {
562 if (!isFormClass(FC_String))
564 if (
Form == DW_FORM_string)
567 if (
Form == DW_FORM_GNU_strp_alt || U ==
nullptr)
570 if (
Form == DW_FORM_GNU_str_index ||
Form == DW_FORM_strx ||
571 Form == DW_FORM_strx1 ||
Form == DW_FORM_strx2 ||
Form == DW_FORM_strx3 ||
572 Form == DW_FORM_strx4) {
574 if (!U->getStringOffsetSectionItem(Offset, StrOffset))
578 if (
const char *Str = U->getStringExtractor().getCStr(&Offset)) {
585 if (!isFormClass(FC_Address))
587 if (
Form == DW_FORM_GNU_addr_index) {
590 if (!U || !U->getAddrOffsetSectionItem(Index, Result))
598 if (!isFormClass(FC_Reference))
605 case DW_FORM_ref_udata:
608 return Value.uval + U->getOffset();
609 case DW_FORM_ref_addr:
610 case DW_FORM_ref_sig8:
611 case DW_FORM_GNU_ref_alt:
619 if (!isFormClass(FC_SectionOffset))
625 if ((!isFormClass(FC_Constant) && !isFormClass(FC_Flag)) ||
626 Form == DW_FORM_sdata)
632 if ((!isFormClass(FC_Constant) && !isFormClass(FC_Flag)) ||
633 (
Form == DW_FORM_udata &&
638 return int32_t(
Value.uval);
640 return int16_t(
Value.uval);
642 return int8_t(
Value.uval);
651 if (!isFormClass(FC_Block) && !isFormClass(FC_Exprloc))
657 if (!isFormClass(FC_String) &&
Form == DW_FORM_string)
663 if (!isFormClass(FC_Reference))
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
const T & getValue() const LLVM_LVALUE_FUNCTION
format_object< Ts...> format(const char *Fmt, const Ts &...Vals)
These are helper functions used to produce formatted output.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
raw_ostream & write_escaped(StringRef Str, bool UseHexEscapes=false)
Output Str, turning '\', '', ' ', '"', and anything that doesn't satisfy std::isprint into an escape...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
StringRef - Represent a constant reference to a string, i.e.
An RAII object that temporarily switches an output stream to a specific color.