LLVM: lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
25#include
26using namespace llvm;
27
28#define DEBUG_TYPE "asm-printer"
29
30
31
32
33
35 switch (Encoding) {
37 return "absptr";
39 return "omit";
41 return "pcrel";
43 return "uleb128";
45 return "sleb128";
47 return "udata4";
49 return "udata8";
51 return "sdata4";
53 return "sdata8";
55 return "pcrel udata4";
57 return "pcrel sdata4";
59 return "pcrel udata8";
61 return "pcrel sdata8";
63 :
64 return "indirect pcrel udata4";
66 :
67 return "indirect pcrel sdata4";
69 :
70 return "indirect pcrel udata8";
72 :
73 return "indirect pcrel sdata8";
76 return "indirect datarel sdata4";
79 return "indirect datarel sdata8";
80 }
81
82 return "";
83}
84
85
86
87
88
100
101
104 return 0;
105
106 switch (Encoding & 0x07) {
107 default:
110 return MAI->getCodePointerSize();
112 return 2;
114 return 4;
116 return 8;
117 }
118}
119
121 if (GV) {
123
127 } else
129}
130
132 bool ForceOffset) const {
133 if (!ForceOffset) {
134
135 if (MAI->needsDwarfSectionOffsetDirective()) {
137 "emitting DWARF64 is not implemented for COFF targets");
138 OutStreamer->emitCOFFSecRel32(Label, 0);
139 return;
140 }
141
142
145 return;
146 }
147 }
148
149
152}
153
158 return;
159 }
160
161
163}
164
168
173
175 const Twine &Comment) const {
177}
178
180 const Twine &Comment) const {
181 return OutStreamer->emitDwarfUnitLength(Prefix, Comment);
182}
183
185 unsigned Encoding) const {
186
189 else
191}
192
200
201
202
203
204
208 default:
212 break;
215 break;
218 break;
221 break;
225 break;
228 break;
231 break;
234 break;
237 break;
240 break;
243 break;
246 break;
250 break;
253 break;
256 break;
259 break;
262 break;
265 break;
266 }
267}
268
270
277
278
279 for (const auto &V : Die.values()) {
281 assert(V.getForm() && "Too many attributes for DIE (check abbreviation)");
282
285 if (Attr == dwarf::DW_AT_accessibility)
288 }
289
290
291 V.emitValue(this);
292 }
293
294
296 for (const auto &Child : Die.children())
298
299 OutStreamer->AddComment("End Of Children Mark");
301 }
302}
303
305
307
308
309 Abbrev.Emit(this);
310}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static const char * DecodeDWARFEncoding(unsigned Encoding)
Definition AsmPrinterDwarf.cpp:34
This file contains constants used for implementing Dwarf debug support.
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
void emitULEB128(uint64_t Value, const char *Desc=nullptr, unsigned PadTo=0) const
Emit the specified unsigned leb128 value.
void emitDwarfSymbolReference(const MCSymbol *Label, bool ForceOffset=false) const
Emit a reference to a symbol for use in dwarf.
Definition AsmPrinterDwarf.cpp:131
unsigned GetSizeOfEncodedValue(unsigned Encoding) const
Return the size of the encoding in bytes.
Definition AsmPrinterDwarf.cpp:102
void emitDwarfDIE(const DIE &Die) const
Recursively emit Dwarf DIE tree.
Definition AsmPrinterDwarf.cpp:269
void emitDwarfLengthOrOffset(uint64_t Value) const
Emit 32- or 64-bit value depending on the DWARF format.
Definition AsmPrinterDwarf.cpp:169
void emitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset, unsigned Size, bool IsSectionRelative=false) const
Emit something like ".long Label+Offset" where the size in bytes of the directive is specified by Siz...
TargetMachine & TM
Target machine description.
void emitDwarfStringOffset(DwarfStringPoolEntry S) const
Emit the 4- or 8-byte offset of a string from the start of its section.
Definition AsmPrinterDwarf.cpp:154
void emitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) const
Emit something like ".long Hi-Lo" where the size in bytes of the directive is specified by Size and H...
virtual void emitTTypeReference(const GlobalValue *GV, unsigned Encoding)
Emit reference to a ttype global with a specified encoding.
Definition AsmPrinterDwarf.cpp:120
const MCAsmInfo * MAI
Target Asm Printer information.
void emitDwarfOffset(const MCSymbol *Label, uint64_t Offset) const
Emit something like ".long Label + Offset" or ".quad Label + Offset" depending on the DWARF format.
Definition AsmPrinterDwarf.cpp:165
void emitInt8(int Value) const
Emit a byte directive and value.
void emitDwarfUnitLength(uint64_t Length, const Twine &Comment) const
Emit a unit length field.
Definition AsmPrinterDwarf.cpp:174
void emitEncodingByte(unsigned Val, const char *Desc=nullptr) const
Emit a .byte 42 directive that corresponds to an encoding.
Definition AsmPrinterDwarf.cpp:89
MachineModuleInfo * MMI
This is a pointer to the current MachineModuleInfo.
void emitCFIInstruction(const MachineInstr &MI)
void emitCallSiteOffset(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Encoding) const
Emit reference to a call site with a specified encoding.
Definition AsmPrinterDwarf.cpp:184
void emitDwarfAbbrev(const DIEAbbrev &Abbrev) const
Definition AsmPrinterDwarf.cpp:304
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
unsigned int getDwarfOffsetByteSize() const
Returns 4 for DWARF32 and 8 for DWARF64.
bool isVerbose() const
Return true if assembly output should contain comments.
bool doesDwarfUseRelocationsAcrossSections() const
void emitCallSiteValue(uint64_t Value, unsigned Encoding) const
Emit an integer value corresponding to the call site encoding.
Definition AsmPrinterDwarf.cpp:193
void emitLabelDifferenceAsULEB128(const MCSymbol *Hi, const MCSymbol *Lo) const
Emit something like ".uleb128 Hi-Lo".
Dwarf abbreviation, describes the organization of a debug information object.
unsigned getNumber() const
LLVM_ABI void Emit(const AsmPrinter *AP) const
Print the abbreviation using the specified asm printer.
A structured debug information entry.
unsigned getAbbrevNumber() const
unsigned getOffset() const
Get the compile/type unit relative offset of this DIE.
dwarf::Tag getTag() const
unsigned getAddressSpace() const
unsigned getRegister2() const
unsigned getRegister() const
OpType getOperation() const
StringRef getComment() const
StringRef getValues() const
int64_t getOffset() const
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 ...
Represents a location in source code.
virtual const MCExpr * getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM, MachineModuleInfo *MMI, MCStreamer &Streamer) const
Return an MCExpr to use for a reference to the specified global variable from exception handling info...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static Twine utohexstr(uint64_t Val)
LLVM Value Representation.
LLVM_ABI StringRef AttributeString(unsigned Attribute)
LLVM_ABI StringRef TagString(unsigned Tag)
LLVM_ABI StringRef AccessibilityString(unsigned Access)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
Data for a string pool entry.