LLVM: lib/DWARFLinker/Parallel/DIEGenerator.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_LIB_DWARFLINKER_PARALLEL_DIEGENERATOR_H

10#define LLVM_LIB_DWARFLINKER_PARALLEL_DIEGENERATOR_H

11

16

17namespace llvm {

20

21

23public:

26

29

30

38

40

41

43 assert(Child != nullptr);

45

47 }

48

49

55

56

61 for (auto Byte : Bytes)

65 Loc->setSize(Bytes.size());

66

68 }

69

70

74

75

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));

81

83 for (auto Byte : Bytes)

88

90 }

91

92

98

99

103 assert(AttrForm == dwarf::DW_FORM_strx);

105 }

106

107

108 std::pair<DIEValue &, size_t>

110 assert(AttrForm == dwarf::DW_FORM_strp ||

111 AttrForm == dwarf::DW_FORM_line_strp);

113 }

114

115

119 for (auto Byte : String.bytes())

123

128

131 return std::pair<DIEValue &, size_t>(ValueRef, String.size() + 1);

132 }

133

134

135

136

139

141 if (CHILDREN_yes)

143

144 CU.assignAbbrev(NewAbbrev);

146

148

149

150 if (OffsetsList != nullptr) {

151 for (uint64_t *OffsetPtr : *OffsetsList)

152 *OffsetPtr += AbbrevNumberSize;

153 }

154

155 return AbbrevNumberSize;

156 }

157

158protected:

159 template

164 unsigned ValueSize = ValueRef.sizeOf(CU.getFormParams());

165 return std::pair<DIEValue &, size_t>(ValueRef, ValueSize);

166 }

167

168

170

171

173

174

176};

177

178}

179}

180}

181

182#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

size_t size() const

size - Get the array size.

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.

LLVM_ABI unsigned sizeOf(const dwarf::FormParams &FormParams) const

Return the size of a value in bytes.

A structured debug information entry.

static DIE * get(BumpPtrAllocator &Alloc, dwarf::Tag Tag)

StringRef - Represent a constant reference to a string, i.e.

LLVM Value Representation.

void addChild(DIE *Child)

Adds a specified Child to the current DIE.

Definition DIEGenerator.h:42

std::pair< DIEValue &, size_t > addLocationAttribute(dwarf::Attribute Attr, dwarf::Form AttrForm, ArrayRef< uint8_t > Bytes)

Adds specified location attribute to the current DIE.

Definition DIEGenerator.h:57

std::pair< DIEValue &, size_t > addLocListAttribute(dwarf::Attribute Attr, dwarf::Form AttrForm, uint64_t Value)

Adds specified location list attribute to the current DIE.

Definition DIEGenerator.h:93

BumpPtrAllocator & Allocator

Definition DIEGenerator.h:169

std::pair< DIEValue &, size_t > addStringPlaceholderAttribute(dwarf::Attribute Attr, dwarf::Form AttrForm)

Adds string attribute with dummy offset to the current DIE.

Definition DIEGenerator.h:109

DIEGenerator(DIE *OutputDIE, BumpPtrAllocator &Allocator, DwarfUnit &CU)

Definition DIEGenerator.h:27

DIE * createDIE(dwarf::Tag DieTag, uint32_t OutOffset)

Creates a DIE of specified tag DieTag and OutOffset.

Definition DIEGenerator.h:31

DIEGenerator(BumpPtrAllocator &Allocator, DwarfUnit &CU)

Definition DIEGenerator.h:24

std::pair< DIEValue &, size_t > addAttribute(dwarf::Attribute Attr, dwarf::Form AttrForm, T &&Value)

Definition DIEGenerator.h:160

std::pair< DIEValue &, size_t > addIndexedStringAttribute(dwarf::Attribute Attr, dwarf::Form AttrForm, uint64_t Idx)

Adds indexed string attribute.

Definition DIEGenerator.h:100

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.

Definition DIEGenerator.h:71

DIE * OutputDIE

Definition DIEGenerator.h:175

std::pair< DIEValue &, size_t > addInplaceString(dwarf::Attribute Attr, StringRef String)

Adds inplace string attribute to the current DIE.

Definition DIEGenerator.h:116

DIE * getDIE()

Definition DIEGenerator.h:39

size_t finalizeAbbreviations(bool CHILDREN_yes, OffsetsPtrVector *OffsetsList)

Creates appreviations for the current DIE.

Definition DIEGenerator.h:137

std::pair< DIEValue &, size_t > addScalarAttribute(dwarf::Attribute Attr, dwarf::Form AttrForm, uint64_t Value)

Adds specified scalar attribute to the current DIE.

Definition DIEGenerator.h:50

Base class for all Dwarf units(Compile unit/Type table unit).

SmallVector< uint64_t * > OffsetsPtrVector

Type for list of pointers to patches offsets.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI unsigned getULEB128Size(uint64_t Value)

Utility function to get the size of the ULEB128-encoded value.

BumpPtrAllocatorImpl<> BumpPtrAllocator

The standard BumpPtrAllocator which just uses the default template parameters.