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

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H

14#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H

15

28#include

29#include

30

31namespace llvm {

32

42

44

46 bool HasRangeLists = false;

47

48

49

51

52

54

55

57

58

60

61

63

64

66

67

68

69 const MCSymbol *BaseAddress = nullptr;

70

71 using MDNodeSetVector =

74

75

76

77 MDNodeSetVector DeferredLocalDecls;

78

79

81

82

85

86

87

89

91

92

94

95 const DIFile *LastFile = nullptr;

96 unsigned LastFileID;

97

98

99

100

101

102

103

104

105 void applyConcreteDbgVariableAttributes(const Loc::Single &Single,

107 DIE &VariableDie);

108

109 void applyConcreteDbgVariableAttributes(const Loc::Multi &Multi,

111 DIE &VariableDie);

112

113 void applyConcreteDbgVariableAttributes(const Loc::MMI &MMI,

115 DIE &VariableDie);

116

117 void applyConcreteDbgVariableAttributes(const Loc::EntryValue &EntryValue,

119 DIE &VariableDie);

120

121 void applyConcreteDbgVariableAttributes(const std::monostate &,

123 DIE &VariableDie);

124

125

126

127 bool isDwoUnit() const override;

128

130 if (isDwoUnit() && DD->shareAcrossDWOCUs())

131 return AbstractLocalScopeDIEs;

132 return DU->getAbstractScopeDIEs();

133 }

134

136 if (isDwoUnit() && DD->shareAcrossDWOCUs())

137 return AbstractEntities;

138 return DU->getAbstractEntities();

139 }

140

141 auto &getFinalizedAbstractSubprograms() {

142 if (isDwoUnit() && DD->shareAcrossDWOCUs())

143 return FinalizedAbstractSubprograms;

144 return DU->getFinalizedAbstractSubprograms();

145 }

146

148

149

152

153

154

155

156 std::pair<DIE *, DwarfCompileUnit *>

157 getOrCreateAbstractSubprogramContextDIE(const DISubprogram *SP);

158

159

160 DIE &createAbstractSubprogramDIE(const DISubprogram *SP, DIE *ContextDIE,

162

163public:

167

169

171 return Skeleton;

172 }

173

175

177

179

180

182

183

185

186

191

199

201

202

206

209

212

213

214

217

218

219

222

224

226

227

229

231

232

233

234

235

238

240

241

242

244

246

249

250

251

253

254

255

257

258

259

260

262

263

265

266

267

269 DIE *&ObjectPointer);

270

271

273

275

276

277

279

281 bool Minimal = false) override;

282

283

286

288

289

290

293

294

295

297

298

300

301

303

304

306

307

308

309

310

311

312

313

315 const Function *CalleeF, bool IsTail,

317 const MCSymbol *CallAddr, unsigned CallReg,

318 DIType *AllocSiteTy);

319

320

321

322

325

326

329

333

334

338

339

341

343

344 unsigned DWOIdSize =

345 DD->getDwarfVersion() >= 5 && DD->useSplitDwarf() ? sizeof(uint64_t)

346 : 0;

348 }

350 return Asm->getUnitLengthFieldByteSize() +

352 }

353

354 void emitHeader(bool UseOffsets) override;

355

356

358

360 return MacroLabelBegin;

361 }

362

363

365 const DIScope *Context) override;

366

367

369

370

372 const DIScope *Context) override;

373

374

376

379

380

381

384

387

388

389

390

391

395

396

398

399

400

402 DIE &VariableDie);

403

404

406

408 DIE &SPDie);

409

411

412

415

418

421

423

425

427};

428

429}

430

431#endif

This file defines the StringMap class.

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

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.

This file contains constants used for implementing Dwarf debug support.

ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))

This file defines the SmallVector class.

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

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

Functions, function parameters, and return types can have attributes to indicate how they should be t...

DIELoc - Represents an expression location.

A structured debug information entry.

An imported module (C++ using directive or similar).

Tagged DWARF-like metadata node.

Base class for scope-like contexts.

Subprogram description. Uses SubclassData1.

This class is defined as the common parent of DbgVariable and DbgLabel such that it could levarage po...

This class is used to track label information.

std::pair< const DINode *, const DILocation * > InlinedEntity

This class is used to track local variable information.

bool useGNUAnalogForDwarf5Feature() const

Whether to use the GNU analog for a DWARF5 tag, attribute, or location atom.

void constructCallSiteParmEntryDIEs(DIE &CallSiteDIE, SmallVector< DbgCallSiteParam, 4 > &Params)

Construct call site parameter DIEs for the CallSiteDIE.

void attachLowHighPC(DIE &D, const MCSymbol *Begin, const MCSymbol *End)

void emitHeader(bool UseOffsets) override

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

unsigned getHeaderSize() const override

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

