LLVM  4.0.0
MCDwarf.h
Go to the documentation of this file.
1 //===- MCDwarf.h - Machine Code Dwarf support -------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the declaration of the MCDwarfFile to support the dwarf
11 // .file directive and the .loc directive.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_MC_MCDWARF_H
16 #define LLVM_MC_MCDWARF_H
17 
18 #include "llvm/ADT/MapVector.h"
19 #include "llvm/ADT/StringMap.h"
20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/MC/MCSection.h"
22 #include "llvm/Support/Dwarf.h"
23 #include <string>
24 #include <utility>
25 #include <vector>
26 
27 namespace llvm {
28 template <typename T> class ArrayRef;
29 class raw_ostream;
30 class MCAsmBackend;
31 class MCContext;
32 class MCObjectStreamer;
33 class MCStreamer;
34 class MCSymbol;
35 class SourceMgr;
36 class SMLoc;
37 
38 /// \brief Instances of this class represent the name of the dwarf
39 /// .file directive and its associated dwarf file number in the MC file,
40 /// and MCDwarfFile's are created and uniqued by the MCContext class where
41 /// the file number for each is its index into the vector of DwarfFiles (note
42 /// index 0 is not used and not a valid dwarf file number).
43 struct MCDwarfFile {
44  // \brief The base name of the file without its directory path.
45  // The StringRef references memory allocated in the MCContext.
46  std::string Name;
47 
48  // \brief The index into the list of directory names for this file name.
49  unsigned DirIndex;
50 };
51 
52 /// \brief Instances of this class represent the information from a
53 /// dwarf .loc directive.
54 class MCDwarfLoc {
55  uint32_t FileNum;
56  uint32_t Line;
57  uint16_t Column;
58  // Flags (see #define's below)
59  uint8_t Flags;
60  uint8_t Isa;
61  uint32_t Discriminator;
62 
63 // Flag that indicates the initial value of the is_stmt_start flag.
64 #define DWARF2_LINE_DEFAULT_IS_STMT 1
65 
66 #define DWARF2_FLAG_IS_STMT (1 << 0)
67 #define DWARF2_FLAG_BASIC_BLOCK (1 << 1)
68 #define DWARF2_FLAG_PROLOGUE_END (1 << 2)
69 #define DWARF2_FLAG_EPILOGUE_BEGIN (1 << 3)
70 
71 private: // MCContext manages these
72  friend class MCContext;
73  friend class MCDwarfLineEntry;
74  MCDwarfLoc(unsigned fileNum, unsigned line, unsigned column, unsigned flags,
75  unsigned isa, unsigned discriminator)
76  : FileNum(fileNum), Line(line), Column(column), Flags(flags), Isa(isa),
77  Discriminator(discriminator) {}
78 
79  // Allow the default copy constructor and assignment operator to be used
80  // for an MCDwarfLoc object.
81 
82 public:
83  /// \brief Get the FileNum of this MCDwarfLoc.
84  unsigned getFileNum() const { return FileNum; }
85 
86  /// \brief Get the Line of this MCDwarfLoc.
87  unsigned getLine() const { return Line; }
88 
89  /// \brief Get the Column of this MCDwarfLoc.
90  unsigned getColumn() const { return Column; }
91 
92  /// \brief Get the Flags of this MCDwarfLoc.
93  unsigned getFlags() const { return Flags; }
94 
95  /// \brief Get the Isa of this MCDwarfLoc.
96  unsigned getIsa() const { return Isa; }
97 
98  /// \brief Get the Discriminator of this MCDwarfLoc.
99  unsigned getDiscriminator() const { return Discriminator; }
100 
101  /// \brief Set the FileNum of this MCDwarfLoc.
102  void setFileNum(unsigned fileNum) { FileNum = fileNum; }
103 
104  /// \brief Set the Line of this MCDwarfLoc.
105  void setLine(unsigned line) { Line = line; }
106 
107  /// \brief Set the Column of this MCDwarfLoc.
108  void setColumn(unsigned column) {
109  assert(column <= UINT16_MAX);
110  Column = column;
111  }
112 
113  /// \brief Set the Flags of this MCDwarfLoc.
114  void setFlags(unsigned flags) {
115  assert(flags <= UINT8_MAX);
116  Flags = flags;
117  }
118 
119  /// \brief Set the Isa of this MCDwarfLoc.
120  void setIsa(unsigned isa) {
121  assert(isa <= UINT8_MAX);
122  Isa = isa;
123  }
124 
125  /// \brief Set the Discriminator of this MCDwarfLoc.
126  void setDiscriminator(unsigned discriminator) {
127  Discriminator = discriminator;
128  }
129 };
130 
131 /// \brief Instances of this class represent the line information for
132 /// the dwarf line table entries. Which is created after a machine
133 /// instruction is assembled and uses an address from a temporary label
134 /// created at the current address in the current section and the info from
135 /// the last .loc directive seen as stored in the context.
136 class MCDwarfLineEntry : public MCDwarfLoc {
137  MCSymbol *Label;
138 
139 private:
140  // Allow the default copy constructor and assignment operator to be used
141  // for an MCDwarfLineEntry object.
142 
143 public:
144  // Constructor to create an MCDwarfLineEntry given a symbol and the dwarf loc.
146  : MCDwarfLoc(loc), Label(label) {}
147 
148  MCSymbol *getLabel() const { return Label; }
149 
150  // This is called when an instruction is assembled into the specified
151  // section and if there is information from the last .loc directive that
152  // has yet to have a line entry made for it is made.
153  static void Make(MCObjectStreamer *MCOS, MCSection *Section);
154 };
155 
156 /// \brief Instances of this class represent the line information for a compile
157 /// unit where machine instructions have been assembled after seeing .loc
158 /// directives. This is the information used to build the dwarf line
159 /// table for a section.
161 public:
162  // \brief Add an entry to this MCLineSection's line entries.
163  void addLineEntry(const MCDwarfLineEntry &LineEntry, MCSection *Sec) {
164  MCLineDivisions[Sec].push_back(LineEntry);
165  }
166 
167  typedef std::vector<MCDwarfLineEntry> MCDwarfLineEntryCollection;
168  typedef MCDwarfLineEntryCollection::iterator iterator;
169  typedef MCDwarfLineEntryCollection::const_iterator const_iterator;
171 
172 private:
173  // A collection of MCDwarfLineEntry for each section.
174  MCLineDivisionMap MCLineDivisions;
175 
176 public:
177  // Returns the collection of MCDwarfLineEntry for a given Compile Unit ID.
179  return MCLineDivisions;
180  }
181 };
182 
184  /// First special line opcode - leave room for the standard opcodes.
185  /// Note: If you want to change this, you'll have to update the
186  /// "StandardOpcodeLengths" table that is emitted in
187  /// \c Emit().
188  uint8_t DWARF2LineOpcodeBase = 13;
189  /// Minimum line offset in a special line info. opcode. The value
190  /// -5 was chosen to give a reasonable range of values.
191  int8_t DWARF2LineBase = -5;
192  /// Range of line offsets in a special line info. opcode.
193  uint8_t DWARF2LineRange = 14;
194 };
195 
202 
204  unsigned getFile(StringRef &Directory, StringRef &FileName,
205  unsigned FileNumber = 0);
206  std::pair<MCSymbol *, MCSymbol *> Emit(MCStreamer *MCOS,
207  MCDwarfLineTableParams Params) const;
208  std::pair<MCSymbol *, MCSymbol *>
209  Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
210  ArrayRef<char> SpecialOpcodeLengths) const;
211 };
212 
214  MCDwarfLineTableHeader Header;
215 public:
216  void setCompilationDir(StringRef CompilationDir) {
217  Header.CompilationDir = CompilationDir;
218  }
219  unsigned getFile(StringRef Directory, StringRef FileName) {
220  return Header.getFile(Directory, FileName);
221  }
222  void Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params) const;
223 };
224 
226  MCDwarfLineTableHeader Header;
227  MCLineSection MCLineSections;
228 
229 public:
230  // This emits the Dwarf file and the line tables for all Compile Units.
231  static void Emit(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params);
232 
233  // This emits the Dwarf file and the line tables for a given Compile Unit.
234  void EmitCU(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params) const;
235 
236  unsigned getFile(StringRef &Directory, StringRef &FileName,
237  unsigned FileNumber = 0);
238 
239  MCSymbol *getLabel() const {
240  return Header.Label;
241  }
242 
243  void setLabel(MCSymbol *Label) {
244  Header.Label = Label;
245  }
246 
247  void setCompilationDir(StringRef CompilationDir) {
248  Header.CompilationDir = CompilationDir;
249  }
250 
252  return Header.MCDwarfDirs;
253  }
254 
256  return Header.MCDwarfDirs;
257  }
258 
260  return Header.MCDwarfFiles;
261  }
262 
264  return Header.MCDwarfFiles;
265  }
266 
268  return MCLineSections;
269  }
271  return MCLineSections;
272  }
273 };
274 
276 public:
277  /// Utility function to encode a Dwarf pair of LineDelta and AddrDeltas.
278  static void Encode(MCContext &Context, MCDwarfLineTableParams Params,
279  int64_t LineDelta, uint64_t AddrDelta, raw_ostream &OS);
280 
281  /// Utility function to emit the encoding to a streamer.
282  static void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
283  int64_t LineDelta, uint64_t AddrDelta);
284 };
285 
287 public:
288  //
289  // When generating dwarf for assembly source files this emits the Dwarf
290  // sections.
291  //
292  static void Emit(MCStreamer *MCOS);
293 };
294 
295 // When generating dwarf for assembly source files this is the info that is
296 // needed to be gathered for each symbol that will have a dwarf label.
298 private:
299  // Name of the symbol without a leading underbar, if any.
300  StringRef Name;
301  // The dwarf file number this symbol is in.
302  unsigned FileNumber;
303  // The line number this symbol is at.
304  unsigned LineNumber;
305  // The low_pc for the dwarf label is taken from this symbol.
306  MCSymbol *Label;
307 
308 public:
309  MCGenDwarfLabelEntry(StringRef name, unsigned fileNumber, unsigned lineNumber,
310  MCSymbol *label)
311  : Name(name), FileNumber(fileNumber), LineNumber(lineNumber),
312  Label(label) {}
313 
314  StringRef getName() const { return Name; }
315  unsigned getFileNumber() const { return FileNumber; }
316  unsigned getLineNumber() const { return LineNumber; }
317  MCSymbol *getLabel() const { return Label; }
318 
319  // This is called when label is created when we are generating dwarf for
320  // assembly source files.
321  static void Make(MCSymbol *Symbol, MCStreamer *MCOS, SourceMgr &SrcMgr,
322  SMLoc &Loc);
323 };
324 
326 public:
327  enum OpType {
343  };
344 
345 private:
346  OpType Operation;
347  MCSymbol *Label;
348  unsigned Register;
349  union {
350  int Offset;
351  unsigned Register2;
352  };
353  std::vector<char> Values;
354 
355  MCCFIInstruction(OpType Op, MCSymbol *L, unsigned R, int O, StringRef V)
356  : Operation(Op), Label(L), Register(R), Offset(O),
357  Values(V.begin(), V.end()) {
358  assert(Op != OpRegister);
359  }
360 
361  MCCFIInstruction(OpType Op, MCSymbol *L, unsigned R1, unsigned R2)
362  : Operation(Op), Label(L), Register(R1), Register2(R2) {
363  assert(Op == OpRegister);
364  }
365 
366 public:
367  /// \brief .cfi_def_cfa defines a rule for computing CFA as: take address from
368  /// Register and add Offset to it.
369  static MCCFIInstruction createDefCfa(MCSymbol *L, unsigned Register,
370  int Offset) {
371  return MCCFIInstruction(OpDefCfa, L, Register, -Offset, "");
372  }
373 
374  /// \brief .cfi_def_cfa_register modifies a rule for computing CFA. From now
375  /// on Register will be used instead of the old one. Offset remains the same.
376  static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register) {
377  return MCCFIInstruction(OpDefCfaRegister, L, Register, 0, "");
378  }
379 
380  /// \brief .cfi_def_cfa_offset modifies a rule for computing CFA. Register
381  /// remains the same, but offset is new. Note that it is the absolute offset
382  /// that will be added to a defined register to the compute CFA address.
384  return MCCFIInstruction(OpDefCfaOffset, L, 0, -Offset, "");
385  }
386 
387  /// \brief .cfi_adjust_cfa_offset Same as .cfi_def_cfa_offset, but
388  /// Offset is a relative value that is added/subtracted from the previous
389  /// offset.
391  return MCCFIInstruction(OpAdjustCfaOffset, L, 0, Adjustment, "");
392  }
393 
394  /// \brief .cfi_offset Previous value of Register is saved at offset Offset
395  /// from CFA.
396  static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register,
397  int Offset) {
398  return MCCFIInstruction(OpOffset, L, Register, Offset, "");
399  }
400 
401  /// \brief .cfi_rel_offset Previous value of Register is saved at offset
402  /// Offset from the current CFA register. This is transformed to .cfi_offset
403  /// using the known displacement of the CFA register from the CFA.
404  static MCCFIInstruction createRelOffset(MCSymbol *L, unsigned Register,
405  int Offset) {
406  return MCCFIInstruction(OpRelOffset, L, Register, Offset, "");
407  }
408 
409  /// \brief .cfi_register Previous value of Register1 is saved in
410  /// register Register2.
411  static MCCFIInstruction createRegister(MCSymbol *L, unsigned Register1,
412  unsigned Register2) {
413  return MCCFIInstruction(OpRegister, L, Register1, Register2);
414  }
415 
416  /// \brief .cfi_window_save SPARC register window is saved.
418  return MCCFIInstruction(OpWindowSave, L, 0, 0, "");
419  }
420 
421  /// \brief .cfi_restore says that the rule for Register is now the same as it
422  /// was at the beginning of the function, after all initial instructions added
423  /// by .cfi_startproc were executed.
424  static MCCFIInstruction createRestore(MCSymbol *L, unsigned Register) {
425  return MCCFIInstruction(OpRestore, L, Register, 0, "");
426  }
427 
428  /// \brief .cfi_undefined From now on the previous value of Register can't be
429  /// restored anymore.
430  static MCCFIInstruction createUndefined(MCSymbol *L, unsigned Register) {
431  return MCCFIInstruction(OpUndefined, L, Register, 0, "");
432  }
433 
434  /// \brief .cfi_same_value Current value of Register is the same as in the
435  /// previous frame. I.e., no restoration is needed.
436  static MCCFIInstruction createSameValue(MCSymbol *L, unsigned Register) {
437  return MCCFIInstruction(OpSameValue, L, Register, 0, "");
438  }
439 
440  /// \brief .cfi_remember_state Save all current rules for all registers.
442  return MCCFIInstruction(OpRememberState, L, 0, 0, "");
443  }
444 
445  /// \brief .cfi_restore_state Restore the previously saved state.
447  return MCCFIInstruction(OpRestoreState, L, 0, 0, "");
448  }
449 
450  /// \brief .cfi_escape Allows the user to add arbitrary bytes to the unwind
451  /// info.
453  return MCCFIInstruction(OpEscape, L, 0, 0, Vals);
454  }
455 
456  /// \brief A special wrapper for .cfi_escape that indicates GNU_ARGS_SIZE
458  return MCCFIInstruction(OpGnuArgsSize, L, 0, Size, "");
459  }
460 
461  OpType getOperation() const { return Operation; }
462  MCSymbol *getLabel() const { return Label; }
463 
464  unsigned getRegister() const {
465  assert(Operation == OpDefCfa || Operation == OpOffset ||
466  Operation == OpRestore || Operation == OpUndefined ||
467  Operation == OpSameValue || Operation == OpDefCfaRegister ||
468  Operation == OpRelOffset || Operation == OpRegister);
469  return Register;
470  }
471 
472  unsigned getRegister2() const {
473  assert(Operation == OpRegister);
474  return Register2;
475  }
476 
477  int getOffset() const {
478  assert(Operation == OpDefCfa || Operation == OpOffset ||
479  Operation == OpRelOffset || Operation == OpDefCfaOffset ||
480  Operation == OpAdjustCfaOffset || Operation == OpGnuArgsSize);
481  return Offset;
482  }
483 
485  assert(Operation == OpEscape);
486  return StringRef(&Values[0], Values.size());
487  }
488 };
489 
492  : Begin(nullptr), End(nullptr), Personality(nullptr), Lsda(nullptr),
495  IsSimple(false) {}
499  const MCSymbol *Lsda;
500  std::vector<MCCFIInstruction> Instructions;
503  unsigned LsdaEncoding;
506  bool IsSimple;
507 };
508 
510 public:
511  //
512  // This emits the frame info section.
513  //
514  static void Emit(MCObjectStreamer &streamer, MCAsmBackend *MAB, bool isEH);
515  static void EmitAdvanceLoc(MCObjectStreamer &Streamer, uint64_t AddrDelta);
516  static void EncodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta,
517  raw_ostream &OS);
518 };
519 } // end namespace llvm
520 
521 #endif
MachineLoop * L
void setCompilationDir(StringRef CompilationDir)
Definition: MCDwarf.h:247
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:40
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:241
unsigned getFileNumber() const
Definition: MCDwarf.h:315
LLVMContext & Context
static void Make(MCObjectStreamer *MCOS, MCSection *Section)
Definition: MCDwarf.cpp:50
unsigned getColumn() const
Get the Column of this MCDwarfLoc.
Definition: MCDwarf.h:90
SmallVectorImpl< std::string > & getMCDwarfDirs()
Definition: MCDwarf.h:255
MCDwarfLineEntryCollection::iterator iterator
Definition: MCDwarf.h:168
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:39
static MCCFIInstruction createRememberState(MCSymbol *L)
.cfi_remember_state Save all current rules for all registers.
Definition: MCDwarf.h:441
SourceMgr SrcMgr
static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register, int Offset)
.cfi_offset Previous value of Register is saved at offset Offset from CFA.
Definition: MCDwarf.h:396
MCSymbol * getLabel() const
Definition: MCDwarf.h:239
MCDwarfLineEntryCollection::const_iterator const_iterator
Definition: MCDwarf.h:169
unsigned CurrentCfaRegister
Definition: MCDwarf.h:501
unsigned getFileNum() const
Get the FileNum of this MCDwarfLoc.
Definition: MCDwarf.h:84
static void EmitAdvanceLoc(MCObjectStreamer &Streamer, uint64_t AddrDelta)
Definition: MCDwarf.cpp:1549
const_iterator begin(StringRef path)
Get begin iterator over path.
Definition: Path.cpp:233
SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles()
Definition: MCDwarf.h:263
MCSymbol * getLabel() const
Definition: MCDwarf.h:148
#define R2(n)
static void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params, int64_t LineDelta, uint64_t AddrDelta)
Utility function to emit the encoding to a streamer.
Definition: MCDwarf.cpp:407
void setIsa(unsigned isa)
Set the Isa of this MCDwarfLoc.
Definition: MCDwarf.h:120
static MCCFIInstruction createDefCfaOffset(MCSymbol *L, int Offset)
.cfi_def_cfa_offset modifies a rule for computing CFA.
Definition: MCDwarf.h:383
unsigned LsdaEncoding
Definition: MCDwarf.h:503
static MCCFIInstruction createAdjustCfaOffset(MCSymbol *L, int Adjustment)
.cfi_adjust_cfa_offset Same as .cfi_def_cfa_offset, but Offset is a relative value that is added/subt...
Definition: MCDwarf.h:390
static void Encode(MCContext &Context, MCDwarfLineTableParams Params, int64_t LineDelta, uint64_t AddrDelta, raw_ostream &OS)
Utility function to encode a Dwarf pair of LineDelta and AddrDeltas.
Definition: MCDwarf.cpp:423
unsigned getRegister() const
Definition: MCDwarf.h:464
MCDwarfLineEntry(MCSymbol *label, const MCDwarfLoc loc)
Definition: MCDwarf.h:145
std::vector< MCCFIInstruction > Instructions
Definition: MCDwarf.h:500
static MCCFIInstruction createUndefined(MCSymbol *L, unsigned Register)
.cfi_undefined From now on the previous value of Register can't be restored anymore.
Definition: MCDwarf.h:430
int getOffset() const
Definition: MCDwarf.h:477
MapVector< MCSection *, MCDwarfLineEntryCollection > MCLineDivisionMap
Definition: MCDwarf.h:170
std::string Name
Definition: MCDwarf.h:46
struct fuzzer::@269 Flags
unsigned getDiscriminator() const
Get the Discriminator of this MCDwarfLoc.
Definition: MCDwarf.h:99
unsigned getLineNumber() const
Definition: MCDwarf.h:316
MCSymbol * Begin
Definition: MCDwarf.h:496
uint8_t DWARF2LineRange
Range of line offsets in a special line info. opcode.
Definition: MCDwarf.h:193
const MCSymbol * Lsda
Definition: MCDwarf.h:499
Context object for machine code objects.
Definition: MCContext.h:51
StringRef getValues() const
Definition: MCDwarf.h:484
void setLine(unsigned line)
Set the Line of this MCDwarfLoc.
Definition: MCDwarf.h:105
const SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles() const
Definition: MCDwarf.h:259
Streaming object file generation interface.
Instances of this class represent the information from a dwarf .loc directive.
Definition: MCDwarf.h:54
Function Alias Analysis false
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
unsigned getLine() const
Get the Line of this MCDwarfLoc.
Definition: MCDwarf.h:87
void EmitCU(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params) const
Definition: MCDwarf.cpp:319
static MCCFIInstruction createSameValue(MCSymbol *L, unsigned Register)
.cfi_same_value Current value of Register is the same as in the previous frame.
Definition: MCDwarf.h:436
Streaming machine code generation interface.
Definition: MCStreamer.h:161
unsigned getFile(StringRef Directory, StringRef FileName)
Definition: MCDwarf.h:219
uint8_t DWARF2LineOpcodeBase
First special line opcode - leave room for the standard opcodes.
Definition: MCDwarf.h:188
static MCCFIInstruction createDefCfa(MCSymbol *L, unsigned Register, int Offset)
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it...
Definition: MCDwarf.h:369
static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register)
.cfi_def_cfa_register modifies a rule for computing CFA.
Definition: MCDwarf.h:376
Instances of this class represent the line information for a compile unit where machine instructions ...
Definition: MCDwarf.h:160
static MCCFIInstruction createWindowSave(MCSymbol *L)
.cfi_window_save SPARC register window is saved.
Definition: MCDwarf.h:417
void addLineEntry(const MCDwarfLineEntry &LineEntry, MCSection *Sec)
Definition: MCDwarf.h:163
static MCCFIInstruction createGnuArgsSize(MCSymbol *L, int Size)
A special wrapper for .cfi_escape that indicates GNU_ARGS_SIZE.
Definition: MCDwarf.h:457
const SmallVectorImpl< std::string > & getMCDwarfDirs() const
Definition: MCDwarf.h:251
std::vector< MCDwarfLineEntry > MCDwarfLineEntryCollection
Definition: MCDwarf.h:167
unsigned getFile(StringRef &Directory, StringRef &FileName, unsigned FileNumber=0)
Definition: MCDwarf.cpp:337
void setCompilationDir(StringRef CompilationDir)
Definition: MCDwarf.h:216
static MCCFIInstruction createRelOffset(MCSymbol *L, unsigned Register, int Offset)
.cfi_rel_offset Previous value of Register is saved at offset Offset from the current CFA register...
Definition: MCDwarf.h:404
static MCCFIInstruction createRestore(MCSymbol *L, unsigned Register)
.cfi_restore says that the rule for Register is now the same as it was at the beginning of the functi...
Definition: MCDwarf.h:424
unsigned PersonalityEncoding
Definition: MCDwarf.h:502
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling...
Definition: SourceMgr.h:35
static MCCFIInstruction createRestoreState(MCSymbol *L)
.cfi_restore_state Restore the previously saved state.
Definition: MCDwarf.h:446
int8_t DWARF2LineBase
Minimum line offset in a special line info.
Definition: MCDwarf.h:191
unsigned getIsa() const
Get the Isa of this MCDwarfLoc.
Definition: MCDwarf.h:96
OpType getOperation() const
Definition: MCDwarf.h:461
uint64_t * Vals
unsigned getRegister2() const
Definition: MCDwarf.h:472
static void EncodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta, raw_ostream &OS)
Definition: MCDwarf.cpp:1558
LLVM_NODISCARD bool isa(const Y &Val)
Definition: Casting.h:131
uint32_t CompactUnwindEncoding
Definition: MCDwarf.h:504
unsigned getFlags() const
Get the Flags of this MCDwarfLoc.
Definition: MCDwarf.h:93
static void Emit(MCStreamer *MCOS)
Definition: MCDwarf.cpp:841
Instances of this class represent the line information for the dwarf line table entries.
Definition: MCDwarf.h:136
static void Emit(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params)
Definition: MCDwarf.cpp:183
void Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params) const
Definition: MCDwarf.cpp:202
MCLineSection & getMCLineSections()
Definition: MCDwarf.h:270
StringMap< unsigned > SourceIdMap
Definition: MCDwarf.h:200
const MCLineSection & getMCLineSections() const
Definition: MCDwarf.h:267
static void Make(MCSymbol *Symbol, MCStreamer *MCOS, SourceMgr &SrcMgr, SMLoc &Loc)
Definition: MCDwarf.cpp:912
const MCSymbol * Personality
Definition: MCDwarf.h:498
void setFileNum(unsigned fileNum)
Set the FileNum of this MCDwarfLoc.
Definition: MCDwarf.h:102
void setFlags(unsigned flags)
Set the Flags of this MCDwarfLoc.
Definition: MCDwarf.h:114
const MCLineDivisionMap & getMCLineEntries() const
Definition: MCDwarf.h:178
std::pair< MCSymbol *, MCSymbol * > Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params) const
Definition: MCDwarf.cpp:208
unsigned DirIndex
Definition: MCDwarf.h:49
MCGenDwarfLabelEntry(StringRef name, unsigned fileNumber, unsigned lineNumber, MCSymbol *label)
Definition: MCDwarf.h:309
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef getName() const
Definition: MCDwarf.h:314
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:36
static const char * name
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
SmallVector< MCDwarfFile, 3 > MCDwarfFiles
Definition: MCDwarf.h:199
void setColumn(unsigned column)
Set the Column of this MCDwarfLoc.
Definition: MCDwarf.h:108
static void Emit(MCObjectStreamer &streamer, MCAsmBackend *MAB, bool isEH)
Definition: MCDwarf.cpp:1487
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
MCSymbol * getLabel() const
Definition: MCDwarf.h:317
Instances of this class represent the name of the dwarf .file directive and its associated dwarf file...
Definition: MCDwarf.h:43
Represents a location in source code.
Definition: SMLoc.h:24
unsigned getFile(StringRef &Directory, StringRef &FileName, unsigned FileNumber=0)
Definition: MCDwarf.cpp:332
static MCCFIInstruction createEscape(MCSymbol *L, StringRef Vals)
.cfi_escape Allows the user to add arbitrary bytes to the unwind info.
Definition: MCDwarf.h:452
MCSymbol * getLabel() const
Definition: MCDwarf.h:462
SmallVector< std::string, 3 > MCDwarfDirs
Definition: MCDwarf.h:198
void setDiscriminator(unsigned discriminator)
Set the Discriminator of this MCDwarfLoc.
Definition: MCDwarf.h:126
void setLabel(MCSymbol *Label)
Definition: MCDwarf.h:243
static MCCFIInstruction createRegister(MCSymbol *L, unsigned Register1, unsigned Register2)
.cfi_register Previous value of Register1 is saved in register Register2.
Definition: MCDwarf.h:411