LLVM: lib/CodeGen/AsmPrinter/DwarfUnit.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFUNIT_H

14#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFUNIT_H

15

21#include

22#include

23

24namespace llvm {

25

27class ConstantInt;

28class DwarfCompileUnit;

29class MCDwarfDwoLineTable;

31

32

33

34

36protected:

37

39

41

42

44

45

47

48

50

51

53

54

57

58

60

61

62

64

65

67

68

70

71

72

73

75

78

80

82

83 template

86

87

88

89

90

93 return;

94

97 }

98

99public:

100

102

104

108 }

113

114

116

117

118

119

120

121

122

123

125

126

128 const DIScope *Context) = 0;

129

130

132 const DIScope *Context) = 0;

133

135

136

137

138

139

140

142

143

145

146

147

148

149

150

152

154

155

157

158

161

163

164

166 std::optionaldwarf::Form Form, int64_t Integer);

167

169

170

171

172

173

174

175

177

178

181

183

184

186

187

188

191

192

195

196

198

199

201

202

204

205

207

208

212

213

221

222

228

229

231

232

234

235

237

238

240

241

243

244

245

246

247

250

254

256 bool SkipSPAttributes = false);

257

258

260

261

263

264

266

267

269

270

271

272

274

275

276

278

281 }

282

283

284

286 return sizeof(int16_t) +

288 sizeof(int8_t) +

290 : 0);

291 }

292

293

295

296

298

299

301

303

305

306

309

310

313

314

316

317

319

320

321

323 const DIE &TyDIE);

324

325protected:

327

328

330

331

332

334

335

337

338private:

343 void constructSubrangeDIE(DIE &Buffer, const DISubrange *SR, DIE *IndexTy);

345 DIE *IndexTy);

349 void constructTemplateTypeParameterDIE(DIE &Buffer,

351 void constructTemplateValueParameterDIE(DIE &Buffer,

353

354

355

356

357 int64_t getDefaultLowerBound() const;

358

359

360 DIE *getIndexTyDie();

361

362

364

365 virtual void finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) = 0;

366

367 virtual bool isDwoUnit() const = 0;

368 const MCSymbol *getCrossSectionRelativeBaseAddress() const override;

369

370

371

373};

374

377 const DIE *Ty;

380 bool UsedLineTable = false;

381

382 unsigned getOrCreateSourceID(const DIFile *File) override;

384 bool isDwoUnit() const override;

385

386public:

390

392

395

396

397 void emitHeader(bool UseOffsets) override;

401 }

403 const DIScope *Context) override;

405 const DIScope *Context) override;

407};

408}

409#endif

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")

This file defines the DenseMap class.

assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())

Class for arbitrary precision integers.

Annotations lets you mark points and ranges inside source code, for tests:

This class is intended to be used as a driving class for all asm writers.

TargetMachine & TM

Target machine description.

unsigned int getDwarfOffsetByteSize() const

Returns 4 for DWARF32 and 8 for DWARF64.

Allocate memory in an ever growing pool, as if by bump-pointer.

ConstantFP - Floating Point Values [float, double].

This is the shared class of boolean and integer constants.

Basic type, like 'int' or 'float'.

unsigned getSourceLanguage() const

DIEBlock - Represents a block of values.

A pointer to another debug information entry.

DIELoc - Represents an expression location.

Represents a compile or type unit.

value_iterator addValue(BumpPtrAllocator &Alloc, const DIEValue &V)

A structured debug information entry.

Represents a module in the programming language, for example, a Clang module, or a Fortran module.

Tagged DWARF-like metadata node.

Base class for scope-like contexts.

String type, Fortran CHARACTER(n)

Type array for a subprogram.

Collects and handles dwarf debug information.

bool useSegmentedStringOffsetsTable() const

Returns whether to generate a string offsets table with (possibly shared) contributions from each CU ...

uint16_t getDwarfVersion() const

Returns the Dwarf Version.

void addGlobalTypeImpl(const DIType *Ty, const DIE &Die, const DIScope *Context) override

Add a new global type to the compile unit.

unsigned getHeaderSize() const override

