LLVM  7.0.0svn
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/Optional.h"
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/ADT/StringMap.h"
22 #include "llvm/ADT/StringRef.h"
23 #include "llvm/MC/MCSection.h"
24 #include "llvm/Support/Error.h"
25 #include "llvm/Support/MD5.h"
26 #include <cassert>
27 #include <cstdint>
28 #include <string>
29 #include <utility>
30 #include <vector>
31 
32 namespace llvm {
33 
34 template <typename T> class ArrayRef;
35 class MCAsmBackend;
36 class MCContext;
37 class MCDwarfLineStr;
38 class MCObjectStreamer;
39 class MCStreamer;
40 class MCSymbol;
41 class raw_ostream;
42 class SMLoc;
43 class SourceMgr;
44 
45 /// Instances of this class represent the name of the dwarf
46 /// .file directive and its associated dwarf file number in the MC file,
47 /// and MCDwarfFile's are created and uniqued by the MCContext class where
48 /// the file number for each is its index into the vector of DwarfFiles (note
49 /// index 0 is not used and not a valid dwarf file number).
50 struct MCDwarfFile {
51  // The base name of the file without its directory path.
52  std::string Name;
53 
54  // The index into the list of directory names for this file name.
55  unsigned DirIndex;
56 
57  /// The MD5 checksum, if there is one. Non-owning pointer to data allocated
58  /// in MCContext.
60 
61  /// The source code of the file. Non-owning reference to data allocated in
62  /// MCContext.
64 };
65 
66 /// Instances of this class represent the information from a
67 /// dwarf .loc directive.
68 class MCDwarfLoc {
69  uint32_t FileNum;
70  uint32_t Line;
71  uint16_t Column;
72  // Flags (see #define's below)
73  uint8_t Flags;
74  uint8_t Isa;
75  uint32_t Discriminator;
76 
77 // Flag that indicates the initial value of the is_stmt_start flag.
78 #define DWARF2_LINE_DEFAULT_IS_STMT 1
79 
80 #define DWARF2_FLAG_IS_STMT (1 << 0)
81 #define DWARF2_FLAG_BASIC_BLOCK (1 << 1)
82 #define DWARF2_FLAG_PROLOGUE_END (1 << 2)
83 #define DWARF2_FLAG_EPILOGUE_BEGIN (1 << 3)
84 
85 private: // MCContext manages these
86  friend class MCContext;
87  friend class MCDwarfLineEntry;
88 
89  MCDwarfLoc(unsigned fileNum, unsigned line, unsigned column, unsigned flags,
90  unsigned isa, unsigned discriminator)
91  : FileNum(fileNum), Line(line), Column(column), Flags(flags), Isa(isa),
92  Discriminator(discriminator) {}
93 
94  // Allow the default copy constructor and assignment operator to be used
95  // for an MCDwarfLoc object.
96 
97 public:
98  /// Get the FileNum of this MCDwarfLoc.
99  unsigned getFileNum() const { return FileNum; }
100 
101  /// Get the Line of this MCDwarfLoc.
102  unsigned getLine() const { return Line; }
103 
104  /// Get the Column of this MCDwarfLoc.
105  unsigned getColumn() const { return Column; }
106 
107  /// Get the Flags of this MCDwarfLoc.
108  unsigned getFlags() const { return Flags; }
109 
110  /// Get the Isa of this MCDwarfLoc.
111  unsigned getIsa() const { return Isa; }
112 
113  /// Get the Discriminator of this MCDwarfLoc.
114  unsigned getDiscriminator() const { return Discriminator; }
115 
116  /// Set the FileNum of this MCDwarfLoc.
117  void setFileNum(unsigned fileNum) { FileNum = fileNum; }
118 
119  /// Set the Line of this MCDwarfLoc.
120  void setLine(unsigned line) { Line = line; }
121 
122  /// Set the Column of this MCDwarfLoc.
123  void setColumn(unsigned column) {
124  assert(column <= UINT16_MAX);
125  Column = column;
126  }
127 
128  /// Set the Flags of this MCDwarfLoc.
129  void setFlags(unsigned flags) {
130  assert(flags <= UINT8_MAX);
131  Flags = flags;
132  }
133 
134  /// Set the Isa of this MCDwarfLoc.
135  void setIsa(unsigned isa) {
136  assert(isa <= UINT8_MAX);
137  Isa = isa;
138  }
139 
140  /// Set the Discriminator of this MCDwarfLoc.
141  void setDiscriminator(unsigned discriminator) {
142  Discriminator = discriminator;
143  }
144 };
145 
146 /// Instances of this class represent the line information for
147 /// the dwarf line table entries. Which is created after a machine
148 /// instruction is assembled and uses an address from a temporary label
149 /// created at the current address in the current section and the info from
150 /// the last .loc directive seen as stored in the context.
151 class MCDwarfLineEntry : public MCDwarfLoc {
152  MCSymbol *Label;
153 
154 private:
155  // Allow the default copy constructor and assignment operator to be used
156  // for an MCDwarfLineEntry object.
157 
158 public:
159  // Constructor to create an MCDwarfLineEntry given a symbol and the dwarf loc.
161  : MCDwarfLoc(loc), Label(label) {}
162 
163  MCSymbol *getLabel() const { return Label; }
164 
165  // This is called when an instruction is assembled into the specified
166  // section and if there is information from the last .loc directive that
167  // has yet to have a line entry made for it is made.
168  static void Make(MCObjectStreamer *MCOS, MCSection *Section);
169 };
170 
171 /// Instances of this class represent the line information for a compile
172 /// unit where machine instructions have been assembled after seeing .loc
173 /// directives. This is the information used to build the dwarf line
174 /// table for a section.
176 public:
177  // Add an entry to this MCLineSection's line entries.
178  void addLineEntry(const MCDwarfLineEntry &LineEntry, MCSection *Sec) {
179  MCLineDivisions[Sec].push_back(LineEntry);
180  }
181 
182  using MCDwarfLineEntryCollection = std::vector<MCDwarfLineEntry>;
183  using iterator = MCDwarfLineEntryCollection::iterator;
184  using const_iterator = MCDwarfLineEntryCollection::const_iterator;
186 
187 private:
188  // A collection of MCDwarfLineEntry for each section.
189  MCLineDivisionMap MCLineDivisions;
190 
191 public:
192  // Returns the collection of MCDwarfLineEntry for a given Compile Unit ID.
194  return MCLineDivisions;
195  }
196 };
197 
199  /// First special line opcode - leave room for the standard opcodes.
200  /// Note: If you want to change this, you'll have to update the
201  /// "StandardOpcodeLengths" table that is emitted in
202  /// \c Emit().
203  uint8_t DWARF2LineOpcodeBase = 13;
204  /// Minimum line offset in a special line info. opcode. The value
205  /// -5 was chosen to give a reasonable range of values.
206  int8_t DWARF2LineBase = -5;
207  /// Range of line offsets in a special line info. opcode.
208  uint8_t DWARF2LineRange = 14;
209 };
210 
212  MCSymbol *Label = nullptr;
218  bool HasSource = false;
219 private:
220  bool HasAllMD5 = true;
221  bool HasAnyMD5 = false;
222 
223 public:
224  MCDwarfLineTableHeader() = default;
225 
226  Expected<unsigned> tryGetFile(StringRef &Directory, StringRef &FileName,
229  unsigned FileNumber = 0);
230  std::pair<MCSymbol *, MCSymbol *>
231  Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
232  Optional<MCDwarfLineStr> &LineStr) const;
233  std::pair<MCSymbol *, MCSymbol *>
234  Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
235  ArrayRef<char> SpecialOpcodeLengths,
236  Optional<MCDwarfLineStr> &LineStr) const;
237  void resetMD5Usage() {
238  HasAllMD5 = true;
239  HasAnyMD5 = false;
240  }
241  void trackMD5Usage(bool MD5Used) {
242  HasAllMD5 &= MD5Used;
243  HasAnyMD5 |= MD5Used;
244  }
245  bool isMD5UsageConsistent() const {
246  return MCDwarfFiles.empty() || (HasAllMD5 == HasAnyMD5);
247  }
248 
249 private:
250  void emitV2FileDirTables(MCStreamer *MCOS) const;
251  void emitV5FileDirTables(MCStreamer *MCOS, Optional<MCDwarfLineStr> &LineStr,
252  StringRef CtxCompilationDir) const;
253 };
254 
256  MCDwarfLineTableHeader Header;
257 
258 public:
259  void maybeSetRootFile(StringRef Directory, StringRef FileName,
261  if (!Header.RootFile.Name.empty())
262  return;
263  Header.CompilationDir = Directory;
264  Header.RootFile.Name = FileName;
265  Header.RootFile.DirIndex = 0;
266  Header.RootFile.Checksum = Checksum;
267  Header.RootFile.Source = Source;
268  Header.trackMD5Usage(Checksum);
269  Header.HasSource = Source.hasValue();
270  }
271 
272  unsigned getFile(StringRef Directory, StringRef FileName,
274  return cantFail(Header.tryGetFile(Directory, FileName, Checksum, Source));
275  }
276 
277  void Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params,
278  MCSection *Section) const;
279 };
280 
282  MCDwarfLineTableHeader Header;
283  MCLineSection MCLineSections;
284 
285 public:
286  // This emits the Dwarf file and the line tables for all Compile Units.
287  static void Emit(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params);
288 
289  // This emits the Dwarf file and the line tables for a given Compile Unit.
290  void EmitCU(MCObjectStreamer *MCOS, MCDwarfLineTableParams Params,
291  Optional<MCDwarfLineStr> &LineStr) const;
292 
293  Expected<unsigned> tryGetFile(StringRef &Directory, StringRef &FileName,
296  unsigned FileNumber = 0);
297  unsigned getFile(StringRef &Directory, StringRef &FileName,
298  MD5::MD5Result *Checksum, Optional<StringRef> &Source,
299  unsigned FileNumber = 0) {
300  return cantFail(tryGetFile(Directory, FileName, Checksum, Source,
301  FileNumber));
302  }
303 
304  void setRootFile(StringRef Directory, StringRef FileName,
305  MD5::MD5Result *Checksum, Optional<StringRef> Source) {
306  Header.CompilationDir = Directory;
307  Header.RootFile.Name = FileName;
308  Header.RootFile.DirIndex = 0;
309  Header.RootFile.Checksum = Checksum;
310  Header.RootFile.Source = Source;
311  Header.trackMD5Usage(Checksum);
312  Header.HasSource = Source.hasValue();
313  }
314 
315  void resetRootFile() {
316  assert(Header.MCDwarfFiles.empty());
317  Header.resetMD5Usage();
318  Header.HasSource = false;
319  }
320 
321  // Report whether MD5 usage has been consistent (all-or-none).
322  bool isMD5UsageConsistent() const { return Header.isMD5UsageConsistent(); }
323 
324  MCSymbol *getLabel() const {
325  return Header.Label;
326  }
327 
328  void setLabel(MCSymbol *Label) {
329  Header.Label = Label;
330  }
331 
333  return Header.MCDwarfDirs;
334  }
335 
337  return Header.MCDwarfDirs;
338  }
339 
341  return Header.MCDwarfFiles;
342  }
343 
345  return Header.MCDwarfFiles;
346  }
347 
349  return MCLineSections;
350  }
352  return MCLineSections;
353  }
354 };
355 
357 public:
358  /// Utility function to encode a Dwarf pair of LineDelta and AddrDeltas.
359  static void Encode(MCContext &Context, MCDwarfLineTableParams Params,
360  int64_t LineDelta, uint64_t AddrDelta, raw_ostream &OS);
361 
362  /// Utility function to emit the encoding to a streamer.
363  static void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
364  int64_t LineDelta, uint64_t AddrDelta);
365 };
366 
368 public:
369  //
370  // When generating dwarf for assembly source files this emits the Dwarf
371  // sections.
372  //
373  static void Emit(MCStreamer *MCOS);
374 };
375 
376 // When generating dwarf for assembly source files this is the info that is
377 // needed to be gathered for each symbol that will have a dwarf label.
379 private:
380  // Name of the symbol without a leading underbar, if any.
381  StringRef Name;
382  // The dwarf file number this symbol is in.
383  unsigned FileNumber;
384  // The line number this symbol is at.
385  unsigned LineNumber;
386  // The low_pc for the dwarf label is taken from this symbol.
387  MCSymbol *Label;
388 
389 public:
390  MCGenDwarfLabelEntry(StringRef name, unsigned fileNumber, unsigned lineNumber,
391  MCSymbol *label)
392  : Name(name), FileNumber(fileNumber), LineNumber(lineNumber),
393  Label(label) {}
394 
395  StringRef getName() const { return Name; }
396  unsigned getFileNumber() const { return FileNumber; }
397  unsigned getLineNumber() const { return LineNumber; }
398  MCSymbol *getLabel() const { return Label; }
399 
400  // This is called when label is created when we are generating dwarf for
401  // assembly source files.
402  static void Make(MCSymbol *Symbol, MCStreamer *MCOS, SourceMgr &SrcMgr,
403  SMLoc &Loc);
404 };
405 
407 public:
408  enum OpType {
423  OpGnuArgsSize
424  };
425 
426 private:
428  MCSymbol *Label;
429  unsigned Register;
430  union {
431  int Offset;
432  unsigned Register2;
433  };
434  std::vector<char> Values;
435 
436  MCCFIInstruction(OpType Op, MCSymbol *L, unsigned R, int O, StringRef V)
437  : Operation(Op), Label(L), Register(R), Offset(O),
438  Values(V.begin(), V.end()) {
439  assert(Op != OpRegister);
440  }
441 
442  MCCFIInstruction(OpType Op, MCSymbol *L, unsigned R1, unsigned R2)
443  : Operation(Op), Label(L), Register(R1), Register2(R2) {
444  assert(Op == OpRegister);
445  }
446 
447 public:
448  /// .cfi_def_cfa defines a rule for computing CFA as: take address from
449  /// Register and add Offset to it.
450  static MCCFIInstruction createDefCfa(MCSymbol *L, unsigned Register,
451  int Offset) {
452  return MCCFIInstruction(OpDefCfa, L, Register, -Offset, "");
453  }
454 
455  /// .cfi_def_cfa_register modifies a rule for computing CFA. From now
456  /// on Register will be used instead of the old one. Offset remains the same.
457  static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register) {
458  return MCCFIInstruction(OpDefCfaRegister, L, Register, 0, "");
459  }
460 
461  /// .cfi_def_cfa_offset modifies a rule for computing CFA. Register
462  /// remains the same, but offset is new. Note that it is the absolute offset
463  /// that will be added to a defined register to the compute CFA address.
465  return MCCFIInstruction(OpDefCfaOffset, L, 0, -Offset, "");
466  }
467 
468  /// .cfi_adjust_cfa_offset Same as .cfi_def_cfa_offset, but
469  /// Offset is a relative value that is added/subtracted from the previous
470  /// offset.
471  static MCCFIInstruction createAdjustCfaOffset(MCSymbol *L, int Adjustment) {
472  return MCCFIInstruction(OpAdjustCfaOffset, L, 0, Adjustment, "");
473  }
474 
475  /// .cfi_offset Previous value of Register is saved at offset Offset
476  /// from CFA.
477  static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register,
478  int Offset) {
479  return MCCFIInstruction(OpOffset, L, Register, Offset, "");
480  }
481 
482  /// .cfi_rel_offset Previous value of Register is saved at offset
483  /// Offset from the current CFA register. This is transformed to .cfi_offset
484  /// using the known displacement of the CFA register from the CFA.
485  static MCCFIInstruction createRelOffset(MCSymbol *L, unsigned Register,
486  int Offset) {
487  return MCCFIInstruction(OpRelOffset, L, Register, Offset, "");
488  }
489 
490  /// .cfi_register Previous value of Register1 is saved in
491  /// register Register2.
492  static MCCFIInstruction createRegister(MCSymbol *L, unsigned Register1,
493  unsigned Register2) {
494  return MCCFIInstruction(OpRegister, L, Register1, Register2);
495  }
496 
497  /// .cfi_window_save SPARC register window is saved.
499  return MCCFIInstruction(OpWindowSave, L, 0, 0, "");
500  }
501 
502  /// .cfi_restore says that the rule for Register is now the same as it
503  /// was at the beginning of the function, after all initial instructions added
504  /// by .cfi_startproc were executed.
505  static MCCFIInstruction createRestore(MCSymbol *L, unsigned Register) {
506  return MCCFIInstruction(OpRestore, L, Register, 0, "");
507  }
508 
509  /// .cfi_undefined From now on the previous value of Register can't be
510  /// restored anymore.
511  static MCCFIInstruction createUndefined(MCSymbol *L, unsigned Register) {
512  return MCCFIInstruction(OpUndefined, L, Register, 0, "");
513  }
514 
515  /// .cfi_same_value Current value of Register is the same as in the
516  /// previous frame. I.e., no restoration is needed.
517  static MCCFIInstruction createSameValue(MCSymbol *L, unsigned Register) {
518  return MCCFIInstruction(OpSameValue, L, Register, 0, "");
519  }
520 
521  /// .cfi_remember_state Save all current rules for all registers.
523  return MCCFIInstruction(OpRememberState, L, 0, 0, "");
524  }
525 
526  /// .cfi_restore_state Restore the previously saved state.
528  return MCCFIInstruction(OpRestoreState, L, 0, 0, "");
529  }
530 
531  /// .cfi_escape Allows the user to add arbitrary bytes to the unwind
532  /// info.
534  return MCCFIInstruction(OpEscape, L, 0, 0, Vals);
535  }
536 
537  /// A special wrapper for .cfi_escape that indicates GNU_ARGS_SIZE
539  return MCCFIInstruction(OpGnuArgsSize, L, 0, Size, "");
540  }
541 
542  OpType getOperation() const { return Operation; }
543  MCSymbol *getLabel() const { return Label; }
544 
545  unsigned getRegister() const {
546  assert(Operation == OpDefCfa || Operation == OpOffset ||
547  Operation == OpRestore || Operation == OpUndefined ||
548  Operation == OpSameValue || Operation == OpDefCfaRegister ||
549  Operation == OpRelOffset || Operation == OpRegister);
550  return Register;
551  }
552 
553  unsigned getRegister2() const {
554  assert(Operation == OpRegister);
555  return Register2;
556  }
557 
558  int getOffset() const {
559  assert(Operation == OpDefCfa || Operation == OpOffset ||
560  Operation == OpRelOffset || Operation == OpDefCfaOffset ||
561  Operation == OpAdjustCfaOffset || Operation == OpGnuArgsSize);
562  return Offset;
563  }
564 
566  assert(Operation == OpEscape);
567  return StringRef(&Values[0], Values.size());
568  }
569 };
570 
572  MCDwarfFrameInfo() = default;
573 
574  MCSymbol *Begin = nullptr;
575  MCSymbol *End = nullptr;
576  const MCSymbol *Personality = nullptr;
577  const MCSymbol *Lsda = nullptr;
578  std::vector<MCCFIInstruction> Instructions;
579  unsigned CurrentCfaRegister = 0;
580  unsigned PersonalityEncoding = 0;
581  unsigned LsdaEncoding = 0;
582  uint32_t CompactUnwindEncoding = 0;
583  bool IsSignalFrame = false;
584  bool IsSimple = false;
585  unsigned RAReg = static_cast<unsigned>(INT_MAX);
586 };
587 
589 public:
590  //
591  // This emits the frame info section.
592  //
593  static void Emit(MCObjectStreamer &streamer, MCAsmBackend *MAB, bool isEH);
594  static void EmitAdvanceLoc(MCObjectStreamer &Streamer, uint64_t AddrDelta);
595  static void EncodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta,
596  raw_ostream &OS);
597 };
598 
599 } // end namespace llvm
600 
601 #endif // LLVM_MC_MCDWARF_H
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
Definition: Error.h:688
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:39
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:250
unsigned getLine() const
Get the Line of this MCDwarfLoc.
Definition: MCDwarf.h:102
LLVMContext & Context
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:241
MCDwarfLineEntryCollection::iterator iterator
Definition: MCDwarf.h:183
Optional< StringRef > Source
The source code of the file.
Definition: MCDwarf.h:63
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
SmallVectorImpl< std::string > & getMCDwarfDirs()
Definition: MCDwarf.h:336
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
static MCCFIInstruction createRememberState(MCSymbol *L)
.cfi_remember_state Save all current rules for all registers.
Definition: MCDwarf.h:522
SourceMgr SrcMgr
Definition: Error.cpp:23
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:477
const SmallVectorImpl< std::string > & getMCDwarfDirs() const
Definition: MCDwarf.h:332
unsigned getFlags() const
Get the Flags of this MCDwarfLoc.
Definition: MCDwarf.h:108
SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles()
Definition: MCDwarf.h:344
#define R2(n)
void setIsa(unsigned isa)
Set the Isa of this MCDwarfLoc.
Definition: MCDwarf.h:135
static MCCFIInstruction createDefCfaOffset(MCSymbol *L, int Offset)
.cfi_def_cfa_offset modifies a rule for computing CFA.
Definition: MCDwarf.h:464
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:471
std::vector< MCDwarfLineEntry > MCDwarfLineEntryCollection
Definition: MCDwarf.h:182
MCDwarfLineEntry(MCSymbol *label, const MCDwarfLoc loc)
Definition: MCDwarf.h:160
std::vector< MCCFIInstruction > Instructions
Definition: MCDwarf.h:578
static MCCFIInstruction createUndefined(MCSymbol *L, unsigned Register)
.cfi_undefined From now on the previous value of Register can&#39;t be restored anymore.
Definition: MCDwarf.h:511
std::string Name
Definition: MCDwarf.h:52
bool isMD5UsageConsistent() const
Definition: MCDwarf.h:322
StringRef getName() const
Definition: MCDwarf.h:395
const MCLineDivisionMap & getMCLineEntries() const
Definition: MCDwarf.h:193
Tagged union holding either a T or a Error.
Definition: CachePruning.h:23
unsigned getFile(StringRef &Directory, StringRef &FileName, MD5::MD5Result *Checksum, Optional< StringRef > &Source, unsigned FileNumber=0)
Definition: MCDwarf.h:297
Context object for machine code objects.
Definition: MCContext.h:63
void setLine(unsigned line)
Set the Line of this MCDwarfLoc.
Definition: MCDwarf.h:120
unsigned getFile(StringRef Directory, StringRef FileName, MD5::MD5Result *Checksum, Optional< StringRef > Source)
Definition: MCDwarf.h:272
Streaming object file generation interface.
Instances of this class represent the information from a dwarf .loc directive.
Definition: MCDwarf.h:68
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
unsigned getFileNumber() const
Definition: MCDwarf.h:396
MCSymbol * getLabel() const
Definition: MCDwarf.h:543
unsigned getFileNum() const
Get the FileNum of this MCDwarfLoc.
Definition: MCDwarf.h:99
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:517
const SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles() const
Definition: MCDwarf.h:340
Streaming machine code generation interface.
Definition: MCStreamer.h:183
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:450
unsigned getRegister2() const
Definition: MCDwarf.h:553
static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register)
.cfi_def_cfa_register modifies a rule for computing CFA.
Definition: MCDwarf.h:457
PowerPC Reduce CR logical Operation
Instances of this class represent the line information for a compile unit where machine instructions ...
Definition: MCDwarf.h:175
static MCCFIInstruction createWindowSave(MCSymbol *L)
.cfi_window_save SPARC register window is saved.
Definition: MCDwarf.h:498
void maybeSetRootFile(StringRef Directory, StringRef FileName, MD5::MD5Result *Checksum, Optional< StringRef > Source)
Definition: MCDwarf.h:259
void addLineEntry(const MCDwarfLineEntry &LineEntry, MCSection *Sec)
Definition: MCDwarf.h:178
static MCCFIInstruction createGnuArgsSize(MCSymbol *L, int Size)
A special wrapper for .cfi_escape that indicates GNU_ARGS_SIZE.
Definition: MCDwarf.h:538
int getOffset() const
Definition: MCDwarf.h:558
OpType getOperation() const
Definition: MCDwarf.h:542
static const unsigned End
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:485
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:505
unsigned getDiscriminator() const
Get the Discriminator of this MCDwarfLoc.
Definition: MCDwarf.h:114
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling...
Definition: SourceMgr.h:42
StringRef getValues() const
Definition: MCDwarf.h:565
const MCLineSection & getMCLineSections() const
Definition: MCDwarf.h:348
static MCCFIInstruction createRestoreState(MCSymbol *L)
.cfi_restore_state Restore the previously saved state.
Definition: MCDwarf.h:527
unsigned getIsa() const
Get the Isa of this MCDwarfLoc.
Definition: MCDwarf.h:111
unsigned getRegister() const
Definition: MCDwarf.h:545
void trackMD5Usage(bool MD5Used)
Definition: MCDwarf.h:241
MCDwarfLineEntryCollection::const_iterator const_iterator
Definition: MCDwarf.h:184
Promote Memory to Register
Definition: Mem2Reg.cpp:110
LLVM_NODISCARD bool isa(const Y &Val)
Definition: Casting.h:142
Instances of this class represent the line information for the dwarf line table entries.
Definition: MCDwarf.h:151
bool hasValue() const
Definition: Optional.h:183
MCLineSection & getMCLineSections()
Definition: MCDwarf.h:351
MCSymbol * getLabel() const
Definition: MCDwarf.h:163
MCSymbol * getLabel() const
Definition: MCDwarf.h:398
StringMap< unsigned > SourceIdMap
Definition: MCDwarf.h:215
void setRootFile(StringRef Directory, StringRef FileName, MD5::MD5Result *Checksum, Optional< StringRef > Source)
Definition: MCDwarf.h:304
LLVM_NODISCARD bool empty() const
Definition: SmallVector.h:62
unsigned getColumn() const
Get the Column of this MCDwarfLoc.
Definition: MCDwarf.h:105
void setFileNum(unsigned fileNum)
Set the FileNum of this MCDwarfLoc.
Definition: MCDwarf.h:117
void setFlags(unsigned flags)
Set the Flags of this MCDwarfLoc.
Definition: MCDwarf.h:129
MD5::MD5Result * Checksum
The MD5 checksum, if there is one.
Definition: MCDwarf.h:59
unsigned DirIndex
Definition: MCDwarf.h:55
MCSymbol * getLabel() const
Definition: MCDwarf.h:324
MCGenDwarfLabelEntry(StringRef name, unsigned fileNumber, unsigned lineNumber, MCSymbol *label)
Definition: MCDwarf.h:390
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:42
static const char * name
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
SmallVector< MCDwarfFile, 3 > MCDwarfFiles
Definition: MCDwarf.h:214
void setColumn(unsigned column)
Set the Column of this MCDwarfLoc.
Definition: MCDwarf.h:123
bool isMD5UsageConsistent() const
Definition: MCDwarf.h:245
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
Instances of this class represent the name of the dwarf .file directive and its associated dwarf file...
Definition: MCDwarf.h:50
Represents a location in source code.
Definition: SMLoc.h:24
Expected< unsigned > tryGetFile(StringRef &Directory, StringRef &FileName, MD5::MD5Result *Checksum, Optional< StringRef > &Source, unsigned FileNumber=0)
Definition: MCDwarf.cpp:545
static MCCFIInstruction createEscape(MCSymbol *L, StringRef Vals)
.cfi_escape Allows the user to add arbitrary bytes to the unwind info.
Definition: MCDwarf.h:533
unsigned getLineNumber() const
Definition: MCDwarf.h:397
SmallVector< std::string, 3 > MCDwarfDirs
Definition: MCDwarf.h:213
void setDiscriminator(unsigned discriminator)
Set the Discriminator of this MCDwarfLoc.
Definition: MCDwarf.h:141
void setLabel(MCSymbol *Label)
Definition: MCDwarf.h:328
static MCCFIInstruction createRegister(MCSymbol *L, unsigned Register1, unsigned Register2)
.cfi_register Previous value of Register1 is saved in register Register2.
Definition: MCDwarf.h:492