LLVM: lib/CodeGen/AsmPrinter/DwarfFile.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

16#include

17

18using namespace llvm;

19

21 : Asm(AP), Abbrevs(AbbrevAllocator), StrPool(DA, *Asm, Pref) {}

22

24 CUs.push_back(std::move(U));

25}

26

27

28

30 for (const auto &TheU : CUs)

31 emitUnit(TheU.get(), UseOffsets);

32}

33

36 return;

37

39

40 if (!S)

41 return;

42

43

44

46 return;

47

48 Asm->OutStreamer->switchSection(S);

50 Asm->emitDwarfDIE(TheU->getUnitDie());

51

53 Asm->OutStreamer->emitLabel(EndLabel);

54}

55

56

58

60

61

62

63 for (const auto &TheU : CUs) {

64 if (TheU->getCUNode()->isDebugDirectivesOnly())

65 continue;

66

67

68

69 if (TheU->getUnitDie().values().empty())

70 return;

71

72 TheU->setDebugSectionOffset(SecOffset);

74 }

75 if (SecOffset > UINT32_MAX && !Asm->isDwarf64())

77 "for the 32-bit DWARF format.");

78}

79

81

82 unsigned Offset = Asm->getUnitLengthFieldByteSize() +

84

85

86

88}

89

90

91

96

98

99

101 bool UseRelativeOffsets) {

102 StrPool.emit(*Asm, StrSection, OffsetSection, UseRelativeOffsets);

103}

104

106 auto &ScopeVars = ScopeVariables[LS];

108 if (unsigned ArgNum = DV->getArg()) {

109 auto Ret = ScopeVars.Args.insert({ArgNum, Var});

111 (void)Ret;

112 } else {

113 ScopeVars.Locals.push_back(Var);

114 }

115}

116

121

122std::pair<uint32_t, RangeSpanList *>

124 bool CanReuseLastRange = false;

125

126 if (!CURangeLists.empty()) {

127 auto Last = CURangeLists.back();

128 if (Last.CU == &CU && Last.Ranges == R) {

129 CanReuseLastRange = true;

130 }

131 }

132

133 if (!CanReuseLastRange) {

134 CURangeLists.push_back(RangeSpanList{Asm->createTempSymbol("debug_ranges"),

135 &CU, std::move(R)});

136 }

137

138 return std::make_pair(CURangeLists.size() - 1, &CURangeLists.back());

139}

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

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

bool isDebugDirectivesOnly() const

MCSection * getSection() const

Return the section that this DIEUnit will be emitted into.

A structured debug information entry.

LLVM_ABI unsigned computeOffsetsAndAbbrevs(const dwarf::FormParams &FormParams, DIEAbbrevSet &AbbrevSet, unsigned CUOffset)

Compute the offset of this DIE and all its children.

This class is used to track label information.

This class is used to track local variable information.

const DILocalVariable * getVariable() const

unsigned computeSizeAndOffset(DIE &Die, unsigned Offset)

Compute the size and offset of a DIE given an incoming Offset.

Definition DwarfFile.cpp:92

void addScopeLabel(LexicalScope *LS, DbgLabel *Label)

Definition DwarfFile.cpp:117

void addUnit(std::unique_ptr< DwarfCompileUnit > U)

Add a unit to the list of CUs.

Definition DwarfFile.cpp:23

void computeSizeAndOffsets()

Compute the size and offset of all the DIEs.

Definition DwarfFile.cpp:57

unsigned computeSizeAndOffsetsForUnit(DwarfUnit *TheU)

Compute the size and offset of all the DIEs in the given unit.

Definition DwarfFile.cpp:80

void emitUnits(bool UseOffsets)

Emit all of the units to the section listed with the given abbreviation section.

Definition DwarfFile.cpp:29

void emitUnit(DwarfUnit *TheU, bool UseOffsets)

Emit the given unit to its section.

Definition DwarfFile.cpp:34

void emitAbbrevs(MCSection *)

Emit a set of abbreviations to the specific section.

Definition DwarfFile.cpp:97

DwarfFile(AsmPrinter *AP, StringRef Pref, BumpPtrAllocator &DA)

Definition DwarfFile.cpp:20

void emitStrings(MCSection *StrSection, MCSection *OffsetSection=nullptr, bool UseRelativeOffsets=false)

Emit all of the strings to the section given.

Definition DwarfFile.cpp:100

void addScopeVariable(LexicalScope *LS, DbgVariable *Var)

Definition DwarfFile.cpp:105

std::pair< uint32_t, RangeSpanList * > addRange(const DwarfCompileUnit &CU, SmallVector< RangeSpan, 2 > R)

Definition DwarfFile.cpp:123

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

virtual void emitHeader(bool UseOffsets)=0

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

virtual unsigned getHeaderSize() const

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

MCSymbol * getEndLabel() const

const DICompileUnit * getCUNode() const

This class is used to track scope information.

Instances of this class represent a uniqued identifier for a section in the current translation unit.

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

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

void push_back(const T &Elt)

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

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

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)

BumpPtrAllocatorImpl<> BumpPtrAllocator

The standard BumpPtrAllocator which just uses the default template parameters.