LLVM 23.0.0git
MCDwarf.h
Go to the documentation of this file.
1//===- MCDwarf.h - Machine Code Dwarf support -------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains the declaration of the MCDwarfFile to support the dwarf
10// .file directive and the .loc directive.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_MC_MCDWARF_H
15#define LLVM_MC_MCDWARF_H
16
17#include "llvm/ADT/MapVector.h"
19#include "llvm/ADT/StringMap.h"
20#include "llvm/ADT/StringRef.h"
23#include "llvm/Support/Error.h"
24#include "llvm/Support/MD5.h"
25#include "llvm/Support/SMLoc.h"
27#include <cassert>
28#include <cstdint>
29#include <optional>
30#include <string>
31#include <utility>
32#include <variant>
33#include <vector>
34
35namespace llvm {
36
37template <typename T> class ArrayRef;
38class MCAsmBackend;
39class MCContext;
41class MCSection;
42class MCStreamer;
43class MCSymbol;
44class raw_ostream;
45class SourceMgr;
46
47namespace mcdwarf {
48// Emit the common part of the DWARF 5 range/locations list tables header.
50} // namespace mcdwarf
51
52/// Manage the .debug_line_str section contents, if we use it.
54 BumpPtrAllocator Alloc;
55 StringSaver Saver{Alloc};
56 MCSymbol *LineStrLabel = nullptr;
58 bool UseRelocs = false;
59
60public:
61 /// Construct an instance that can emit .debug_line_str (for use in a normal
62 /// v5 line table).
63 LLVM_ABI explicit MCDwarfLineStr(MCContext &Ctx);
64
65 StringSaver &getSaver() { return Saver; }
66
67 /// Emit a reference to the string.
68 LLVM_ABI void emitRef(MCStreamer *MCOS, StringRef Path);
69
70 /// Emit the .debug_line_str section if appropriate.
72
73 /// Returns finalized section.
75
76 /// Adds path \p Path to the line string. Returns offset in the
77 /// .debug_line_str section.
78 LLVM_ABI size_t addString(StringRef Path);
79};
80
81/// Instances of this class represent the name of the dwarf .file directive and
82/// its associated dwarf file number in the MC file. MCDwarfFile's are created
83/// and uniqued by the MCContext class. In Dwarf 4 file numbers start from 1;
84/// i.e. the entry with file number 1 is the first element in the vector of
85/// DwarfFiles and there is no MCDwarfFile with file number 0. In Dwarf 5 file
86/// numbers start from 0, with the MCDwarfFile with file number 0 being the
87/// primary source file, and file numbers correspond to their index in the
88/// vector.
90 // The base name of the file without its directory path.
91 std::string Name;
92
93 // The index into the list of directory names for this file name.
94 unsigned DirIndex = 0;
95
96 /// The MD5 checksum, if there is one. Non-owning pointer to data allocated
97 /// in MCContext.
98 std::optional<MD5::MD5Result> Checksum;
99
100 /// The source code of the file. Non-owning reference to data allocated in
101 /// MCContext.
102 std::optional<StringRef> Source;
103};
104
105/// Instances of this class represent the information from a
106/// dwarf .loc directive.
107class MCDwarfLoc {
108 uint32_t FileNum;
109 uint32_t Line;
110 uint16_t Column;
111 // Flags (see #define's below)
112 uint8_t Flags;
113 uint8_t Isa;
114 uint32_t Discriminator;
115
116// Flag that indicates the initial value of the is_stmt_start flag.
117#define DWARF2_LINE_DEFAULT_IS_STMT 1
118
119#define DWARF2_FLAG_IS_STMT (1 << 0)
120#define DWARF2_FLAG_BASIC_BLOCK (1 << 1)
121#define DWARF2_FLAG_PROLOGUE_END (1 << 2)
122#define DWARF2_FLAG_EPILOGUE_BEGIN (1 << 3)
123
124private: // MCContext manages these
125 friend class MCContext;
126 friend class MCDwarfLineEntry;
127
128 MCDwarfLoc(unsigned fileNum, unsigned line, unsigned column, unsigned flags,
129 unsigned isa, unsigned discriminator)
130 : FileNum(fileNum), Line(line), Column(column), Flags(flags), Isa(isa),
131 Discriminator(discriminator) {}
132
133 // Allow the default copy constructor and assignment operator to be used
134 // for an MCDwarfLoc object.
135
136public:
137 /// Get the FileNum of this MCDwarfLoc.
138 unsigned getFileNum() const { return FileNum; }
139
140 /// Get the Line of this MCDwarfLoc.
141 unsigned getLine() const { return Line; }
142
143 /// Get the Column of this MCDwarfLoc.
144 unsigned getColumn() const { return Column; }
145
146 /// Get the Flags of this MCDwarfLoc.
147 unsigned getFlags() const { return Flags; }
148
149 /// Get the Isa of this MCDwarfLoc.
150 unsigned getIsa() const { return Isa; }
151
152 /// Get the Discriminator of this MCDwarfLoc.
153 unsigned getDiscriminator() const { return Discriminator; }
154
155 /// Set the FileNum of this MCDwarfLoc.
156 void setFileNum(unsigned fileNum) { FileNum = fileNum; }
157
158 /// Set the Line of this MCDwarfLoc.
159 void setLine(unsigned line) { Line = line; }
160
161 /// Set the Column of this MCDwarfLoc.
162 void setColumn(unsigned column) {
163 assert(column <= UINT16_MAX);
164 Column = column;
165 }
166
167 /// Set the Flags of this MCDwarfLoc.
168 void setFlags(unsigned flags) {
169 assert(flags <= UINT8_MAX);
170 Flags = flags;
171 }
172
173 /// Set the Isa of this MCDwarfLoc.
174 void setIsa(unsigned isa) {
175 assert(isa <= UINT8_MAX);
176 Isa = isa;
177 }
178
179 /// Set the Discriminator of this MCDwarfLoc.
180 void setDiscriminator(unsigned discriminator) {
181 Discriminator = discriminator;
182 }
183};
184
185/// Instances of this class represent the line information for
186/// the dwarf line table entries. Which is created after a machine
187/// instruction is assembled and uses an address from a temporary label
188/// created at the current address in the current section and the info from
189/// the last .loc directive seen as stored in the context.
190class MCDwarfLineEntry : public MCDwarfLoc {
191 MCSymbol *Label;
192
193private:
194 // Allow the default copy constructor and assignment operator to be used
195 // for an MCDwarfLineEntry object.
196
197public:
198 // Constructor to create an MCDwarfLineEntry given a symbol and the dwarf loc.
199 MCDwarfLineEntry(MCSymbol *label, const MCDwarfLoc loc,
200 MCSymbol *lineStreamLabel = nullptr,
201 SMLoc streamLabelDefLoc = {})
202 : MCDwarfLoc(loc), Label(label), LineStreamLabel(lineStreamLabel),
203 StreamLabelDefLoc(streamLabelDefLoc) {}
204
205 MCSymbol *getLabel() const { return Label; }
206
207 // This is the label that is to be emitted into the line stream. If this is
208 // non-null and we need to emit a label, also make sure to restart the current
209 // line sequence.
211
212 // Location where LineStreamLabel was defined. If there is an error emitting
213 // LineStreamLabel, we can use the SMLoc to report an error.
215
216 // This indicates the line entry is synthesized for an end entry.
217 bool IsEndEntry = false;
218
219 // Override the label with the given EndLabel.
220 void setEndLabel(MCSymbol *EndLabel) {
221 // If we're setting this to be an end entry, make sure we don't have
222 // LineStreamLabel set.
223 assert(LineStreamLabel == nullptr);
224 Label = EndLabel;
225 IsEndEntry = true;
226 }
227
228 // This is called when an instruction is assembled into the specified
229 // section and if there is information from the last .loc directive that
230 // has yet to have a line entry made for it is made.
231 LLVM_ABI static void make(MCStreamer *MCOS, MCSection *Section);
232};
233
234/// Instances of this class represent the line information for a compile
235/// unit where machine instructions have been assembled after seeing .loc
236/// directives. This is the information used to build the dwarf line
237/// table for a section.
239public:
240 // Add an entry to this MCLineSection's line entries.
241 void addLineEntry(const MCDwarfLineEntry &LineEntry, MCSection *Sec) {
242 MCLineDivisions[Sec].push_back(LineEntry);
243 }
244
245 // Add an end entry by cloning the last entry, if exists, for the section
246 // the given EndLabel belongs to. The label is replaced by the given EndLabel.
247 LLVM_ABI void addEndEntry(MCSymbol *EndLabel);
248
249 using MCDwarfLineEntryCollection = std::vector<MCDwarfLineEntry>;
250 using iterator = MCDwarfLineEntryCollection::iterator;
251 using const_iterator = MCDwarfLineEntryCollection::const_iterator;
253
254private:
255 // A collection of MCDwarfLineEntry for each section.
256 MCLineDivisionMap MCLineDivisions;
257
258public:
259 // Returns the collection of MCDwarfLineEntry for a given Compile Unit ID.
261 return MCLineDivisions;
262 }
263};
264
266 /// First special line opcode - leave room for the standard opcodes.
267 /// Note: If you want to change this, you'll have to update the
268 /// "StandardOpcodeLengths" table that is emitted in
269 /// \c Emit().
271 /// Minimum line offset in a special line info. opcode. The value
272 /// -5 was chosen to give a reasonable range of values.
273 int8_t DWARF2LineBase = -5;
274 /// Range of line offsets in a special line info. opcode.
276};
277
279 MCSymbol *Label = nullptr;
283 std::string CompilationDir;
285 bool HasAnySource = false;
286
287private:
288 bool HasAllMD5 = true;
289 bool HasAnyMD5 = false;
290
291public:
293
295 StringRef &FileName,
296 std::optional<MD5::MD5Result> Checksum,
297 std::optional<StringRef> Source,
298 uint16_t DwarfVersion,
299 unsigned FileNumber = 0);
300 LLVM_ABI std::pair<MCSymbol *, MCSymbol *>
302 std::optional<MCDwarfLineStr> &LineStr) const;
303 LLVM_ABI std::pair<MCSymbol *, MCSymbol *>
305 ArrayRef<char> SpecialOpcodeLengths,
306 std::optional<MCDwarfLineStr> &LineStr) const;
308 HasAllMD5 = true;
309 HasAnyMD5 = false;
310 }
311 void trackMD5Usage(bool MD5Used) {
312 HasAllMD5 &= MD5Used;
313 HasAnyMD5 |= MD5Used;
314 }
315 bool isMD5UsageConsistent() const {
316 return MCDwarfFiles.empty() || (HasAllMD5 == HasAnyMD5);
317 }
318
319 void setRootFile(StringRef Directory, StringRef FileName,
320 std::optional<MD5::MD5Result> Checksum,
321 std::optional<StringRef> Source) {
322 CompilationDir = std::string(Directory);
323 RootFile.Name = std::string(FileName);
324 RootFile.DirIndex = 0;
325 RootFile.Checksum = Checksum;
326 RootFile.Source = Source;
327 trackMD5Usage(Checksum.has_value());
328 HasAnySource |= Source.has_value();
329 }
330
332 MCDwarfDirs.clear();
333 MCDwarfFiles.clear();
334 RootFile.Name.clear();
336 HasAnySource = false;
337 }
338
339private:
340 void emitV2FileDirTables(MCStreamer *MCOS) const;
341 void emitV5FileDirTables(MCStreamer *MCOS,
342 std::optional<MCDwarfLineStr> &LineStr) const;
343};
344
347 bool HasSplitLineTable = false;
348
349public:
350 void maybeSetRootFile(StringRef Directory, StringRef FileName,
351 std::optional<MD5::MD5Result> Checksum,
352 std::optional<StringRef> Source) {
353 if (!Header.RootFile.Name.empty())
354 return;
355 Header.setRootFile(Directory, FileName, Checksum, Source);
356 }
357
358 unsigned getFile(StringRef Directory, StringRef FileName,
359 std::optional<MD5::MD5Result> Checksum,
360 uint16_t DwarfVersion, std::optional<StringRef> Source) {
361 HasSplitLineTable = true;
362 return cantFail(Header.tryGetFile(Directory, FileName, Checksum, Source,
363 DwarfVersion));
364 }
365
367 MCSection *Section) const;
368};
369
372 MCLineSection MCLineSections;
373
374public:
375 // This emits the Dwarf file and the line tables for all Compile Units.
376 LLVM_ABI static void emit(MCStreamer *MCOS, MCDwarfLineTableParams Params);
377
378 // This emits the Dwarf file and the line tables for a given Compile Unit.
380 std::optional<MCDwarfLineStr> &LineStr) const;
381
382 // This emits a single line table associated with a given Section.
383 LLVM_ABI static void
384 emitOne(MCStreamer *MCOS, MCSection *Section,
386
388 SMLoc DefLoc,
389 StringRef Name);
390
392 StringRef &FileName,
393 std::optional<MD5::MD5Result> Checksum,
394 std::optional<StringRef> Source,
395 uint16_t DwarfVersion,
396 unsigned FileNumber = 0);
397 unsigned getFile(StringRef &Directory, StringRef &FileName,
398 std::optional<MD5::MD5Result> Checksum,
399 std::optional<StringRef> Source, uint16_t DwarfVersion,
400 unsigned FileNumber = 0) {
401 return cantFail(tryGetFile(Directory, FileName, Checksum, Source,
402 DwarfVersion, FileNumber));
403 }
404
405 void setRootFile(StringRef Directory, StringRef FileName,
406 std::optional<MD5::MD5Result> Checksum,
407 std::optional<StringRef> Source) {
408 Header.CompilationDir = std::string(Directory);
409 Header.RootFile.Name = std::string(FileName);
410 Header.RootFile.DirIndex = 0;
411 Header.RootFile.Checksum = Checksum;
412 Header.RootFile.Source = Source;
413 Header.trackMD5Usage(Checksum.has_value());
414 Header.HasAnySource |= Source.has_value();
415 }
416
417 void resetFileTable() { Header.resetFileTable(); }
418
419 bool hasRootFile() const { return !Header.RootFile.Name.empty(); }
420
421 MCDwarfFile &getRootFile() { return Header.RootFile; }
422 const MCDwarfFile &getRootFile() const { return Header.RootFile; }
423
424 // Report whether MD5 usage has been consistent (all-or-none).
425 bool isMD5UsageConsistent() const { return Header.isMD5UsageConsistent(); }
426
428 return Header.Label;
429 }
430
431 void setLabel(MCSymbol *Label) {
432 Header.Label = Label;
433 }
434
436 return Header.MCDwarfDirs;
437 }
438
440 return Header.MCDwarfDirs;
441 }
442
444 return Header.MCDwarfFiles;
445 }
446
448 return Header.MCDwarfFiles;
449 }
450
452 return MCLineSections;
453 }
455 return MCLineSections;
456 }
457};
458
460public:
461 /// Utility function to encode a Dwarf pair of LineDelta and AddrDeltas.
462 LLVM_ABI static void encode(MCContext &Context, MCDwarfLineTableParams Params,
463 int64_t LineDelta, uint64_t AddrDelta,
465
466 /// Utility function to emit the encoding to a streamer.
467 LLVM_ABI static void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
468 int64_t LineDelta, uint64_t AddrDelta);
469};
470
472public:
473 //
474 // When generating dwarf for assembly source files this emits the Dwarf
475 // sections.
476 //
477 LLVM_ABI static void Emit(MCStreamer *MCOS);
478};
479
480// When generating dwarf for assembly source files this is the info that is
481// needed to be gathered for each symbol that will have a dwarf label.
483private:
484 // Name of the symbol without a leading underbar, if any.
485 StringRef Name;
486 // The dwarf file number this symbol is in.
487 unsigned FileNumber;
488 // The line number this symbol is at.
489 unsigned LineNumber;
490 // The low_pc for the dwarf label is taken from this symbol.
491 MCSymbol *Label;
492
493public:
494 MCGenDwarfLabelEntry(StringRef name, unsigned fileNumber, unsigned lineNumber,
495 MCSymbol *label)
496 : Name(name), FileNumber(fileNumber), LineNumber(lineNumber),
497 Label(label) {}
498
499 StringRef getName() const { return Name; }
500 unsigned getFileNumber() const { return FileNumber; }
501 unsigned getLineNumber() const { return LineNumber; }
502 MCSymbol *getLabel() const { return Label; }
503
504 // This is called when label is created when we are generating dwarf for
505 // assembly source files.
506 LLVM_ABI static void Make(MCSymbol *Symbol, MCStreamer *MCOS,
508};
509
510class MCCFIInstruction {
511public:
538
539 // Held in ExtraFields for most common OpTypes, exceptions follow.
541 unsigned Register;
542 int64_t Offset;
543 unsigned Register2;
544 unsigned AddressSpace;
545 // FIXME: Workaround for GCC7 bug with nested class used as std::variant
546 // alternative where the compiler really wants a user-defined default
547 // constructor. Once we no longer support GCC7 these constructors can be
548 // replaced with default member initializers and aggregate initialization.
549 CommonFields(unsigned Reg, int64_t Off = 0,
550 unsigned Reg2 = std::numeric_limits<unsigned>::max(),
551 unsigned AddrSpace = 0)
552 : Register(Reg), Offset(Off), Register2(Reg2), AddressSpace(AddrSpace) {
553 }
554 CommonFields() : CommonFields(std::numeric_limits<unsigned>::max()) {}
555 };
556 // Held in ExtraFields when OpEscape.
558 std::vector<char> Values;
559 std::string Comment;
560 };
561 // Held in ExtraFields when OpLabel.
562 struct LabelFields {
563 MCSymbol *CfiLabel = nullptr;
564 };
565 /// Held in ExtraFields when OpLLVMRegisterPair.
567 unsigned Register;
568 unsigned Reg1, Reg2;
570 };
572 unsigned Register;
573 unsigned Lane;
574 unsigned SizeInBits;
575 };
576 /// Held in ExtraFields when OpLLVMVectorRegisters.
578 unsigned Register;
579 std::vector<VectorRegisterWithLane> VectorRegisters;
580 };
581 /// Held in ExtraFields when OpLLVMVectorOffset.
583 unsigned Register;
585 int64_t Offset;
586 unsigned MaskRegister;
588 };
589 /// Held in ExtraFields when OpLLVMVectorRegisterMask.
597
598private:
599 MCSymbol *Label;
603 ExtraFields;
604 OpType Operation;
605 SMLoc Loc;
606
607 template <class FieldsType>
608 MCCFIInstruction(OpType Op, MCSymbol *L, FieldsType &&EF, SMLoc Loc)
609 : Label(L), ExtraFields(std::forward<FieldsType>(EF)), Operation(Op),
610 Loc(Loc) {}
611
612public:
613 /// .cfi_def_cfa defines a rule for computing CFA as: take address from
614 /// Register and add Offset to it.
615 static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register,
616 int64_t Offset, SMLoc Loc = {}) {
617 return {OpDefCfa, L, CommonFields{Register, Offset}, Loc};
618 }
619
620 /// .cfi_def_cfa_register modifies a rule for computing CFA. From now
621 /// on Register will be used instead of the old one. Offset remains the same.
622 static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register,
623 SMLoc Loc = {}) {
624 return {OpDefCfaRegister, L, CommonFields{Register}, Loc};
625 }
626
627 /// .cfi_def_cfa_offset modifies a rule for computing CFA. Register
628 /// remains the same, but offset is new. Note that it is the absolute offset
629 /// that will be added to a defined register to the compute CFA address.
630 static MCCFIInstruction cfiDefCfaOffset(MCSymbol *L, int64_t Offset,
631 SMLoc Loc = {}) {
632 return {OpDefCfaOffset, L, CommonFields{0, Offset}, Loc};
633 }
634
635 /// .cfi_adjust_cfa_offset Same as .cfi_def_cfa_offset, but
636 /// Offset is a relative value that is added/subtracted from the previous
637 /// offset.
638 static MCCFIInstruction createAdjustCfaOffset(MCSymbol *L, int64_t Adjustment,
639 SMLoc Loc = {}) {
640 return {OpAdjustCfaOffset, L, CommonFields{0, Adjustment}, Loc};
641 }
642
643 // FIXME: Update the remaining docs to use the new proposal wording.
644 /// .cfi_llvm_def_aspace_cfa defines the rule for computing the CFA to
645 /// be the result of evaluating the DWARF operation expression
646 /// `DW_OP_constu AS; DW_OP_aspace_bregx R, B` as a location description.
647 static MCCFIInstruction createLLVMDefAspaceCfa(MCSymbol *L, unsigned Register,
648 int64_t Offset,
649 unsigned AddressSpace,
650 SMLoc Loc) {
651 return {OpLLVMDefAspaceCfa, L,
653 }
654
655 /// .cfi_offset Previous value of Register is saved at offset Offset
656 /// from CFA.
657 static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register,
658 int64_t Offset, SMLoc Loc = {}) {
659 return {OpOffset, L, CommonFields{Register, Offset}, Loc};
660 }
661
662 /// .cfi_rel_offset Previous value of Register is saved at offset
663 /// Offset from the current CFA register. This is transformed to .cfi_offset
664 /// using the known displacement of the CFA register from the CFA.
665 static MCCFIInstruction createRelOffset(MCSymbol *L, unsigned Register,
666 int64_t Offset, SMLoc Loc = {}) {
667 return {OpRelOffset, L, CommonFields{Register, Offset}, Loc};
668 }
669
670 /// .cfi_register Previous value of Register1 is saved in
671 /// register Register2.
672 static MCCFIInstruction createRegister(MCSymbol *L, unsigned Register1,
673 unsigned Register2, SMLoc Loc = {}) {
674 return {OpRegister, L, CommonFields{Register1, 0, Register2}, Loc};
675 }
676
677 /// .cfi_window_save SPARC register window is saved.
678 static MCCFIInstruction createWindowSave(MCSymbol *L, SMLoc Loc = {}) {
679 return {OpWindowSave, L, CommonFields{}, Loc};
680 }
681
682 /// .cfi_negate_ra_state AArch64 negate RA state.
683 static MCCFIInstruction createNegateRAState(MCSymbol *L, SMLoc Loc = {}) {
684 return {OpNegateRAState, L, CommonFields{}, Loc};
685 }
686
687 /// .cfi_negate_ra_state_with_pc AArch64 negate RA state with PC.
688 static MCCFIInstruction createNegateRAStateWithPC(MCSymbol *L,
689 SMLoc Loc = {}) {
690 return {OpNegateRAStateWithPC, L, CommonFields{}, Loc};
691 }
692
693 /// .cfi_restore says that the rule for Register is now the same as it
694 /// was at the beginning of the function, after all initial instructions added
695 /// by .cfi_startproc were executed.
696 static MCCFIInstruction createRestore(MCSymbol *L, unsigned Register,
697 SMLoc Loc = {}) {
698 return {OpRestore, L, CommonFields{Register}, Loc};
699 }
700
701 /// .cfi_undefined From now on the previous value of Register can't be
702 /// restored anymore.
703 static MCCFIInstruction createUndefined(MCSymbol *L, unsigned Register,
704 SMLoc Loc = {}) {
705 return {OpUndefined, L, CommonFields{Register}, Loc};
706 }
707
708 /// .cfi_same_value Current value of Register is the same as in the
709 /// previous frame. I.e., no restoration is needed.
710 static MCCFIInstruction createSameValue(MCSymbol *L, unsigned Register,
711 SMLoc Loc = {}) {
712 return {OpSameValue, L, CommonFields{Register}, Loc};
713 }
714
715 /// .cfi_remember_state Save all current rules for all registers.
716 static MCCFIInstruction createRememberState(MCSymbol *L, SMLoc Loc = {}) {
717 return {OpRememberState, L, CommonFields{}, Loc};
718 }
719
720 /// .cfi_restore_state Restore the previously saved state.
721 static MCCFIInstruction createRestoreState(MCSymbol *L, SMLoc Loc = {}) {
722 return {OpRestoreState, L, CommonFields{}, Loc};
723 }
724
725 /// .cfi_escape Allows the user to add arbitrary bytes to the unwind
726 /// info.
727 static MCCFIInstruction createEscape(MCSymbol *L, StringRef Vals,
728 SMLoc Loc = {}, StringRef Comment = "") {
729 return {OpEscape, L,
730 EscapeFields{std::vector<char>(Vals.begin(), Vals.end()),
731 Comment.str()},
732 Loc};
733 }
734
735 /// A special wrapper for .cfi_escape that indicates GNU_ARGS_SIZE
736 static MCCFIInstruction createGnuArgsSize(MCSymbol *L, int64_t Size,
737 SMLoc Loc = {}) {
738 return {OpGnuArgsSize, L, CommonFields{0, Size}, Loc};
739 }
740
741 static MCCFIInstruction createLabel(MCSymbol *L, MCSymbol *CfiLabel,
742 SMLoc Loc) {
743 return {OpLabel, L, LabelFields{CfiLabel}, Loc};
744 }
745
746 /// .cfi_llvm_register_pair Previous value of Register is saved in R1:R2.
747 static MCCFIInstruction
748 createLLVMRegisterPair(MCSymbol *L, unsigned Register, unsigned R1,
749 unsigned R1SizeInBits, unsigned R2,
750 unsigned R2SizeInBits, SMLoc Loc = {}) {
751 RegisterPairFields Extra{Register, R1, R2, R1SizeInBits, R2SizeInBits};
752 return {OpLLVMRegisterPair, L, Extra, Loc};
753 }
754
755 /// .cfi_llvm_vector_registers Previous value of Register is saved in lanes of
756 /// vector registers.
757 static MCCFIInstruction
759 ArrayRef<VectorRegisterWithLane> VectorRegisters,
760 SMLoc Loc = {}) {
761 VectorRegistersFields Extra{Register, VectorRegisters};
762 return {OpLLVMVectorRegisters, L, std::move(Extra), Loc};
763 }
764
765 /// .cfi_llvm_vector_offset Previous value of Register is saved at Offset from
766 /// CFA. MaskRegister specifies the active lanes of register.
767 static MCCFIInstruction
769 unsigned RegisterSizeInBits, unsigned MaskRegister,
770 unsigned MaskRegisterSizeInBits, int64_t Offset,
771 SMLoc Loc = {}) {
772 VectorOffsetFields Extra{Register, RegisterSizeInBits, Offset, MaskRegister,
773 MaskRegisterSizeInBits};
774 return MCCFIInstruction(OpLLVMVectorOffset, L, Extra, Loc);
775 }
776
777 /// .cfi_llvm_vector_register_mask Previous value of Register is saved in
778 /// SpillRegister, predicated on the value of MaskRegister.
779 static MCCFIInstruction createLLVMVectorRegisterMask(
780 MCSymbol *L, unsigned Register, unsigned SpillRegister,
781 unsigned SpillRegisterLaneSizeInBits, unsigned MaskRegister,
782 unsigned MaskRegisterSizeInBits, SMLoc Loc = {}) {
783 VectorRegisterMaskFields Extra{
784 Register, SpillRegister, SpillRegisterLaneSizeInBits,
785 MaskRegister, MaskRegisterSizeInBits,
786 };
787 return MCCFIInstruction(OpLLVMVectorRegisterMask, L, Extra, Loc);
788 }
789
790 template <class ExtraFieldsTy> ExtraFieldsTy &getExtraFields() {
791 return std::get<ExtraFieldsTy>(ExtraFields);
792 }
793
794 template <class ExtraFieldsTy> const ExtraFieldsTy &getExtraFields() const {
795 return std::get<ExtraFieldsTy>(ExtraFields);
796 }
797 /// .cfi_val_offset Previous value of Register is offset Offset from the
798 /// current CFA register.
799 static MCCFIInstruction createValOffset(MCSymbol *L, unsigned Register,
800 int64_t Offset, SMLoc Loc = {}) {
801 return {OpValOffset, L, CommonFields{Register, Offset}, Loc};
802 }
803
804 OpType getOperation() const { return Operation; }
805 MCSymbol *getLabel() const { return Label; }
806
807 unsigned getRegister() const {
808 assert(Operation == OpDefCfa || Operation == OpOffset ||
809 Operation == OpRestore || Operation == OpUndefined ||
810 Operation == OpSameValue || Operation == OpDefCfaRegister ||
811 Operation == OpRelOffset || Operation == OpValOffset ||
812 Operation == OpRegister || Operation == OpLLVMDefAspaceCfa);
813 return std::get<CommonFields>(ExtraFields).Register;
814 }
815
816 unsigned getRegister2() const {
817 assert(Operation == OpRegister);
818 return std::get<CommonFields>(ExtraFields).Register2;
819 }
820
821 unsigned getAddressSpace() const {
822 assert(Operation == OpLLVMDefAspaceCfa);
823 return std::get<CommonFields>(ExtraFields).AddressSpace;
824 }
825
826 int64_t getOffset() const {
827 assert(Operation == OpDefCfa || Operation == OpOffset ||
828 Operation == OpRelOffset || Operation == OpDefCfaOffset ||
829 Operation == OpAdjustCfaOffset || Operation == OpGnuArgsSize ||
830 Operation == OpValOffset || Operation == OpLLVMDefAspaceCfa);
831 return std::get<CommonFields>(ExtraFields).Offset;
832 }
833
835 assert(Operation == OpLabel);
836 return std::get<LabelFields>(ExtraFields).CfiLabel;
837 }
838
840 assert(Operation == OpEscape);
841 auto &Values = std::get<EscapeFields>(ExtraFields).Values;
842 return StringRef(&Values[0], Values.size());
843 }
844
846 assert(Operation == OpEscape);
847 return std::get<EscapeFields>(ExtraFields).Comment;
848 }
849 SMLoc getLoc() const { return Loc; }
850};
851
853 MCDwarfFrameInfo() = default;
854
855 MCSymbol *Begin = nullptr;
856 MCSymbol *End = nullptr;
857 const MCSymbol *Personality = nullptr;
858 const MCSymbol *Lsda = nullptr;
859 std::vector<MCCFIInstruction> Instructions;
860 unsigned CurrentCfaRegister = 0;
862 unsigned LsdaEncoding = 0;
864 bool IsSignalFrame = false;
865 bool IsSimple = false;
866 unsigned RAReg = static_cast<unsigned>(INT_MAX);
867 bool IsBKeyFrame = false;
868 bool IsMTETaggedFrame = false;
869};
870
871// Emit DWARF call frame information and, when available, compact unwind
872// information.
874public:
875 LLVM_ABI static void emit(MCObjectStreamer &streamer, bool isEH);
876 LLVM_ABI static void encodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta,
878};
879
880} // end namespace llvm
881
882#endif // LLVM_MC_MCDWARF_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
#define LLVM_ABI
Definition Compiler.h:213
Register Reg
This file implements a map that provides insertion order iteration.
#define R2(n)
static const char * name
This file defines the SmallVector class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
Tagged union holding either a T or a Error.
Definition Error.h:485
Generic interface to target specific assembler backends.
static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register, SMLoc Loc={})
.cfi_def_cfa_register modifies a rule for computing CFA.
Definition MCDwarf.h:622
MCSymbol * getLabel() const
Definition MCDwarf.h:805
static MCCFIInstruction createLLVMVectorOffset(MCSymbol *L, unsigned Register, unsigned RegisterSizeInBits, unsigned MaskRegister, unsigned MaskRegisterSizeInBits, int64_t Offset, SMLoc Loc={})
.cfi_llvm_vector_offset Previous value of Register is saved at Offset from CFA.
Definition MCDwarf.h:768
static MCCFIInstruction createUndefined(MCSymbol *L, unsigned Register, SMLoc Loc={})
.cfi_undefined From now on the previous value of Register can't be restored anymore.
Definition MCDwarf.h:703
static MCCFIInstruction createGnuArgsSize(MCSymbol *L, int64_t Size, SMLoc Loc={})
A special wrapper for .cfi_escape that indicates GNU_ARGS_SIZE.
Definition MCDwarf.h:736
unsigned getAddressSpace() const
Definition MCDwarf.h:821
static MCCFIInstruction createLLVMVectorRegisters(MCSymbol *L, unsigned Register, ArrayRef< VectorRegisterWithLane > VectorRegisters, SMLoc Loc={})
.cfi_llvm_vector_registers Previous value of Register is saved in lanes of vector registers.
Definition MCDwarf.h:758
static MCCFIInstruction createRestore(MCSymbol *L, unsigned Register, SMLoc Loc={})
.cfi_restore says that the rule for Register is now the same as it was at the beginning of the functi...
Definition MCDwarf.h:696
const ExtraFieldsTy & getExtraFields() const
Definition MCDwarf.h:794
unsigned getRegister2() const
Definition MCDwarf.h:816
static MCCFIInstruction createLLVMDefAspaceCfa(MCSymbol *L, unsigned Register, int64_t Offset, unsigned AddressSpace, SMLoc Loc)
.cfi_llvm_def_aspace_cfa defines the rule for computing the CFA to be the result of evaluating the DW...
Definition MCDwarf.h:647
unsigned getRegister() const
Definition MCDwarf.h:807
static MCCFIInstruction createLLVMVectorRegisterMask(MCSymbol *L, unsigned Register, unsigned SpillRegister, unsigned SpillRegisterLaneSizeInBits, unsigned MaskRegister, unsigned MaskRegisterSizeInBits, SMLoc Loc={})
.cfi_llvm_vector_register_mask Previous value of Register is saved in SpillRegister,...
Definition MCDwarf.h:779
static MCCFIInstruction createRegister(MCSymbol *L, unsigned Register1, unsigned Register2, SMLoc Loc={})
.cfi_register Previous value of Register1 is saved in register Register2.
Definition MCDwarf.h:672
static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register, int64_t Offset, SMLoc Loc={})
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it.
Definition MCDwarf.h:615
static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register, int64_t Offset, SMLoc Loc={})
.cfi_offset Previous value of Register is saved at offset Offset from CFA.
Definition MCDwarf.h:657
SMLoc getLoc() const
Definition MCDwarf.h:849
static MCCFIInstruction createValOffset(MCSymbol *L, unsigned Register, int64_t Offset, SMLoc Loc={})
.cfi_val_offset Previous value of Register is offset Offset from the current CFA register.
Definition MCDwarf.h:799
static MCCFIInstruction createNegateRAStateWithPC(MCSymbol *L, SMLoc Loc={})
.cfi_negate_ra_state_with_pc AArch64 negate RA state with PC.
Definition MCDwarf.h:688
static MCCFIInstruction createNegateRAState(MCSymbol *L, SMLoc Loc={})
.cfi_negate_ra_state AArch64 negate RA state.
Definition MCDwarf.h:683
static MCCFIInstruction createRememberState(MCSymbol *L, SMLoc Loc={})
.cfi_remember_state Save all current rules for all registers.
Definition MCDwarf.h:716
OpType getOperation() const
Definition MCDwarf.h:804
static MCCFIInstruction createLLVMRegisterPair(MCSymbol *L, unsigned Register, unsigned R1, unsigned R1SizeInBits, unsigned R2, unsigned R2SizeInBits, SMLoc Loc={})
.cfi_llvm_register_pair Previous value of Register is saved in R1:R2.
Definition MCDwarf.h:748
StringRef getComment() const
Definition MCDwarf.h:845
StringRef getValues() const
Definition MCDwarf.h:839
static MCCFIInstruction cfiDefCfaOffset(MCSymbol *L, int64_t Offset, SMLoc Loc={})
.cfi_def_cfa_offset modifies a rule for computing CFA.
Definition MCDwarf.h:630
static MCCFIInstruction createEscape(MCSymbol *L, StringRef Vals, SMLoc Loc={}, StringRef Comment="")
.cfi_escape Allows the user to add arbitrary bytes to the unwind info.
Definition MCDwarf.h:727
static MCCFIInstruction createWindowSave(MCSymbol *L, SMLoc Loc={})
.cfi_window_save SPARC register window is saved.
Definition MCDwarf.h:678
static MCCFIInstruction createAdjustCfaOffset(MCSymbol *L, int64_t Adjustment, SMLoc Loc={})
.cfi_adjust_cfa_offset Same as .cfi_def_cfa_offset, but Offset is a relative value that is added/subt...
Definition MCDwarf.h:638
MCSymbol * getCfiLabel() const
Definition MCDwarf.h:834
static MCCFIInstruction createRestoreState(MCSymbol *L, SMLoc Loc={})
.cfi_restore_state Restore the previously saved state.
Definition MCDwarf.h:721
static MCCFIInstruction createSameValue(MCSymbol *L, unsigned Register, SMLoc Loc={})
.cfi_same_value Current value of Register is the same as in the previous frame.
Definition MCDwarf.h:710
static MCCFIInstruction createRelOffset(MCSymbol *L, unsigned Register, int64_t Offset, SMLoc Loc={})
.cfi_rel_offset Previous value of Register is saved at offset Offset from the current CFA register.
Definition MCDwarf.h:665
ExtraFieldsTy & getExtraFields()
Definition MCDwarf.h:790
int64_t getOffset() const
Definition MCDwarf.h:826
static MCCFIInstruction createLabel(MCSymbol *L, MCSymbol *CfiLabel, SMLoc Loc)
Definition MCDwarf.h:741
Context object for machine code objects.
Definition MCContext.h:83
void maybeSetRootFile(StringRef Directory, StringRef FileName, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source)
Definition MCDwarf.h:350
unsigned getFile(StringRef Directory, StringRef FileName, std::optional< MD5::MD5Result > Checksum, uint16_t DwarfVersion, std::optional< StringRef > Source)
Definition MCDwarf.h:358
LLVM_ABI void Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params, MCSection *Section) const
Definition MCDwarf.cpp:335
static LLVM_ABI void emit(MCObjectStreamer &streamer, bool isEH)
Definition MCDwarf.cpp:2110
static LLVM_ABI void encodeAdvanceLoc(MCContext &Context, uint64_t AddrDelta, SmallVectorImpl< char > &OS)
Definition MCDwarf.cpp:2185
static LLVM_ABI void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params, int64_t LineDelta, uint64_t AddrDelta)
Utility function to emit the encoding to a streamer.
Definition MCDwarf.cpp:730
static LLVM_ABI void encode(MCContext &Context, MCDwarfLineTableParams Params, int64_t LineDelta, uint64_t AddrDelta, SmallVectorImpl< char > &OS)
Utility function to encode a Dwarf pair of LineDelta and AddrDeltas.
Definition MCDwarf.cpp:745
Instances of this class represent the line information for the dwarf line table entries.
Definition MCDwarf.h:190
void setEndLabel(MCSymbol *EndLabel)
Definition MCDwarf.h:220
MCSymbol * getLabel() const
Definition MCDwarf.h:205
MCDwarfLineEntry(MCSymbol *label, const MCDwarfLoc loc, MCSymbol *lineStreamLabel=nullptr, SMLoc streamLabelDefLoc={})
Definition MCDwarf.h:199
MCSymbol * LineStreamLabel
Definition MCDwarf.h:210
static LLVM_ABI void make(MCStreamer *MCOS, MCSection *Section)
Definition MCDwarf.cpp:91
StringSaver & getSaver()
Definition MCDwarf.h:65
LLVM_ABI void emitSection(MCStreamer *MCOS)
Emit the .debug_line_str section if appropriate.
Definition MCDwarf.cpp:385
LLVM_ABI MCDwarfLineStr(MCContext &Ctx)
Construct an instance that can emit .debug_line_str (for use in a normal v5 line table).
Definition MCDwarf.cpp:76
LLVM_ABI SmallString< 0 > getFinalizedData()
Returns finalized section.
Definition MCDwarf.cpp:393
LLVM_ABI void emitRef(MCStreamer *MCOS, StringRef Path)
Emit a reference to the string.
Definition MCDwarf.cpp:407
LLVM_ABI size_t addString(StringRef Path)
Adds path Path to the line string.
Definition MCDwarf.cpp:403
bool isMD5UsageConsistent() const
Definition MCDwarf.h:425
const MCDwarfFile & getRootFile() const
Definition MCDwarf.h:422
void setLabel(MCSymbol *Label)
Definition MCDwarf.h:431
const SmallVectorImpl< std::string > & getMCDwarfDirs() const
Definition MCDwarf.h:435
LLVM_ABI void endCurrentSeqAndEmitLineStreamLabel(MCStreamer *MCOS, SMLoc DefLoc, StringRef Name)
Definition MCDwarf.cpp:289
void setRootFile(StringRef Directory, StringRef FileName, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source)
Definition MCDwarf.h:405
MCDwarfFile & getRootFile()
Definition MCDwarf.h:421
const MCLineSection & getMCLineSections() const
Definition MCDwarf.h:451
static LLVM_ABI void emit(MCStreamer *MCOS, MCDwarfLineTableParams Params)
Definition MCDwarf.cpp:308
bool hasRootFile() const
Definition MCDwarf.h:419
unsigned getFile(StringRef &Directory, StringRef &FileName, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source, uint16_t DwarfVersion, unsigned FileNumber=0)
Definition MCDwarf.h:397
SmallVectorImpl< std::string > & getMCDwarfDirs()
Definition MCDwarf.h:439
SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles()
Definition MCDwarf.h:447
MCLineSection & getMCLineSections()
Definition MCDwarf.h:454
MCSymbol * getLabel() const
Definition MCDwarf.h:427
static LLVM_ABI void emitOne(MCStreamer *MCOS, MCSection *Section, const MCLineSection::MCDwarfLineEntryCollection &LineEntries)
Definition MCDwarf.cpp:178
LLVM_ABI Expected< unsigned > tryGetFile(StringRef &Directory, StringRef &FileName, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source, uint16_t DwarfVersion, unsigned FileNumber=0)
Definition MCDwarf.cpp:631
LLVM_ABI void emitCU(MCStreamer *MCOS, MCDwarfLineTableParams Params, std::optional< MCDwarfLineStr > &LineStr) const
Definition MCDwarf.cpp:617
const SmallVectorImpl< MCDwarfFile > & getMCDwarfFiles() const
Definition MCDwarf.h:443
Instances of this class represent the information from a dwarf .loc directive.
Definition MCDwarf.h:107
friend class MCDwarfLineEntry
Definition MCDwarf.h:126
unsigned getLine() const
Get the Line of this MCDwarfLoc.
Definition MCDwarf.h:141
void setLine(unsigned line)
Set the Line of this MCDwarfLoc.
Definition MCDwarf.h:159
unsigned getIsa() const
Get the Isa of this MCDwarfLoc.
Definition MCDwarf.h:150
void setIsa(unsigned isa)
Set the Isa of this MCDwarfLoc.
Definition MCDwarf.h:174
void setDiscriminator(unsigned discriminator)
Set the Discriminator of this MCDwarfLoc.
Definition MCDwarf.h:180
unsigned getFlags() const
Get the Flags of this MCDwarfLoc.
Definition MCDwarf.h:147
unsigned getColumn() const
Get the Column of this MCDwarfLoc.
Definition MCDwarf.h:144
friend class MCContext
Definition MCDwarf.h:125
void setFlags(unsigned flags)
Set the Flags of this MCDwarfLoc.
Definition MCDwarf.h:168
unsigned getDiscriminator() const
Get the Discriminator of this MCDwarfLoc.
Definition MCDwarf.h:153
void setColumn(unsigned column)
Set the Column of this MCDwarfLoc.
Definition MCDwarf.h:162
unsigned getFileNum() const
Get the FileNum of this MCDwarfLoc.
Definition MCDwarf.h:138
void setFileNum(unsigned fileNum)
Set the FileNum of this MCDwarfLoc.
Definition MCDwarf.h:156
static LLVM_ABI void Emit(MCStreamer *MCOS)
Definition MCDwarf.cpp:1205
MCGenDwarfLabelEntry(StringRef name, unsigned fileNumber, unsigned lineNumber, MCSymbol *label)
Definition MCDwarf.h:494
StringRef getName() const
Definition MCDwarf.h:499
static LLVM_ABI void Make(MCSymbol *Symbol, MCStreamer *MCOS, SourceMgr &SrcMgr, SMLoc &Loc)
Definition MCDwarf.cpp:1268
MCSymbol * getLabel() const
Definition MCDwarf.h:502
unsigned getLineNumber() const
Definition MCDwarf.h:501
unsigned getFileNumber() const
Definition MCDwarf.h:500
Instances of this class represent the line information for a compile unit where machine instructions ...
Definition MCDwarf.h:238
const MCLineDivisionMap & getMCLineEntries() const
Definition MCDwarf.h:260
LLVM_ABI void addEndEntry(MCSymbol *EndLabel)
Definition MCDwarf.cpp:142
MapVector< MCSection *, MCDwarfLineEntryCollection > MCLineDivisionMap
Definition MCDwarf.h:252
MCDwarfLineEntryCollection::const_iterator const_iterator
Definition MCDwarf.h:251
MCDwarfLineEntryCollection::iterator iterator
Definition MCDwarf.h:250
void addLineEntry(const MCDwarfLineEntry &LineEntry, MCSection *Sec)
Definition MCDwarf.h:241
std::vector< MCDwarfLineEntry > MCDwarfLineEntryCollection
Definition MCDwarf.h:249
Streaming object file generation interface.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h:573
Streaming machine code generation interface.
Definition MCStreamer.h:222
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
This class implements a map that also provides access to all stored values in a deterministic order.
Definition MapVector.h:38
Wrapper class representing virtual and physical registers.
Definition Register.h:20
Represents a location in source code.
Definition SMLoc.h:22
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition SmallString.h:26
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.
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.
Definition SourceMgr.h:37
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition StringMap.h:133
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
iterator begin() const
Definition StringRef.h:114
iterator end() const
Definition StringRef.h:116
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
Definition StringSaver.h:22
Utility for building string tables with deduplicated suffixes.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
LLVM_ABI MCSymbol * emitListsTableHeaderStart(MCStreamer &S)
Definition MCDwarf.cpp:44
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:557
SourceMgr SrcMgr
Definition Error.cpp:24
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
Definition Error.h:769
constexpr NextUseDistance max(NextUseDistance A, NextUseDistance B)
DWARFExpression::Operation Op
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:874
CommonFields(unsigned Reg, int64_t Off=0, unsigned Reg2=std::numeric_limits< unsigned >::max(), unsigned AddrSpace=0)
Definition MCDwarf.h:549
Held in ExtraFields when OpLLVMRegisterPair.
Definition MCDwarf.h:566
Held in ExtraFields when OpLLVMVectorOffset.
Definition MCDwarf.h:582
Held in ExtraFields when OpLLVMVectorRegisterMask.
Definition MCDwarf.h:590
Held in ExtraFields when OpLLVMVectorRegisters.
Definition MCDwarf.h:577
std::vector< VectorRegisterWithLane > VectorRegisters
Definition MCDwarf.h:579
Instances of this class represent the name of the dwarf .file directive and its associated dwarf file...
Definition MCDwarf.h:89
std::optional< MD5::MD5Result > Checksum
The MD5 checksum, if there is one.
Definition MCDwarf.h:98
std::string Name
Definition MCDwarf.h:91
std::optional< StringRef > Source
The source code of the file.
Definition MCDwarf.h:102
unsigned DirIndex
Definition MCDwarf.h:94
const MCSymbol * Personality
Definition MCDwarf.h:857
unsigned PersonalityEncoding
Definition MCDwarf.h:861
uint64_t CompactUnwindEncoding
Definition MCDwarf.h:863
std::vector< MCCFIInstruction > Instructions
Definition MCDwarf.h:859
const MCSymbol * Lsda
Definition MCDwarf.h:858
unsigned CurrentCfaRegister
Definition MCDwarf.h:860
void trackMD5Usage(bool MD5Used)
Definition MCDwarf.h:311
SmallVector< MCDwarfFile, 3 > MCDwarfFiles
Definition MCDwarf.h:281
bool isMD5UsageConsistent() const
Definition MCDwarf.h:315
SmallVector< std::string, 3 > MCDwarfDirs
Definition MCDwarf.h:280
LLVM_ABI std::pair< MCSymbol *, MCSymbol * > Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params, std::optional< MCDwarfLineStr > &LineStr) const
Definition MCDwarf.cpp:345
StringMap< unsigned > SourceIdMap
Definition MCDwarf.h:282
void setRootFile(StringRef Directory, StringRef FileName, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source)
Definition MCDwarf.h:319
LLVM_ABI Expected< unsigned > tryGetFile(StringRef &Directory, StringRef &FileName, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source, uint16_t DwarfVersion, unsigned FileNumber=0)
Definition MCDwarf.cpp:648
uint8_t DWARF2LineOpcodeBase
First special line opcode - leave room for the standard opcodes.
Definition MCDwarf.h:270
uint8_t DWARF2LineRange
Range of line offsets in a special line info. opcode.
Definition MCDwarf.h:275
int8_t DWARF2LineBase
Minimum line offset in a special line info.
Definition MCDwarf.h:273