Compute the size of a header for this unit, not including the initial length field.

DwarfCompileUnit & getCU() override

uint64_t getTypeSignature() const

Returns Type Signature.

void emitHeader(bool UseOffsets) override

Emit the header for this unit, not including the initial length field.

void addGlobalName(StringRef Name, const DIE &Die, const DIScope *Context) override

Add a new global name to the compile unit.

void setTypeSignature(uint64_t Signature)

void setType(const DIE *Ty)

This dwarf writer support class manages information associated with a source file.

virtual DIE * getOrCreateTypeDIE(const MDNode *TyNode)

Find existing DIE or create new DIE for the given type.

DwarfDebug & getDwarfDebug() const

void addThrownTypes(DIE &Die, DINodeArray ThrownTypes)

Add thrown types.

void addStringOffsetsStart()

Add the DW_AT_str_offsets_base attribute to the unit DIE.

void addAnnotation(DIE &Buffer, DINodeArray Annotations)

Add DW_TAG_LLVM_annotation.

std::vector< DIEBlock * > DIEBlocks

A list of all the DIEBlocks in use.

std::vector< DIELoc * > DIELocs

A list of all the DIELocs in use.

uint16_t getLanguage() const

void addBlock(DIE &Die, dwarf::Attribute Attribute, DIELoc *Loc)

Add block data.

void addTemplateParams(DIE &Buffer, DINodeArray TParams)

Add template parameters in buffer.

virtual DIE * getOrCreateContextDIE(const DIScope *Context)

Get context owner's DIE.

bool useSegmentedStringOffsetsTable() const

bool applySubprogramDefinitionAttributes(const DISubprogram *SP, DIE &SPDie, bool Minimal)

DIELoc * getDIELoc()

Returns a fresh newly allocated DIELoc.

void updateAcceleratorTables(const DIScope *Context, const DIType *Ty, const DIE &TyDIE)

If this is a named finished type then include it in the list of types for the accelerator tables.

virtual void emitHeader(bool UseOffsets)=0

Emit the header for this unit, not including the initial length field.

void addAttribute(DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, T &&Value)

void addOpAddress(DIELoc &Die, const MCSymbol *Sym)

Add a dwarf op address data and value using the form given and an op of either DW_FORM_addr or DW_FOR...

void addUInt(DIEValueList &Die, dwarf::Attribute Attribute, std::optional< dwarf::Form > Form, uint64_t Integer)

Add an unsigned integer attribute data and value.

void addString(DIE &Die, dwarf::Attribute Attribute, StringRef Str)

Add a string attribute data and value.

void addConstantValue(DIE &Die, const ConstantInt *CI, const DIType *Ty)

Add constant value entry in variable DIE.

DIE * getOrCreateNameSpace(const DINamespace *NS)

void insertDIE(const DINode *Desc, DIE *D)

Insert DIE into the map.

void addAccess(DIE &Die, DINode::DIFlags Flags)

Add the accessibility attribute.

void addSectionDelta(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)

addSectionDelta - Add a label delta attribute data and value.

void addGlobalType(const DIType *Ty, const DIE &Die, const DIScope *Context)

DIE * createTypeDIE(const DIScope *Context, DIE &ContextDIE, const DIType *Ty)

Creates type DIE with specific context.

DenseMap< DIE *, const DINode * > ContainingTypeMap

This map is used to keep track of subprogram DIEs that need DW_AT_containing_type attribute.

const DICompileUnit * CUNode

MDNode for the compile unit.

virtual unsigned getOrCreateSourceID(const DIFile *File)=0

Look up the source ID for the given file.

virtual void addGlobalTypeImpl(const DIType *Ty, const DIE &Die, const DIScope *Context)=0

Add a new global type to the compile unit.

void addDIETypeSignature(DIE &Die, uint64_t Signature)

Add a type's DW_AT_signature and set the declaration flag.

virtual DwarfCompileUnit & getCU()=0

DIE * getDIE(const DINode *D) const

Returns the DIE map slot for the specified debug variable.

AsmPrinter * getAsmPrinter() const

virtual unsigned getHeaderSize() const