Definition DwarfCompileUnit.h:342

dwarf::Tag getDwarf5OrGNUTag(dwarf::Tag Tag) const

This takes a DWARF 5 tag and returns it or a GNU analog.

void constructAbstractSubprogramScopeDIE(LexicalScope *Scope)

bool includeMinimalInlineScopes() const

DIE * getOrCreateImportedEntityDIE(const DIImportedEntity *IE)

Get or create a DIE for an imported entity.

SmallVector< RangeSpan, 2 > takeRanges()

Definition DwarfCompileUnit.h:414

void addBaseTypeRef(DIEValueList &Die, int64_t Idx)

void addGlobalNameForTypeUnit(StringRef Name, const DIScope *Context)

Add a new global name present in a type unit to this compile unit.

void finishEntityDefinition(const DbgEntity *Entity)

void addRange(RangeSpan Range)

addRange - Add an address range to the list of ranges for this unit.

void addAddrTableBase()

Add the DW_AT_addr_base attribute to the unit DIE.

MCSymbol * getMacroLabelBegin() const

Definition DwarfCompileUnit.h:359

std::vector< BaseTypeRef > ExprRefedBaseTypes

Definition DwarfCompileUnit.h:200

DIE * constructInlinedScopeDIE(LexicalScope *Scope, DIE &ParentScopeDIE)

This scope represents an inlined body of a function.

void createBaseTypeDIEs()

void addScopeRangeList(DIE &ScopeDIE, SmallVector< RangeSpan, 2 > Range)

A helper function to construct a RangeSpanList for a given lexical scope.

uint64_t getDWOId() const

Definition DwarfCompileUnit.h:419

DIE * getOrCreateCommonBlock(const DICommonBlock *CB, ArrayRef< GlobalExpr > GlobalExprs)

void addVariableAddress(const DbgVariable &DV, DIE &Die, MachineLocation Location)

Add DW_AT_location attribute for a DbgVariable based on provided MachineLocation.

DIE & getOrCreateAbstractSubprogramDIE(const DISubprogram *SP)

Create an abstract subprogram DIE, that should later be populated by constructAbstractSubprogramScope...

unsigned getLength()

Definition DwarfCompileUnit.h:349

DbgValueHistoryMap::InlinedEntity InlinedEntity

Find abstract variable associated with Var.

Definition DwarfCompileUnit.h:335

MDNodeSetVector & getDeferredLocalDecls()

Definition DwarfCompileUnit.h:426

DIE & constructSubprogramScopeDIE(const DISubprogram *Sub, const Function &F, LexicalScope *Scope, MCSymbol *LineTableSym)

Construct a DIE for this subprogram scope.

DIE * getLexicalBlockDIE(const DILexicalBlock *LB)

Get a DIE for the given DILexicalBlock.

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

Add a new global name to the compile unit.

DIE & updateSubprogramScopeDIE(const DISubprogram *SP, const Function &F, MCSymbol *LineTableSym)

Find DIE for the given subprogram and attach appropriate DW_AT_low_pc, DW_AT_high_pc and DW_AT_LLVM_s...

void createAbstractEntity(const DINode *Node, LexicalScope *Scope)

void applyStmtList(DIE &D)

Apply the DW_AT_stmt_list from this compile unit to the specified DIE.

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

DIE * getOrCreateContextDIE(const DIScope *Ty) override

Construct a DIE for a given scope.

void applyCommonDbgVariableAttributes(const DbgVariable &Var, DIE &VariableDie)

Add attributes to Var which reflect the common attributes of VariableDie, namely those which are not ...

DIE & constructCallSiteEntryDIE(DIE &ScopeDIE, const DISubprogram *CalleeSP, const Function *CalleeF, bool IsTail, const MCSymbol *PCAddr, const MCSymbol *CallAddr, unsigned CallReg, DIType *AllocSiteTy)

Construct a call site entry DIE describing a call within Scope to a callee described by CalleeSP and ...

DIE * constructVariableDIE(DbgVariable &DV, bool Abstract=false)

Construct a DIE for the given DbgVariable.

dwarf::LocationAtom getDwarf5OrGNULocationAtom(dwarf::LocationAtom Loc) const

This takes a DWARF 5 location atom and either returns it or a GNU analog.

DIE * getOrCreateGlobalVariableDIE(const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)

Get or create global variable DIE.

void addLocationAttribute(DIE *ToDIE, const DIGlobalVariable *GV, ArrayRef< GlobalExpr > GlobalExprs)

DwarfCompileUnit * getSkeleton() const

Definition DwarfCompileUnit.h:170

void applySubprogramAttributesToDefinition(const DISubprogram *SP, DIE &SPDie)

DIE * createAndAddScopeChildren(LexicalScope *Scope, DIE &ScopeDIE)

