9#ifndef LLVM_LIB_DWARFLINKER_PARALLEL_DIEGENERATOR_H
10#define LLVM_LIB_DWARFLINKER_PARALLEL_DIEGENERATOR_H
18namespace dwarf_linker {
61 for (
auto Byte : Bytes)
76 assert((AttrForm == dwarf::DW_FORM_block) ||
77 (AttrForm == dwarf::DW_FORM_exprloc) ||
78 (AttrForm == dwarf::DW_FORM_block1 && Bytes.
size() <= UINT8_MAX) ||
79 (AttrForm == dwarf::DW_FORM_block2 && Bytes.
size() <= UINT16_MAX) ||
80 (AttrForm == dwarf::DW_FORM_block4 && Bytes.
size() <= UINT32_MAX));
83 for (
auto Byte : Bytes)
103 assert(AttrForm == dwarf::DW_FORM_strx);
108 std::pair<DIEValue &, size_t>
110 assert(AttrForm == dwarf::DW_FORM_strp ||
111 AttrForm == dwarf::DW_FORM_line_strp);
119 for (
auto Byte :
String.bytes())
131 return std::pair<DIEValue &, size_t>(ValueRef,
String.size() + 1);
144 CU.assignAbbrev(NewAbbrev);
150 if (OffsetsList !=
nullptr) {
151 for (
uint64_t *OffsetPtr : *OffsetsList)
152 *OffsetPtr += AbbrevNumberSize;
155 return AbbrevNumberSize;
159 template <
typename T>
164 unsigned ValueSize = ValueRef.
sizeOf(
CU.getFormParams());
165 return std::pair<DIEValue &, size_t>(ValueRef, ValueSize);
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
Allocate memory in an ever growing pool, as if by bump-pointer.
Dwarf abbreviation, describes the organization of a debug information object.
unsigned getNumber() const
void setChildrenFlag(bool hasChild)
DIEBlock - Represents a block of values.
Represents a pointer to a location list in the debug_loc section.
DIELoc - Represents an expression location.
void setSize(unsigned size)
value_iterator addValue(BumpPtrAllocator &Alloc, const DIEValue &V)
unsigned sizeOf(const dwarf::FormParams &FormParams) const
Return the size of a value in bytes.
A structured debug information entry.
unsigned getAbbrevNumber() const
DIE & addChild(DIE *Child)
Add a child to the DIE.
DIEAbbrev generateAbbrev() const
Generate the abbreviation for this DIE.
static DIE * get(BumpPtrAllocator &Alloc, dwarf::Tag Tag)
void setAbbrevNumber(unsigned I)
Set the abbreviation number for this DIE.
void setOffset(unsigned O)
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
This class is a helper to create output DIE tree.
void addChild(DIE *Child)
Adds a specified Child to the current DIE.
std::pair< DIEValue &, size_t > addLocationAttribute(dwarf::Attribute Attr, dwarf::Form AttrForm, ArrayRef< uint8_t > Bytes)
Adds specified location attribute to the current DIE.
std::pair< DIEValue &, size_t > addLocListAttribute(dwarf::Attribute Attr, dwarf::Form AttrForm, uint64_t Value)
Adds specified location list attribute to the current DIE.
BumpPtrAllocator & Allocator
std::pair< DIEValue &, size_t > addStringPlaceholderAttribute(dwarf::Attribute Attr, dwarf::Form AttrForm)
Adds string attribute with dummy offset to the current DIE.
DIEGenerator(DIE *OutputDIE, BumpPtrAllocator &Allocator, DwarfUnit &CU)
DIE * createDIE(dwarf::Tag DieTag, uint32_t OutOffset)
Creates a DIE of specified tag DieTag and OutOffset.
DIEGenerator(BumpPtrAllocator &Allocator, DwarfUnit &CU)
std::pair< DIEValue &, size_t > addAttribute(dwarf::Attribute Attr, dwarf::Form AttrForm, T &&Value)
std::pair< DIEValue &, size_t > addIndexedStringAttribute(dwarf::Attribute Attr, dwarf::Form AttrForm, uint64_t Idx)
Adds indexed string attribute.
std::pair< DIEValue &, size_t > addBlockAttribute(dwarf::Attribute Attr, dwarf::Form AttrForm, ArrayRef< uint8_t > Bytes)
Adds specified block or exprloc attribute to the current DIE.
std::pair< DIEValue &, size_t > addInplaceString(dwarf::Attribute Attr, StringRef String)
Adds inplace string attribute to the current DIE.
size_t finalizeAbbreviations(bool CHILDREN_yes, OffsetsPtrVector *OffsetsList)
Creates appreviations for the current DIE.
std::pair< DIEValue &, size_t > addScalarAttribute(dwarf::Attribute Attr, dwarf::Form AttrForm, uint64_t Value)
Adds specified scalar attribute to the current DIE.
Base class for all Dwarf units(Compile unit/Type table unit).
This is an optimization pass for GlobalISel generic memory operations.
unsigned getULEB128Size(uint64_t Value)
Utility function to get the size of the ULEB128-encoded value.