Compute the size of a header for this unit, not including the initial length field.

bool hasContent() const

Return true if this compile unit has something to write out.

MCSymbol * LabelBegin

The start of the unit within its section.

void addSInt(DIEValueList &Die, dwarf::Attribute Attribute, std::optional< dwarf::Form > Form, int64_t Integer)

Add an signed integer attribute data and value.

void addLabelDelta(DIEValueList &Die, dwarf::Attribute Attribute, const MCSymbol *Hi, const MCSymbol *Lo)

Add a label delta attribute data and value.

void addLinkageName(DIE &Die, StringRef LinkageName)

Add a linkage name, if it isn't empty.

MCSymbol * getEndLabel() const

std::string getParentContextString(const DIScope *Context) const

Get string containing language specific context for a global name.

void addSourceLine(DIE &Die, unsigned Line, const DIFile *File)

Add location information to specified debug information entry.

void emitCommonHeader(bool UseOffsets, dwarf::UnitType UT)

Emit the common part of the header for this unit.

BumpPtrAllocator DIEValueAllocator

DIE * IndexTyDie

An anonymous type for index type. Owned by DIEUnit.

void addRnglistsBase()

Add the DW_AT_rnglists_base attribute to the unit DIE.

DIE * constructSubprogramArguments(DIE &Buffer, DITypeRefArray Args)

Construct function argument DIEs.

DIE * getOrCreateModule(const DIModule *M)

const DICompileUnit * getCUNode() const

DIE & createAndAddDIE(dwarf::Tag Tag, DIE &Parent, const DINode *N=nullptr)

Create a DIE with the given Tag, add the DIE to its parent, and call insertDIE if MD is not null.

void addSectionOffset(DIE &Die, dwarf::Attribute Attribute, uint64_t Integer)

Add an offset into a section attribute data and value.

DIE * getOrCreateStaticMemberDIE(const DIDerivedType *DT)

Create new static data member DIE.

void addLabel(DIEValueList &Die, dwarf::Attribute Attribute, dwarf::Form Form, const MCSymbol *Label)

Add a Dwarf label attribute data and value.

void addConstantFPValue(DIE &Die, const ConstantFP *CFP)

Add constant value entry in variable DIE.

void constructContainingTypeDIEs()

Construct DIEs for types that contain vtables.

unsigned UniqueID

A numeric ID unique among all CUs in the module.

DIE * getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal=false)

void addSectionLabel(DIE &Die, dwarf::Attribute Attribute, const MCSymbol *Label, const MCSymbol *Sec)

Add a Dwarf section label attribute data and value.

bool isShareableAcrossCUs(const DINode *D) const

Check whether the DIE for this MDNode can be shared across CUs.

void addPoolOpAddress(DIEValueList &Die, const MCSymbol *Label)

MCSymbol * getLabelBegin() const

Get the the symbol for start of the section for this unit.

DenseMap< const MDNode *, DIE * > MDNodeToDieMap

Tracks the mapping of unit level debug information variables to debug information entries.

void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy)

virtual void addGlobalName(StringRef Name, const DIE &Die, const DIScope *Context)=0

Add a new global name to the compile unit.

MCSymbol * EndLabel

Emitted at the end of the CU and used to compute the CU Length field.

void addFlag(DIE &Die, dwarf::Attribute Attribute)

Add a flag that is true to the DIE.

AsmPrinter * Asm

Target of Dwarf emission.

unsigned getUniqueID() const

Gets Unique ID for this unit.

void addType(DIE &Entity, const DIType *Ty, dwarf::Attribute Attribute=dwarf::DW_AT_type)

Add a new type attribute to the specified entity.

void applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie, bool SkipSPAttributes=false)

void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry)

Add a DIE attribute data and value.

MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...

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

unsigned DebugStrictDwarf

When set to true, don't use DWARF extensions in later DWARF versions.

LLVM Value Representation.

unsigned AttributeVersion(Attribute A)

UnitType

Constants for unit types in DWARF v5.

This is an optimization pass for GlobalISel generic memory operations.

Description of the encoding of one expression Op.