void setSkeleton(DwarfCompileUnit &Skel)

Set the skeleton unit associated with this unit.

Definition DwarfCompileUnit.h:340

void addExpr(DIELoc &Die, dwarf::Form Form, const MCExpr *Expr)

Add a Dwarf expression attribute data and value.

dwarf::Attribute getDwarf5OrGNUAttr(dwarf::Attribute Attr) const

This takes a DWARF 5 attribute and returns it or a GNU analog.

void addAddress(DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location)

Add an address attribute to a die based on the location provided.

void applyLabelAttributes(const DbgLabel &Label, DIE &LabelDie)

void setDWOId(uint64_t DwoId)

Definition DwarfCompileUnit.h:420

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

addLocalLabelAddress - Add a dwarf label attribute data and value using DW_FORM_addr only.

DIE * constructLexicalScopeDIE(LexicalScope *Scope)

Construct new DW_TAG_lexical_block for this scope and attach DW_AT_low_pc/DW_AT_high_pc labels.

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

Add a new global type to the compile unit.

MCSymbol * getLineTableStartSym() const

Get line table start symbol for this unit.

Definition DwarfCompileUnit.h:184

const SmallVectorImpl< RangeSpan > & getRanges() const

getRanges - Get the list of ranges for this unit.

Definition DwarfCompileUnit.h:413

unsigned getOrCreateSourceID(const DIFile *File) override

Look up the source ID for the given file.

void constructScopeDIE(LexicalScope *Scope, DIE &ParentScopeDIE)

const MCSymbol * getBaseAddress() const

Definition DwarfCompileUnit.h:417

void attachLexicalScopesAbstractOrigins()

DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, UnitKind Kind=UnitKind::Full)

const StringMap< const DIE * > & getGlobalNames() const

Definition DwarfCompileUnit.h:377

DIE * constructLabelDIE(DbgLabel &DL, const LexicalScope &Scope)

Construct a DIE for the given DbgLabel.

void addGlobalTypeUnitType(const DIType *Ty, const DIScope *Context)

Add a new global type present in a type unit to this compile unit.

DbgEntity * getExistingAbstractEntity(const DINode *Node)

const StringMap< const DIE * > & getGlobalTypes() const

Definition DwarfCompileUnit.h:378

bool hasDwarfPubSections() const

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

addLabelAddress - Add a dwarf label attribute data and value using either DW_FORM_addr or DW_FORM_GNU...

void addLocationList(DIE &Die, dwarf::Attribute Attribute, unsigned Index)

Add a Dwarf loclistptr attribute data and value.

bool emitFuncLineTableOffsets() const

void addComplexAddress(const DIExpression *DIExpr, DIE &Die, dwarf::Attribute Attribute, const MachineLocation &Location)

Start with the address based on the location provided, and generate the DWARF information necessary t...

DIE * constructImportedEntityDIE(const DIImportedEntity *IE)

DwarfCompileUnit & getCU() override

Definition DwarfCompileUnit.h:223

void attachRangesOrLowHighPC(DIE &D, SmallVector< RangeSpan, 2 > Ranges)

bool hasRangeLists() const

Definition DwarfCompileUnit.h:168

void setBaseAddress(const MCSymbol *Base)

Definition DwarfCompileUnit.h:416

void finishSubprogramDefinition(const DISubprogram *SP)

Collects and handles dwarf debug information.

virtual unsigned getHeaderSize() const

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

DwarfUnit(dwarf::Tag, const DICompileUnit *Node, AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU, unsigned UniqueID=0)

AsmPrinter * Asm

Target of Dwarf emission.

This class is used to track scope information.

Multi-value location description.

Single value location description.

Base class for the full range of assembler expressions which are needed for parsing.

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

A vector that has set insertion semantics.

SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...

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

This is an optimization pass for GlobalISel generic memory operations.

@ Sub

Subtraction of integers.

UnitKind

Definition DwarfCompileUnit.h:43

@ Skeleton

Definition DwarfCompileUnit.h:43

@ Full

Definition DwarfCompileUnit.h:43

BaseTypeRef(unsigned BitSize, dwarf::TypeKind Encoding)

Definition DwarfCompileUnit.h:193

DIE * Die

Definition DwarfCompileUnit.h:197

dwarf::TypeKind Encoding

Definition DwarfCompileUnit.h:196

unsigned BitSize

Definition DwarfCompileUnit.h:195

A pair of GlobalVariable and DIExpression.

Definition DwarfCompileUnit.h:187

const DIExpression * Expr

Definition DwarfCompileUnit.h:189

const GlobalVariable * Var

Definition DwarfCompileUnit.h:188

Single location defined by (potentially multiple) EntryValueInfo.

Single location defined by (potentially multiple) MMI entries.