LLVM 24.0.0git
MCStreamer.cpp
Go to the documentation of this file.
1//===- lib/MC/MCStreamer.cpp - Streaming Machine Code Output --------------===//
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
11#include "llvm/ADT/StringRef.h"
12#include "llvm/ADT/Twine.h"
16#include "llvm/MC/MCAsmInfo.h"
17#include "llvm/MC/MCCodeView.h"
18#include "llvm/MC/MCContext.h"
19#include "llvm/MC/MCDwarf.h"
20#include "llvm/MC/MCExpr.h"
21#include "llvm/MC/MCInst.h"
26#include "llvm/MC/MCRegister.h"
28#include "llvm/MC/MCSection.h"
30#include "llvm/MC/MCSymbol.h"
31#include "llvm/MC/MCWin64EH.h"
32#include "llvm/MC/MCWinEH.h"
35#include "llvm/Support/LEB128.h"
38#include <cassert>
39#include <cstdint>
40#include <cstdlib>
41#include <optional>
42#include <utility>
43
44using namespace llvm;
45
49
50// Pin the vtables to this file.
52
54
56
58
60 uint32_t Subsection, raw_ostream &OS) {
61 auto &MAI = Streamer.getContext().getAsmInfo();
62 MAI.printSwitchToSection(*Sec, Subsection,
63 Streamer.getContext().getTargetTriple(), OS);
64}
65
69
72 raw_svector_ostream OS(Str);
73
74 Streamer.getContext().getAsmInfo().printExpr(OS, *Value);
75 Streamer.emitRawText(OS.str());
76}
77
79 const MCAsmInfo &MAI = Streamer.getContext().getAsmInfo();
80 const char *Directive = MAI.getData8bitsDirective();
81 for (const unsigned char C : Data.bytes()) {
83 raw_svector_ostream OS(Str);
84
85 OS << Directive << (unsigned)C;
86 Streamer.emitRawText(OS.str());
87 }
88}
89
91
93 : Context(Ctx), CurrentWinFrameInfo(nullptr),
94 CurrentProcWinFrameInfoStartIndex(0) {
95 SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
96}
97
98MCStreamer::~MCStreamer() = default;
99
100void MCStreamer::setLFIRewriter(std::unique_ptr<MCLFIRewriter> Rewriter) {
101 LFIRewriter = std::move(Rewriter);
102}
103
105 DwarfFrameInfos.clear();
106 CurrentWinFrameInfo = nullptr;
107 WinFrameInfos.clear();
108 SectionStack.clear();
109 SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
110 CurFrag = nullptr;
111}
112
114 // By default, discard comments.
115 return nulls();
116}
117
122
123void MCStreamer::emitRawComment(const Twine &T, bool TabPrefix) {}
124
127
128/// EmitIntValue - Special case of EmitValue that avoids the client having to
129/// pass in a MCExpr for constant integers.
130void MCStreamer::emitIntValue(uint64_t Value, unsigned Size) {
131 assert(1 <= Size && Size <= 8 && "Invalid size");
132 assert((isUIntN(8 * Size, Value) || isIntN(8 * Size, Value)) &&
133 "Invalid size");
134 const bool IsLittleEndian = Context.getAsmInfo().isLittleEndian();
135 uint64_t Swapped = support::endian::byte_swap(
137 unsigned Index = IsLittleEndian ? 0 : 8 - Size;
138 emitBytes(StringRef(reinterpret_cast<char *>(&Swapped) + Index, Size));
139}
141 if (Value.getNumWords() == 1) {
142 emitIntValue(Value.getLimitedValue(), Value.getBitWidth() / 8);
143 return;
144 }
145
146 const bool IsLittleEndianTarget = Context.getAsmInfo().isLittleEndian();
147 const bool ShouldSwap = sys::IsLittleEndianHost != IsLittleEndianTarget;
148 const APInt Swapped = ShouldSwap ? Value.byteSwap() : Value;
149 const unsigned Size = Value.getBitWidth() / 8;
150 SmallString<10> Tmp;
151 Tmp.resize(Size);
152 StoreIntToMemory(Swapped, reinterpret_cast<uint8_t *>(Tmp.data()), Size);
153 emitBytes(Tmp.str());
154}
155
156/// EmitULEB128IntValue - Special case of EmitULEB128Value that avoids the
157/// client having to pass in a MCExpr for constant integers.
158unsigned MCStreamer::emitULEB128IntValue(uint64_t Value, unsigned PadTo) {
160 raw_svector_ostream OSE(Tmp);
161 encodeULEB128(Value, OSE, PadTo);
162 emitBytes(OSE.str());
163 return Tmp.size();
164}
165
166/// EmitSLEB128IntValue - Special case of EmitSLEB128Value that avoids the
167/// client having to pass in a MCExpr for constant integers.
170 raw_svector_ostream OSE(Tmp);
171 encodeSLEB128(Value, OSE);
172 emitBytes(OSE.str());
173 return Tmp.size();
174}
175
178}
179
180void MCStreamer::emitSymbolValue(const MCSymbol *Sym, unsigned Size,
181 bool IsSectionRelative) {
182 assert((!IsSectionRelative || Size == 4) &&
183 "SectionRelative value requires 4-bytes");
184
185 if (!IsSectionRelative)
187 else
188 emitCOFFSecRel32(Sym, /*Offset=*/0);
189}
190
191/// Emit NumBytes bytes worth of the value specified by FillValue.
192/// This implements directives such as '.space'.
193void MCStreamer::emitFill(uint64_t NumBytes, uint8_t FillValue) {
194 if (NumBytes)
195 emitFill(*MCConstantExpr::create(NumBytes, getContext()), FillValue);
196}
197
198void llvm::MCStreamer::emitNops(int64_t NumBytes, int64_t ControlledNopLen,
199 llvm::SMLoc, const MCSubtargetInfo& STI) {}
200
201/// The implementation in this class just redirects to emitFill.
202void MCStreamer::emitZeros(uint64_t NumBytes) { emitFill(NumBytes, 0); }
203
205 unsigned FileNo, StringRef Directory, StringRef Filename,
206 std::optional<MD5::MD5Result> Checksum, std::optional<StringRef> Source,
207 unsigned CUID) {
208 return getContext().getDwarfFile(Directory, Filename, FileNo, Checksum,
209 Source, CUID);
210}
211
214 std::optional<MD5::MD5Result> Checksum,
215 std::optional<StringRef> Source,
216 unsigned CUID) {
217 getContext().setMCLineTableRootFile(CUID, Directory, Filename, Checksum,
218 Source);
219}
220
222 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
223 if (!CurFrame)
224 return;
225 CurFrame->IsBKeyFrame = true;
226}
227
229 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
230 if (!CurFrame)
231 return;
232 CurFrame->IsMTETaggedFrame = true;
233}
234
236 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
237 if (!CurFrame)
238 return;
239 CurFrame->IsNonHintPAuthFrame = true;
240}
241
242void MCStreamer::emitDwarfLocDirective(unsigned FileNo, unsigned Line,
243 unsigned Column, unsigned Flags,
244 unsigned Isa, unsigned Discriminator,
245 StringRef FileName, StringRef Comment) {
246 getContext().setCurrentDwarfLoc(FileNo, Line, Column, Flags, Isa,
247 Discriminator);
248}
249
255
258 if (!Table.getLabel()) {
259 StringRef Prefix = Context.getAsmInfo().getInternalSymbolPrefix();
260 Table.setLabel(
261 Context.getOrCreateSymbol(Prefix + "line_table_start" + Twine(CUID)));
262 }
263 return Table.getLabel();
264}
265
267 return !FrameInfoStack.empty();
268}
269
270MCDwarfFrameInfo *MCStreamer::getCurrentDwarfFrameInfo() {
273 "this directive must appear between "
274 ".cfi_startproc and .cfi_endproc directives");
275 return nullptr;
276 }
277 return &DwarfFrameInfos[FrameInfoStack.back().first];
278}
279
281 ArrayRef<uint8_t> Checksum,
282 unsigned ChecksumKind) {
283 return getContext().getCVContext().addFile(*this, FileNo, Filename, Checksum,
284 ChecksumKind);
285}
286
290
292 unsigned IAFunc, unsigned IAFile,
293 unsigned IALine, unsigned IACol,
294 SMLoc Loc) {
295 if (getContext().getCVContext().getCVFunctionInfo(IAFunc) == nullptr) {
296 getContext().reportError(Loc, "parent function id not introduced by "
297 ".cv_func_id or .cv_inline_site_id");
298 return true;
299 }
300
302 FunctionId, IAFunc, IAFile, IALine, IACol);
303}
304
305void MCStreamer::emitCVLocDirective(unsigned FunctionId, unsigned FileNo,
306 unsigned Line, unsigned Column,
307 bool PrologueEnd, bool IsStmt,
308 StringRef FileName, SMLoc Loc) {}
309
312 MCCVFunctionInfo *FI = CVC.getCVFunctionInfo(FuncId);
313 if (!FI) {
315 Loc, "function id not introduced by .cv_func_id or .cv_inline_site_id");
316 return false;
317 }
318
319 // Track the section
320 if (FI->Section == nullptr)
322 else if (FI->Section != getCurrentSectionOnly()) {
324 Loc,
325 "all .cv_loc directives for a function must be in the same section");
326 return false;
327 }
328 return true;
329}
330
332 const MCSymbol *Begin,
333 const MCSymbol *End) {}
334
335void MCStreamer::emitCVInlineLinetableDirective(unsigned PrimaryFunctionId,
336 unsigned SourceFileId,
337 unsigned SourceLineNum,
338 const MCSymbol *FnStartSym,
339 const MCSymbol *FnEndSym) {}
340
341/// Only call this on endian-specific types like ulittle16_t and little32_t, or
342/// structs composed of them.
343template <typename T>
344static void copyBytesForDefRange(SmallString<20> &BytePrefix,
345 codeview::SymbolKind SymKind,
346 const T &DefRangeHeader) {
347 BytePrefix.resize(2 + sizeof(T));
348 codeview::ulittle16_t SymKindLE = codeview::ulittle16_t(SymKind);
349 memcpy(&BytePrefix[0], &SymKindLE, 2);
350 memcpy(&BytePrefix[2], &DefRangeHeader, sizeof(T));
351}
352
354 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
355 StringRef FixedSizePortion) {}
356
358 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
360 SmallString<20> BytePrefix;
361 copyBytesForDefRange(BytePrefix, codeview::S_DEFRANGE_REGISTER_REL, DRHdr);
362 emitCVDefRangeDirective(Ranges, BytePrefix);
363}
364
366 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
368 SmallString<20> BytePrefix;
369 copyBytesForDefRange(BytePrefix, codeview::S_DEFRANGE_SUBFIELD_REGISTER,
370 DRHdr);
371 emitCVDefRangeDirective(Ranges, BytePrefix);
372}
373
375 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
377 SmallString<20> BytePrefix;
378 copyBytesForDefRange(BytePrefix, codeview::S_DEFRANGE_REGISTER, DRHdr);
379 emitCVDefRangeDirective(Ranges, BytePrefix);
380}
381
383 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
385 SmallString<20> BytePrefix;
386 copyBytesForDefRange(BytePrefix, codeview::S_DEFRANGE_FRAMEPOINTER_REL,
387 DRHdr);
388 emitCVDefRangeDirective(Ranges, BytePrefix);
389}
390
392 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
394 SmallString<20> BytePrefix;
395 copyBytesForDefRange(BytePrefix, codeview::S_DEFRANGE_REGISTER_REL_INDIR,
396 DRHdr);
397 emitCVDefRangeDirective(Ranges, BytePrefix);
398}
399
401 MCSymbol *EHSymbol) {
402}
403
405 switchSectionNoPrint(getContext().getObjectFileInfo()->getTextSection());
406}
407
409 Symbol->redefineIfPossible();
410
411 if (!Symbol->isUndefined() || Symbol->isVariable())
412 return getContext().reportError(Loc, "symbol '" + Twine(Symbol->getName()) +
413 "' is already defined");
414
415 assert(!Symbol->isVariable() && "Cannot emit a variable symbol!");
416 assert(getCurrentSectionOnly() && "Cannot emit before setting section!");
417 assert(!Symbol->getFragment() && "Unexpected fragment on symbol data!");
418 assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
419
420 Symbol->setFragment(&getCurrentSectionOnly()->getDummyFragment());
421
422 if (LFIRewriter)
423 LFIRewriter->onLabel(Symbol, *this);
424
426 if (TS)
427 TS->emitLabel(Symbol);
428}
429
432
433void MCStreamer::emitCFISections(bool EH, bool Debug, bool SFrame) {}
434
436 if (!FrameInfoStack.empty() &&
437 getCurrentSectionOnly() == FrameInfoStack.back().second)
438 return getContext().reportError(
439 Loc, "starting new .cfi frame before finishing the previous one");
440
441 MCDwarfFrameInfo Frame;
442 Frame.IsSimple = IsSimple;
444
445 const MCAsmInfo &MAI = Context.getAsmInfo();
446 for (const MCCFIInstruction &Inst : MAI.getInitialFrameState()) {
447 if (Inst.getOperation() == MCCFIInstruction::OpDefCfa ||
448 Inst.getOperation() == MCCFIInstruction::OpDefCfaRegister ||
449 Inst.getOperation() == MCCFIInstruction::OpLLVMDefAspaceCfa) {
450 Frame.CurrentCfaRegister = Inst.getRegister();
451 }
452 }
453
454 FrameInfoStack.emplace_back(DwarfFrameInfos.size(), getCurrentSectionOnly());
455 DwarfFrameInfos.push_back(std::move(Frame));
456}
457
460
462 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
463 if (!CurFrame)
464 return;
465 emitCFIEndProcImpl(*CurFrame);
466 FrameInfoStack.pop_back();
467}
468
470 // Put a dummy non-null value in Frame.End to mark that this frame has been
471 // closed.
472 Frame.End = (MCSymbol *)1;
473}
474
476 // Create a label and insert it into the line table and return this label
477 const MCDwarfLoc &DwarfLoc = getContext().getCurrentDwarfLoc();
478
479 MCSymbol *LineStreamLabel = getContext().createTempSymbol();
480 MCDwarfLineEntry LabelLineEntry(nullptr, DwarfLoc, LineStreamLabel);
481 getContext()
482 .getMCDwarfLineTable(getContext().getDwarfCompileUnitID())
484 .addLineEntry(LabelLineEntry, getCurrentSectionOnly() /*Section*/);
485
486 return LineStreamLabel;
487}
488
490 // Return a dummy non-null value so that label fields appear filled in when
491 // generating textual assembly.
492 return (MCSymbol *)1;
493}
494
496 MCSymbol *Label = emitCFILabel();
499 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
500 if (!CurFrame)
501 return;
502 CurFrame->Instructions.push_back(std::move(Instruction));
503 CurFrame->CurrentCfaRegister = static_cast<unsigned>(Register);
504}
505
507 MCSymbol *Label = emitCFILabel();
510 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
511 if (!CurFrame)
512 return;
513 CurFrame->Instructions.push_back(std::move(Instruction));
514}
515
517 MCSymbol *Label = emitCFILabel();
520 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
521 if (!CurFrame)
522 return;
523 CurFrame->Instructions.push_back(std::move(Instruction));
524}
525
527 MCSymbol *Label = emitCFILabel();
530 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
531 if (!CurFrame)
532 return;
533 CurFrame->Instructions.push_back(std::move(Instruction));
534 CurFrame->CurrentCfaRegister = static_cast<unsigned>(Register);
535}
536
538 int64_t AddressSpace, SMLoc Loc) {
539 MCSymbol *Label = emitCFILabel();
541 Label, Register, Offset, AddressSpace, Loc);
542 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
543 if (!CurFrame)
544 return;
545 CurFrame->Instructions.push_back(std::move(Instruction));
546 CurFrame->CurrentCfaRegister = static_cast<unsigned>(Register);
547}
548
550 MCSymbol *Label = emitCFILabel();
553 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
554 if (!CurFrame)
555 return;
556 CurFrame->Instructions.push_back(std::move(Instruction));
557}
558
560 MCSymbol *Label = emitCFILabel();
563 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
564 if (!CurFrame)
565 return;
566 CurFrame->Instructions.push_back(std::move(Instruction));
567}
568
570 unsigned Encoding) {
571 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
572 if (!CurFrame)
573 return;
574 CurFrame->Personality = Sym;
575 CurFrame->PersonalityEncoding = Encoding;
576}
577
578void MCStreamer::emitCFILsda(const MCSymbol *Sym, unsigned Encoding) {
579 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
580 if (!CurFrame)
581 return;
582 CurFrame->Lsda = Sym;
583 CurFrame->LsdaEncoding = Encoding;
584}
585
587 MCSymbol *Label = emitCFILabel();
590 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
591 if (!CurFrame)
592 return;
593 CurFrame->Instructions.push_back(std::move(Instruction));
594}
595
597 // FIXME: Error if there is no matching cfi_remember_state.
598 MCSymbol *Label = emitCFILabel();
601 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
602 if (!CurFrame)
603 return;
604 CurFrame->Instructions.push_back(std::move(Instruction));
605}
606
608 MCSymbol *Label = emitCFILabel();
611 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
612 if (!CurFrame)
613 return;
614 CurFrame->Instructions.push_back(std::move(Instruction));
615}
616
618 MCSymbol *Label = emitCFILabel();
621 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
622 if (!CurFrame)
623 return;
624 CurFrame->Instructions.push_back(std::move(Instruction));
625}
626
628 MCSymbol *Label = emitCFILabel();
631 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
632 if (!CurFrame)
633 return;
634 CurFrame->Instructions.push_back(std::move(Instruction));
635}
636
638 MCSymbol *Label = emitCFILabel();
641 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
642 if (!CurFrame)
643 return;
644 CurFrame->Instructions.push_back(std::move(Instruction));
645}
646
648 int64_t R1Size, int64_t R2,
649 int64_t R2Size, SMLoc Loc) {
650 MCSymbol *Label = emitCFILabel();
652 Label, Register, R1, R1Size, R2, R2Size, Loc);
653 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
654 if (!CurFrame)
655 return;
656 CurFrame->Instructions.push_back(std::move(Instruction));
657}
658
661 SMLoc Loc) {
662 MCSymbol *Label = emitCFILabel();
665 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
666 if (!CurFrame)
667 return;
668 CurFrame->Instructions.push_back(std::move(Instruction));
669}
670
672 int64_t RegisterSizeInBits,
673 int64_t MaskRegister,
674 int64_t MaskRegisterSizeInBits,
675 int64_t Offset, SMLoc Loc) {
676 MCSymbol *Label = emitCFILabel();
678 Label, Register, RegisterSizeInBits, MaskRegister, MaskRegisterSizeInBits,
679 Offset, Loc);
680 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
681 if (!CurFrame)
682 return;
683 CurFrame->Instructions.push_back(std::move(Instruction));
684}
685
687 int64_t Register, int64_t SpillRegister,
688 int64_t SpillRegisterLaneSizeInBits, int64_t MaskRegister,
689 int64_t MaskRegisterSizeInBits, SMLoc Loc) {
690
691 MCSymbol *Label = emitCFILabel();
693 Label, Register, SpillRegister, SpillRegisterLaneSizeInBits, MaskRegister,
694 MaskRegisterSizeInBits, Loc);
695 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
696 if (!CurFrame)
697 return;
698 CurFrame->Instructions.push_back(std::move(Instruction));
699}
700
702 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
703 if (!CurFrame)
704 return;
705 CurFrame->IsSignalFrame = true;
706}
707
709 MCSymbol *Label = emitCFILabel();
712 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
713 if (!CurFrame)
714 return;
715 CurFrame->Instructions.push_back(std::move(Instruction));
716}
717
718void MCStreamer::emitCFIRegister(int64_t Register1, int64_t Register2,
719 SMLoc Loc) {
720 MCSymbol *Label = emitCFILabel();
722 MCCFIInstruction::createRegister(Label, Register1, Register2, Loc);
723 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
724 if (!CurFrame)
725 return;
726 CurFrame->Instructions.push_back(std::move(Instruction));
727}
728
730 MCSymbol *Label = emitCFILabel();
732 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
733 if (!CurFrame)
734 return;
735 CurFrame->Instructions.push_back(std::move(Instruction));
736}
737
739 MCSymbol *Label = emitCFILabel();
742 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
743 if (!CurFrame)
744 return;
745 CurFrame->Instructions.push_back(std::move(Instruction));
746}
747
749 MCSymbol *Label = emitCFILabel();
752 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
753 if (!CurFrame)
754 return;
755 CurFrame->Instructions.push_back(std::move(Instruction));
756}
757
758void MCStreamer::emitCFILLVMSetRAState(unsigned State, MCSymbol *PACSym,
759 SMLoc Loc) {
760 MCSymbol *Label = emitCFILabel();
762 MCCFIInstruction::createSetRAState(Label, State, PACSym, Loc);
763 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
764 if (!CurFrame)
765 return;
766 CurFrame->Instructions.push_back(std::move(Instruction));
767}
768
769void MCStreamer::emitCFILLVMSetRAState(unsigned State, int64_t Offset,
770 SMLoc Loc) {
771 MCSymbol *Label = emitCFILabel();
774 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
775 if (!CurFrame)
776 return;
777 CurFrame->Instructions.push_back(std::move(Instruction));
778}
779
781 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
782 if (!CurFrame)
783 return;
784 CurFrame->RAReg = Register;
785}
786
788 MCSymbol *Label = emitCFILabel();
790 if (MCDwarfFrameInfo *F = getCurrentDwarfFrameInfo())
791 F->Instructions.push_back(MCCFIInstruction::createLabel(Label, Sym, Loc));
792}
793
795 MCSymbol *Label = emitCFILabel();
798 MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo();
799 if (!CurFrame)
800 return;
801 CurFrame->Instructions.push_back(std::move(Instruction));
802}
803
805 const MCAsmInfo &MAI = Context.getAsmInfo();
806 if (!MAI.usesWindowsCFI()) {
808 Loc, ".seh_* directives are not supported on this target");
809 return nullptr;
810 }
811 if (!CurrentWinFrameInfo || CurrentWinFrameInfo->End) {
813 Loc, ".seh_ directive must appear within an active frame");
814 return nullptr;
815 }
816 return CurrentWinFrameInfo;
817}
818
820 const MCAsmInfo &MAI = Context.getAsmInfo();
821 if (!MAI.usesWindowsCFI())
822 return getContext().reportError(
823 Loc, ".seh_* directives are not supported on this target");
824 if (CurrentWinFrameInfo && !CurrentWinFrameInfo->End)
826 Loc, "Starting a function before ending the previous one!");
827
828 MCSymbol *StartProc = emitCFILabel();
829
830 CurrentProcWinFrameInfoStartIndex = WinFrameInfos.size();
831 WinFrameInfos.emplace_back(
832 std::make_unique<WinEH::FrameInfo>(Symbol, StartProc));
833 CurrentWinFrameInfo = WinFrameInfos.back().get();
834 CurrentWinFrameInfo->TextSection = getCurrentSectionOnly();
835 CurrentWinFrameInfo->FunctionLoc = Loc;
836 // Inherit the module-wide default unwind version.
837 CurrentWinFrameInfo->Version = DefaultWinCFIUnwindVersion;
838}
839
842 if (!CurFrame)
843 return;
844 CurrentWinFrameInfo = nullptr;
845
846 MCSymbol *Label = emitCFILabel();
847 CurFrame->End = Label;
848 const MCSymbol **FuncletOrFuncEndPtr =
849 CurFrame->ChainedParent ? &CurFrame->ChainedParent->FuncletOrFuncEnd
850 : &CurFrame->FuncletOrFuncEnd;
851 if (!*FuncletOrFuncEndPtr)
852 *FuncletOrFuncEndPtr = CurFrame->End;
853
854 if (CurrentWinEpilog) {
855 // Set End to... something... to prevent crashes later.
857 CurrentWinEpilog = nullptr;
858 getContext().reportError(Loc, "Missing .seh_endepilogue in " +
859 CurFrame->Function->getName());
860 }
861
862 for (size_t I = CurrentProcWinFrameInfoStartIndex, E = WinFrameInfos.size();
863 I != E; ++I)
864 emitWindowsUnwindTables(WinFrameInfos[I].get());
865 switchSection(CurFrame->TextSection);
866}
867
870 if (!CurFrame)
871 return;
872
873 MCSymbol *Label = emitCFILabel();
874 const MCSymbol **FuncletOrFuncEndPtr =
875 CurFrame->ChainedParent ? &CurFrame->ChainedParent->FuncletOrFuncEnd
876 : &CurFrame->FuncletOrFuncEnd;
877 *FuncletOrFuncEndPtr = Label;
878}
879
882 if (!CurFrame)
883 return;
884
885 if (!CurFrame->PrologEnd)
886 return getContext().reportError(
887 Loc, "can't split into a new chained region (.seh_splitchained) in the "
888 "middle of a prolog in " +
889 CurFrame->Function->getName());
890
891 MCSymbol *Label = emitCFILabel();
892
893 // Complete the current frame before starting a new, chained one.
894 CurFrame->End = Label;
895
896 // All chained frames point to the same parent.
897 WinEH::FrameInfo *ChainedParent =
898 CurFrame->ChainedParent ? CurFrame->ChainedParent : CurFrame;
899
900 WinFrameInfos.emplace_back(std::make_unique<WinEH::FrameInfo>(
901 CurFrame->Function, Label, ChainedParent));
902 CurrentWinFrameInfo = WinFrameInfos.back().get();
903 CurrentWinFrameInfo->TextSection = getCurrentSectionOnly();
904}
905
906void MCStreamer::emitWinEHHandler(const MCSymbol *Sym, bool Unwind, bool Except,
907 SMLoc Loc) {
909 if (!CurFrame)
910 return;
911
912 // Handlers are always associated with the parent frame.
913 CurFrame = CurFrame->ChainedParent ? CurFrame->ChainedParent : CurFrame;
914
915 CurFrame->ExceptionHandler = Sym;
916 if (!Except && !Unwind)
917 getContext().reportError(Loc, "Don't know what kind of handler this is!");
918 if (Unwind)
919 CurFrame->HandlesUnwind = true;
920 if (Except)
921 CurFrame->HandlesExceptions = true;
922}
923
926 if (!CurFrame)
927 return;
928}
929
931 const MCSymbolRefExpr *To, uint64_t Count) {
932}
933
934static MCSection *getWinCFISection(MCContext &Context, unsigned *NextWinCFIID,
935 MCSection *MainCFISec,
936 const MCSection *TextSec) {
937 // If this is the main .text section, use the main unwind info section.
938 if (TextSec == Context.getObjectFileInfo()->getTextSection())
939 return MainCFISec;
940
941 const auto *TextSecCOFF = static_cast<const MCSectionCOFF *>(TextSec);
942 auto *MainCFISecCOFF = static_cast<MCSectionCOFF *>(MainCFISec);
943 unsigned UniqueID = TextSecCOFF->getOrAssignWinCFISectionID(NextWinCFIID);
944
945 // If this section is COMDAT, this unwind section should be COMDAT associative
946 // with its group.
947 const MCSymbol *KeySym = nullptr;
948 if (TextSecCOFF->getCharacteristics() & COFF::IMAGE_SCN_LNK_COMDAT) {
949 KeySym = TextSecCOFF->getCOMDATSymbol();
950
951 // In a GNU environment, we can't use associative comdats. Instead, do what
952 // GCC does, which is to make plain comdat selectany section named like
953 // ".[px]data$_Z3foov".
954 if (!Context.getAsmInfo().hasCOFFAssociativeComdats()) {
955 std::string SectionName = (MainCFISecCOFF->getName() + "$" +
956 TextSecCOFF->getName().split('$').second)
957 .str();
958 return Context.getCOFFSection(SectionName,
959 MainCFISecCOFF->getCharacteristics() |
962 }
963 }
964
965 return Context.getAssociativeCOFFSection(MainCFISecCOFF, KeySym, UniqueID);
966}
967
969 return getWinCFISection(getContext(), &NextWinCFIID,
970 getContext().getObjectFileInfo()->getPDataSection(),
971 TextSec);
972}
973
975 return getWinCFISection(getContext(), &NextWinCFIID,
976 getContext().getObjectFileInfo()->getXDataSection(),
977 TextSec);
978}
979
981
982static unsigned encodeSEHRegNum(MCContext &Ctx, MCRegister Reg) {
983 return Ctx.getRegisterInfo()->getSEHRegNum(Reg);
984}
985
986// Unwind formats before v3 store the register operand of an unwind code in a
987// 4-bit field, so extended registers (r16-r31 / xmm16-xmm31, i.e. SEH register
988// numbers greater than 15) cannot be represented. Report an error rather than
989// silently truncating the register number to a different register. Returns true
990// if an error was reported.
992 const WinEH::Instruction &Inst,
993 uint8_t Version, SMLoc Loc,
996 Ctx.reportError(Loc, Directive +
997 " with an extended register requires unwind v3");
998 return true;
999 }
1000 return false;
1001}
1002
1005 if (!CurFrame)
1006 return;
1007
1008 MCSymbol *Label = emitCFILabel();
1009
1011 Label, encodeSEHRegNum(Context, Register));
1012 if (CurrentWinEpilog) {
1013 if (CurFrame->Version < 3)
1014 return getContext().reportError(
1015 Loc, ".seh_pushreg inside epilog requires unwind v3");
1016 CurrentWinEpilog->Instructions.push_back(Inst);
1017 } else {
1018 if (checkUnwindV3ExtendedReg(getContext(), Inst, CurFrame->Version, Loc,
1019 ".seh_pushreg"))
1020 return;
1021 CurFrame->Instructions.push_back(Inst);
1022 }
1023}
1024
1026 SMLoc Loc) {
1028 if (!CurFrame)
1029 return;
1030
1031 // UOP_Push2 is V3-only - reject for V1/V2.
1032 if (CurFrame->Version < 3)
1033 return getContext().reportError(
1034 Loc, ".seh_push2regs is only supported for unwind v3");
1035
1036 MCSymbol *Label = emitCFILabel();
1037
1039 Label, encodeSEHRegNum(Context, Reg1), encodeSEHRegNum(Context, Reg2));
1040 if (CurrentWinEpilog)
1041 CurrentWinEpilog->Instructions.push_back(Inst);
1042 else
1043 CurFrame->Instructions.push_back(Inst);
1044}
1045
1047 SMLoc Loc) {
1049 if (!CurFrame)
1050 return;
1051 if (!CurrentWinEpilog && CurFrame->LastFrameInst >= 0)
1052 return getContext().reportError(
1053 Loc, "frame register and offset can be set at most once");
1054 if (Offset & 0x0F)
1055 return getContext().reportError(Loc, "offset is not a multiple of 16");
1056 if (Offset > 240)
1057 return getContext().reportError(
1058 Loc, "frame offset must be less than or equal to 240");
1059
1060 MCSymbol *Label = emitCFILabel();
1061
1064 if (CurrentWinEpilog) {
1065 if (CurFrame->Version < 3)
1066 return getContext().reportError(
1067 Loc, ".seh_setframe inside epilog requires unwind v3");
1068 CurrentWinEpilog->Instructions.push_back(Inst);
1069 } else {
1070 if (checkUnwindV3ExtendedReg(getContext(), Inst, CurFrame->Version, Loc,
1071 ".seh_setframe"))
1072 return;
1073 CurFrame->LastFrameInst = CurFrame->Instructions.size();
1074 CurFrame->Instructions.push_back(Inst);
1075 }
1076}
1077
1080 if (!CurFrame)
1081 return;
1082 if (Size == 0)
1083 return getContext().reportError(Loc,
1084 "stack allocation size must be non-zero");
1085 if (Size & 7)
1086 return getContext().reportError(
1087 Loc, "stack allocation size is not a multiple of 8");
1088
1089 MCSymbol *Label = emitCFILabel();
1090
1092 if (CurrentWinEpilog) {
1093 if (CurFrame->Version < 3)
1094 return getContext().reportError(
1095 Loc, ".seh_stackalloc inside epilog requires unwind v3");
1096 CurrentWinEpilog->Instructions.push_back(Inst);
1097 } else {
1098 CurFrame->Instructions.push_back(Inst);
1099 }
1100}
1101
1103 SMLoc Loc) {
1105 if (!CurFrame)
1106 return;
1107
1108 if (Offset & 7)
1109 return getContext().reportError(
1110 Loc, "register save offset is not 8 byte aligned");
1111
1112 MCSymbol *Label = emitCFILabel();
1113
1115 Label, encodeSEHRegNum(Context, Register), Offset);
1116 if (CurrentWinEpilog) {
1117 if (CurFrame->Version < 3)
1118 return getContext().reportError(
1119 Loc, ".seh_savereg inside epilog requires unwind v3");
1120 CurrentWinEpilog->Instructions.push_back(Inst);
1121 } else {
1122 if (checkUnwindV3ExtendedReg(getContext(), Inst, CurFrame->Version, Loc,
1123 ".seh_savereg"))
1124 return;
1125 CurFrame->Instructions.push_back(Inst);
1126 }
1127}
1128
1130 SMLoc Loc) {
1132 if (!CurFrame)
1133 return;
1134 if (Offset & 0x0F)
1135 return getContext().reportError(Loc, "offset is not a multiple of 16");
1136
1137 MCSymbol *Label = emitCFILabel();
1138
1140 Label, encodeSEHRegNum(Context, Register), Offset);
1141 if (CurrentWinEpilog) {
1142 if (CurFrame->Version < 3)
1143 return getContext().reportError(
1144 Loc, ".seh_savexmm inside epilog requires unwind v3");
1145 CurrentWinEpilog->Instructions.push_back(Inst);
1146 } else {
1147 if (checkUnwindV3ExtendedReg(getContext(), Inst, CurFrame->Version, Loc,
1148 ".seh_savexmm"))
1149 return;
1150 CurFrame->Instructions.push_back(Inst);
1151 }
1152}
1153
1156 if (!CurFrame)
1157 return;
1158 if (CurrentWinEpilog) {
1159 if (CurFrame->Version < 3)
1160 return getContext().reportError(
1161 Loc, ".seh_pushframe inside epilog requires unwind v3");
1162 MCSymbol *Label = emitCFILabel();
1164 CurrentWinEpilog->Instructions.push_back(Inst);
1165 return;
1166 }
1167 if (!CurFrame->Instructions.empty())
1168 return getContext().reportError(
1169 Loc, "If present, PushMachFrame must be the first UOP");
1170
1171 MCSymbol *Label = emitCFILabel();
1172
1174 CurFrame->Instructions.push_back(Inst);
1175}
1176
1179 if (!CurFrame)
1180 return;
1181
1182 MCSymbol *Label = emitCFILabel();
1183
1184 CurFrame->PrologEnd = Label;
1185}
1186
1189 if (!CurFrame)
1190 return;
1191
1192 MCSymbol *Label = emitCFILabel();
1193
1194 if (!CurFrame->PrologEnd) {
1195 CurFrame->PrologEnd = Label;
1197 Loc, "starting epilogue (.seh_startepilogue) before prologue has ended "
1198 "(.seh_endprologue) in " +
1199 CurFrame->Function->getName());
1200 }
1202 &CurFrame->EpilogMap.insert_or_assign(Label, WinEH::FrameInfo::Epilog())
1203 .first->second;
1204 CurrentWinEpilog->Start = Label;
1205 CurrentWinEpilog->Loc = Loc;
1206}
1207
1210 if (!CurFrame)
1211 return;
1212
1213 if (!CurrentWinEpilog)
1214 return getContext().reportError(Loc, "Stray .seh_endepilogue in " +
1215 CurFrame->Function->getName());
1216
1217 if ((CurFrame->Version == 2) && !CurrentWinEpilog->UnwindV2Start) {
1218 // Set UnwindV2Start to... something... to prevent crashes later.
1219 CurrentWinEpilog->UnwindV2Start = CurrentWinEpilog->Start;
1220 getContext().reportError(Loc, "Missing .seh_unwindv2start in " +
1221 CurFrame->Function->getName());
1222 }
1223
1225 CurrentWinEpilog = nullptr;
1226}
1227
1230 if (!CurFrame)
1231 return;
1232
1233 if (!CurrentWinEpilog)
1234 return getContext().reportError(Loc, "Stray .seh_unwindv2start in " +
1235 CurFrame->Function->getName());
1236
1237 if (CurrentWinEpilog->UnwindV2Start)
1238 return getContext().reportError(Loc, "Duplicate .seh_unwindv2start in " +
1239 CurFrame->Function->getName());
1240
1241 MCSymbol *Label = emitCFILabel();
1242 CurrentWinEpilog->UnwindV2Start = Label;
1243}
1244
1246 bool SupportedVersion = (Version >= 1 && Version <= 3);
1247
1248 // If called outside a proc, set the module-level default.
1249 if (!CurrentWinFrameInfo || CurrentWinFrameInfo->End) {
1250 if (!SupportedVersion)
1251 return getContext().reportError(
1252 Loc, "Unsupported version for .seh_unwindversion");
1254 return;
1255 }
1256
1257 // Per-function override (existing behaviour).
1258 WinEH::FrameInfo *CurFrame = CurrentWinFrameInfo;
1259
1260 if (CurFrame->Version != DefaultWinCFIUnwindVersion &&
1262 return getContext().reportError(Loc, "Duplicate .seh_unwindversion in " +
1263 CurFrame->Function->getName());
1264
1265 if (!SupportedVersion)
1266 return getContext().reportError(
1267 Loc, "Unsupported version specified in .seh_unwindversion in " +
1268 CurFrame->Function->getName());
1269
1270 CurFrame->Version = Version;
1271}
1272
1274
1276
1278
1279void MCStreamer::emitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) {}
1280
1281void MCStreamer::emitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset) {}
1282
1284
1286
1287/// EmitRawText - If this file is backed by an assembly streamer, this dumps
1288/// the specified string in the output .s file. This capability is
1289/// indicated by the hasRawTextSupport() predicate.
1291 // This is not llvm_unreachable for the sake of out of tree backend
1292 // developers who may not have assembly streamers and should serve as a
1293 // reminder to not accidentally call EmitRawText in the absence of such.
1294 report_fatal_error("EmitRawText called on an MCStreamer that doesn't support "
1295 "it (target backend is likely missing an AsmStreamer "
1296 "implementation)");
1297}
1298
1300 SmallString<128> Str;
1301 emitRawTextImpl(T.toStringRef(Str));
1302}
1303
1305
1307
1310 (!WinFrameInfos.empty() && !WinFrameInfos.back()->End)) {
1311 getContext().reportError(EndLoc, "Unfinished frame!");
1312 return;
1313 }
1314
1315 if (LFIRewriter)
1316 LFIRewriter->finish(*this);
1317
1319 if (TS)
1320 TS->finish();
1321
1322 finishImpl();
1323}
1324
1326 if (Context.getDwarfFormat() != dwarf::DWARF64)
1327 return;
1328 AddComment("DWARF64 Mark");
1330}
1331
1332void MCStreamer::emitDwarfUnitLength(uint64_t Length, const Twine &Comment) {
1333 assert(Context.getDwarfFormat() == dwarf::DWARF64 ||
1336 AddComment(Comment);
1337 emitIntValue(Length, dwarf::getDwarfOffsetByteSize(Context.getDwarfFormat()));
1338}
1339
1341 const Twine &Comment) {
1343 AddComment(Comment);
1344 MCSymbol *Lo = Context.createTempSymbol(Prefix + "_start");
1345 MCSymbol *Hi = Context.createTempSymbol(Prefix + "_end");
1346
1348 Hi, Lo, dwarf::getDwarfOffsetByteSize(Context.getDwarfFormat()));
1349 // emit the begin symbol after we generate the length field.
1350 emitLabel(Lo);
1351 // Return the Hi symbol to the caller.
1352 return Hi;
1353}
1354
1356 // Set the value of the symbol, as we are at the start of the line table.
1357 emitLabel(StartSym);
1358}
1359
1362 Symbol->setVariableValue(Value);
1363
1365 if (TS)
1366 TS->emitAssignment(Symbol, Value);
1367}
1368
1370 uint64_t Address, const MCInst &Inst,
1371 const MCSubtargetInfo &STI,
1372 raw_ostream &OS) {
1373 InstPrinter.printInst(&Inst, Address, "", STI, OS);
1374}
1375
1377}
1378
1380 switch (Expr.getKind()) {
1381 case MCExpr::Target:
1382 cast<MCTargetExpr>(Expr).visitUsedExpr(*this);
1383 break;
1384
1385 case MCExpr::Constant:
1386 break;
1387
1388 case MCExpr::Binary: {
1389 const MCBinaryExpr &BE = cast<MCBinaryExpr>(Expr);
1390 visitUsedExpr(*BE.getLHS());
1391 visitUsedExpr(*BE.getRHS());
1392 break;
1393 }
1394
1395 case MCExpr::SymbolRef:
1396 visitUsedSymbol(cast<MCSymbolRefExpr>(Expr).getSymbol());
1397 break;
1398
1399 case MCExpr::Unary:
1400 visitUsedExpr(*cast<MCUnaryExpr>(Expr).getSubExpr());
1401 break;
1402
1403 case MCExpr::Specifier:
1404 visitUsedExpr(*cast<MCSpecifierExpr>(Expr).getSubExpr());
1405 break;
1406 }
1407}
1408
1410 // Scan for values.
1411 for (unsigned i = Inst.getNumOperands(); i--;)
1412 if (Inst.getOperand(i).isExpr())
1413 visitUsedExpr(*Inst.getOperand(i).getExpr());
1414}
1415
1416void MCStreamer::emitPseudoProbe(uint64_t Guid, uint64_t Index, uint64_t Type,
1417 uint64_t Attr, uint64_t Discriminator,
1418 const MCPseudoProbeInlineStack &InlineStack,
1419 MCSymbol *FnSym) {
1420 auto &Context = getContext();
1421
1422 // Create a symbol at in the current section for use in the probe.
1423 MCSymbol *ProbeSym = Context.createTempSymbol();
1424
1425 // Set the value of the symbol to use for the MCPseudoProbe.
1426 emitLabel(ProbeSym);
1427
1428 // Create a (local) probe entry with the symbol.
1429 MCPseudoProbe Probe(ProbeSym, Guid, Index, Type, Attr, Discriminator);
1430
1431 // Add the probe entry to this section's entries.
1432 Context.getMCPseudoProbeTable().getProbeSections().addPseudoProbe(
1433 FnSym, Probe, InlineStack);
1434}
1435
1437 unsigned Size) {
1438 // Get the Hi-Lo expression.
1439 const MCExpr *Diff =
1441 MCSymbolRefExpr::create(Lo, Context), Context);
1442
1443 const MCAsmInfo &MAI = Context.getAsmInfo();
1444 if (!MAI.doesSetDirectiveSuppressReloc()) {
1445 emitValue(Diff, Size);
1446 return;
1447 }
1448
1449 // Otherwise, emit with .set (aka assignment).
1450 MCSymbol *SetLabel = Context.createTempSymbol("set");
1451 emitAssignment(SetLabel, Diff);
1452 emitSymbolValue(SetLabel, Size);
1453}
1454
1456 const MCSymbol *Lo) {
1457 // Get the Hi-Lo expression.
1458 const MCExpr *Diff =
1460 MCSymbolRefExpr::create(Lo, Context), Context);
1461
1462 emitULEB128Value(Diff);
1463}
1464
1467 "emitSubsectionsViaSymbols only supported on Mach-O targets");
1468}
1469void MCStreamer::emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {}
1471 llvm_unreachable("this directive only supported on COFF targets");
1472}
1474 llvm_unreachable("this directive only supported on COFF targets");
1475}
1478 StringRef CompilerVersion,
1479 StringRef TimeStamp, StringRef Description) {
1480}
1482 llvm_unreachable("this directive only supported on COFF targets");
1483}
1485 llvm_unreachable("this directive only supported on COFF targets");
1486}
1488 MCSymbol *CsectSym,
1489 Align Alignment) {
1490 llvm_unreachable("this directive only supported on XCOFF targets");
1491}
1492
1494 MCSymbolAttr Linkage,
1495 MCSymbolAttr Visibility) {
1496 llvm_unreachable("emitXCOFFSymbolLinkageWithVisibility is only supported on "
1497 "XCOFF targets");
1498}
1499
1502
1504 llvm_unreachable("emitXCOFFRefDirective is only supported on XCOFF targets");
1505}
1506
1508 const MCSymbol *Trap,
1509 unsigned Lang, unsigned Reason,
1510 unsigned FunctionSize,
1511 bool hasDebug) {
1512 report_fatal_error("emitXCOFFExceptDirective is only supported on "
1513 "XCOFF targets");
1514}
1515
1517 llvm_unreachable("emitXCOFFCInfoSym is only supported on"
1518 "XCOFF targets");
1519}
1520
1523 StringRef Name, bool KeepOriginalSym) {}
1525 Align ByteAlignment) {}
1529 uint64_t Size, Align ByteAlignment) {}
1530
1532 CurFrag = &Sec->getDummyFragment();
1533 auto *Sym = Sec->getBeginSymbol();
1534 if (!Sym || !Sym->isUndefined())
1535 return;
1536 // In Mach-O, DWARF sections use Begin as a temporary label, requiring a label
1537 // definition, unlike section symbols in other file formats.
1538 if (getContext().getObjectFileType() == MCContext::IsMachO)
1539 emitLabel(Sym);
1540 else
1541 Sym->setFragment(CurFrag);
1542}
1543
1549}
1552void MCStreamer::emitFill(const MCExpr &NumBytes, uint64_t Value, SMLoc Loc) {}
1553void MCStreamer::emitFill(const MCExpr &NumValues, int64_t Size, int64_t Expr,
1554 SMLoc Loc) {}
1556void MCStreamer::emitPrefAlign(Align A, const MCSymbol &End, bool EmitNops,
1557 uint8_t Fill, const MCSubtargetInfo &STI) {}
1559 unsigned MaxBytesToEmit) {}
1561 SMLoc Loc) {}
1564 S.getStartTokLoc(),
1565 "aligned bundling is not supported by this object file format");
1566}
1577
1579 if (SectionStack.size() <= 1)
1580 return false;
1581 auto I = SectionStack.end();
1582 --I;
1583 MCSectionSubPair OldSec = I->first;
1584 --I;
1585 MCSectionSubPair NewSec = I->first;
1586
1587 if (NewSec.first && OldSec != NewSec)
1588 changeSection(NewSec.first, NewSec.second);
1589 SectionStack.pop_back();
1590 return true;
1591}
1592
1594 assert(Section && "Cannot switch to a null section!");
1595 MCSectionSubPair curSection = SectionStack.back().first;
1596 SectionStack.back().second = curSection;
1597 if (MCSectionSubPair(Section, Subsection) != curSection) {
1598 changeSection(Section, Subsection);
1599 SectionStack.back().first = MCSectionSubPair(Section, Subsection);
1600 assert(!Section->hasEnded() && "Section already ended");
1601 }
1602}
1603
1604bool MCStreamer::switchSection(MCSection *Section, const MCExpr *SubsecExpr) {
1605 int64_t Subsec = 0;
1606 if (SubsecExpr) {
1607 if (!SubsecExpr->evaluateAsAbsolute(Subsec, getAssemblerPtr())) {
1608 getContext().reportError(SubsecExpr->getLoc(),
1609 "cannot evaluate subsection number");
1610 return true;
1611 }
1612 if (!isUInt<31>(Subsec)) {
1613 getContext().reportError(SubsecExpr->getLoc(),
1614 "subsection number " + Twine(Subsec) +
1615 " is not within [0,2147483647]");
1616 return true;
1617 }
1618 }
1619 switchSection(Section, Subsec);
1620 return false;
1621}
1622
1624 SectionStack.back().second = SectionStack.back().first;
1625 SectionStack.back().first = MCSectionSubPair(Section, 0);
1626 changeSection(Section, 0);
1627}
1628
1630 // TODO: keep track of the last subsection so that this symbol appears in the
1631 // correct place.
1632 MCSymbol *Sym = Section->getEndSymbol(Context);
1633 if (Sym->isInSection())
1634 return Sym;
1635
1636 switchSection(Section);
1637 emitLabel(Sym);
1638 return Sym;
1639}
1640
1642 auto *Sec = CurFrag->getParent();
1643 F->setParent(Sec);
1644 F->setLayoutOrder(CurFrag->getLayoutOrder() + 1);
1645 CurFrag->Next = F;
1646 CurFrag = F;
1647 Sec->curFragList()->Tail = F;
1648}
1649
1650static VersionTuple
1652 VersionTuple TargetVersion) {
1653 VersionTuple Min = Target.getMinimumSupportedOSVersion();
1654 return !Min.empty() && Min > TargetVersion ? Min : TargetVersion;
1655}
1656
1657static MCVersionMinType
1659 assert(Target.isOSDarwin() && "expected a darwin OS");
1660 switch (Target.getOS()) {
1661 case Triple::MacOSX:
1662 case Triple::Darwin:
1663 return MCVM_OSXVersionMin;
1664 case Triple::IOS:
1665 assert(!Target.isMacCatalystEnvironment() &&
1666 "mac Catalyst should use LC_BUILD_VERSION");
1667 return MCVM_IOSVersionMin;
1668 case Triple::TvOS:
1669 return MCVM_TvOSVersionMin;
1670 case Triple::WatchOS:
1672 default:
1673 break;
1674 }
1675 llvm_unreachable("unexpected OS type");
1676}
1677
1679 assert(Target.isOSDarwin() && "expected a darwin OS");
1680 switch (Target.getOS()) {
1681 case Triple::MacOSX:
1682 case Triple::Darwin:
1683 return VersionTuple(10, 14);
1684 case Triple::IOS:
1685 // Mac Catalyst always uses the build version load command.
1686 if (Target.isMacCatalystEnvironment())
1687 return VersionTuple();
1688 [[fallthrough]];
1689 case Triple::TvOS:
1690 return VersionTuple(12);
1691 case Triple::WatchOS:
1692 return VersionTuple(5);
1693 case Triple::DriverKit:
1694 case Triple::BridgeOS:
1695 case Triple::XROS:
1696 // DriverKit/BridgeOS/XROS always use the build version load command.
1697 return VersionTuple();
1698 default:
1699 break;
1700 }
1701 llvm_unreachable("unexpected OS type");
1702}
1703
1706 assert(Target.isOSDarwin() && "expected a darwin OS");
1707 switch (Target.getOS()) {
1708 case Triple::MacOSX:
1709 case Triple::Darwin:
1710 return MachO::PLATFORM_MACOS;
1711 case Triple::IOS:
1712 if (Target.isMacCatalystEnvironment())
1713 return MachO::PLATFORM_MACCATALYST;
1714 return Target.isSimulatorEnvironment() ? MachO::PLATFORM_IOSSIMULATOR
1715 : MachO::PLATFORM_IOS;
1716 case Triple::TvOS:
1717 return Target.isSimulatorEnvironment() ? MachO::PLATFORM_TVOSSIMULATOR
1718 : MachO::PLATFORM_TVOS;
1719 case Triple::WatchOS:
1720 return Target.isSimulatorEnvironment() ? MachO::PLATFORM_WATCHOSSIMULATOR
1721 : MachO::PLATFORM_WATCHOS;
1722 case Triple::DriverKit:
1723 return MachO::PLATFORM_DRIVERKIT;
1724 case Triple::XROS:
1725 return Target.isSimulatorEnvironment() ? MachO::PLATFORM_XROS_SIMULATOR
1726 : MachO::PLATFORM_XROS;
1727 case Triple::BridgeOS:
1728 return MachO::PLATFORM_BRIDGEOS;
1729 default:
1730 break;
1731 }
1732 llvm_unreachable("unexpected OS type");
1733}
1734
1736 const Triple &Target, const VersionTuple &SDKVersion,
1737 const Triple *DarwinTargetVariantTriple,
1738 const VersionTuple &DarwinTargetVariantSDKVersion) {
1739 if (!Target.isOSBinFormatMachO() || !Target.isOSDarwin())
1740 return;
1741 // Do we even know the version?
1742 if (Target.getOSMajorVersion() == 0)
1743 return;
1744
1746 switch (Target.getOS()) {
1747 case Triple::MacOSX:
1748 case Triple::Darwin:
1749 Target.getMacOSXVersion(Version);
1750 break;
1751 case Triple::IOS:
1752 case Triple::TvOS:
1753 Version = Target.getiOSVersion();
1754 break;
1755 case Triple::WatchOS:
1756 Version = Target.getWatchOSVersion();
1757 break;
1758 case Triple::DriverKit:
1759 Version = Target.getDriverKitVersion();
1760 break;
1761 case Triple::XROS:
1762 case Triple::BridgeOS:
1763 Version = Target.getOSVersion();
1764 break;
1765 default:
1766 llvm_unreachable("unexpected OS type");
1767 }
1768 assert(Version.getMajor() != 0 && "A non-zero major version is expected");
1769 auto LinkedTargetVersion =
1771 auto BuildVersionOSVersion = getMachoBuildVersionSupportedOS(Target);
1772 bool ShouldEmitBuildVersion = false;
1773 if (BuildVersionOSVersion.empty() ||
1774 LinkedTargetVersion >= BuildVersionOSVersion) {
1775 if (Target.isMacCatalystEnvironment() && DarwinTargetVariantTriple &&
1776 DarwinTargetVariantTriple->isMacOSX()) {
1777 emitVersionForTarget(*DarwinTargetVariantTriple,
1778 DarwinTargetVariantSDKVersion,
1779 /*DarwinTargetVariantTriple=*/nullptr,
1780 /*DarwinTargetVariantSDKVersion=*/VersionTuple());
1783 LinkedTargetVersion.getMajor(),
1784 LinkedTargetVersion.getMinor().value_or(0),
1785 LinkedTargetVersion.getSubminor().value_or(0), SDKVersion);
1786 return;
1787 }
1789 LinkedTargetVersion.getMajor(),
1790 LinkedTargetVersion.getMinor().value_or(0),
1791 LinkedTargetVersion.getSubminor().value_or(0), SDKVersion);
1792 ShouldEmitBuildVersion = true;
1793 }
1794
1795 if (const Triple *TVT = DarwinTargetVariantTriple) {
1796 if (Target.isMacOSX() && TVT->isMacCatalystEnvironment()) {
1797 auto TVLinkedTargetVersion =
1798 targetVersionOrMinimumSupportedOSVersion(*TVT, TVT->getiOSVersion());
1801 TVLinkedTargetVersion.getMajor(),
1802 TVLinkedTargetVersion.getMinor().value_or(0),
1803 TVLinkedTargetVersion.getSubminor().value_or(0),
1804 DarwinTargetVariantSDKVersion);
1805 }
1806 }
1807
1808 if (ShouldEmitBuildVersion)
1809 return;
1810
1812 LinkedTargetVersion.getMajor(),
1813 LinkedTargetVersion.getMinor().value_or(0),
1814 LinkedTargetVersion.getSubminor().value_or(0), SDKVersion);
1815}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static LVOptions Options
Definition LVOptions.cpp:25
This file declares the MCLFIRewriter class, an abstract class that encapsulates the rewriting logic f...
static VersionTuple getMachoBuildVersionSupportedOS(const Triple &Target)
static bool checkUnwindV3ExtendedReg(MCContext &Ctx, const WinEH::Instruction &Inst, uint8_t Version, SMLoc Loc, StringRef Directive)
static void copyBytesForDefRange(SmallString< 20 > &BytePrefix, codeview::SymbolKind SymKind, const T &DefRangeHeader)
Only call this on endian-specific types like ulittle16_t and little32_t, or structs composed of them.
static MCVersionMinType getMachoVersionMinLoadCommandType(const Triple &Target)
static VersionTuple targetVersionOrMinimumSupportedOSVersion(const Triple &Target, VersionTuple TargetVersion)
static MCSection * getWinCFISection(MCContext &Context, unsigned *NextWinCFIID, MCSection *MainCFISec, const MCSection *TextSec)
static void reportBundlingUnsupported(MCStreamer &S)
static MachO::PlatformType getMachoBuildVersionPlatformType(const Triple &Target)
static unsigned encodeSEHRegNum(MCContext &Ctx, MCRegister Reg)
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
Register Reg
#define R2(n)
#define T
static constexpr StringLiteral Filename
This file defines the SmallString class.
Class for arbitrary precision integers.
Definition APInt.h:78
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
Holds state from .cv_file and .cv_loc directives for later emission.
Definition MCCodeView.h:144
LLVM_ABI bool addFile(MCStreamer &OS, unsigned FileNumber, StringRef Filename, ArrayRef< uint8_t > ChecksumBytes, uint8_t ChecksumKind)
LLVM_ABI MCCVFunctionInfo * getCVFunctionInfo(unsigned FuncId)
Retreive the function info if this is a valid function id, or nullptr.
LLVM_ABI bool recordFunctionId(unsigned FuncId)
Records the function id of a normal function.
LLVM_ABI bool recordInlinedCallSiteId(unsigned FuncId, unsigned IAFunc, unsigned IAFile, unsigned IALine, unsigned IACol)
Records the function id of an inlined call site.
Tagged union holding either a T or a Error.
Definition Error.h:485
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition MCAsmInfo.h:67
const std::vector< MCCFIInstruction > & getInitialFrameState() const
Definition MCAsmInfo.h:710
const char * getData8bitsDirective() const
Definition MCAsmInfo.h:470
bool doesSetDirectiveSuppressReloc() const
Definition MCAsmInfo.h:613
bool usesWindowsCFI() const
Returns true if the object format describes unwind information with Windows SEH unwind opcodes (....
Definition MCAsmInfo.h:672
Binary assembler expressions.
Definition MCExpr.h:298
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
Definition MCExpr.h:445
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
Definition MCExpr.h:448
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
Definition MCExpr.h:427
static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register, SMLoc Loc={})
.cfi_def_cfa_register modifies a rule for computing CFA.
Definition MCDwarf.h:635
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:797
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:732
static MCCFIInstruction createGnuArgsSize(MCSymbol *L, int64_t Size, SMLoc Loc={})
A special wrapper for .cfi_escape that indicates GNU_ARGS_SIZE.
Definition MCDwarf.h:765
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:787
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:725
static MCCFIInstruction createSetRAState(MCSymbol *L, unsigned State, MCSymbol *PACSym=nullptr, SMLoc Loc={})
.cfi_set_ra_state AArch64 set RA sign state,
Definition MCDwarf.h:708
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:660
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:808
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:685
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:628
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:670
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:828
static MCCFIInstruction createNegateRAStateWithPC(MCSymbol *L, SMLoc Loc={})
.cfi_negate_ra_state_with_pc AArch64 negate RA state with PC.
Definition MCDwarf.h:701
static MCCFIInstruction createNegateRAState(MCSymbol *L, SMLoc Loc={})
.cfi_negate_ra_state AArch64 negate RA state.
Definition MCDwarf.h:696
static MCCFIInstruction createRememberState(MCSymbol *L, SMLoc Loc={})
.cfi_remember_state Save all current rules for all registers.
Definition MCDwarf.h:745
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:777
static MCCFIInstruction cfiDefCfaOffset(MCSymbol *L, int64_t Offset, SMLoc Loc={})
.cfi_def_cfa_offset modifies a rule for computing CFA.
Definition MCDwarf.h:643
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:756
static MCCFIInstruction createWindowSave(MCSymbol *L, SMLoc Loc={})
.cfi_window_save SPARC register window is saved.
Definition MCDwarf.h:691
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:651
static MCCFIInstruction createRestoreState(MCSymbol *L, SMLoc Loc={})
.cfi_restore_state Restore the previously saved state.
Definition MCDwarf.h:750
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:739
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:678
static MCCFIInstruction createLabel(MCSymbol *L, MCSymbol *CfiLabel, SMLoc Loc)
Definition MCDwarf.h:770
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Definition MCExpr.cpp:212
Context object for machine code objects.
Definition MCContext.h:83
LLVM_ABI MCSymbol * createTempSymbol()
Create a temporary symbol with a unique name.
LLVM_ABI Expected< unsigned > getDwarfFile(StringRef Directory, StringRef FileName, unsigned FileNumber, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source, unsigned CUID)
Creates an entry in the dwarf file and directory tables.
MCDwarfLineTable & getMCDwarfLineTable(unsigned CUID)
Definition MCContext.h:716
LLVM_ABI CodeViewContext & getCVContext()
void setCurrentDwarfLoc(unsigned FileNum, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator)
Saves the information from the currently parsed dwarf .loc directive and sets DwarfLocSeen.
Definition MCContext.h:757
LLVM_ABI void reportError(SMLoc L, const Twine &Msg)
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
const MCDwarfLoc & getCurrentDwarfLoc()
Definition MCContext.h:772
void setMCLineTableRootFile(unsigned CUID, StringRef CompilationDir, StringRef Filename, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source)
Specifies the "root" file and directory of the compilation unit.
Definition MCContext.h:740
Instances of this class represent the line information for the dwarf line table entries.
Definition MCDwarf.h:190
LLVM_ABI void endCurrentSeqAndEmitLineStreamLabel(MCStreamer *MCOS, SMLoc DefLoc, StringRef Name)
Definition MCDwarf.cpp:288
const MCLineSection & getMCLineSections() const
Definition MCDwarf.h:451
Instances of this class represent the information from a dwarf .loc directive.
Definition MCDwarf.h:107
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
@ Unary
Unary expressions.
Definition MCExpr.h:44
@ Constant
Constant expressions.
Definition MCExpr.h:42
@ SymbolRef
References to labels and assigned expressions.
Definition MCExpr.h:43
@ Target
Target specific expression.
Definition MCExpr.h:46
@ Specifier
Expression with a relocation specifier.
Definition MCExpr.h:45
@ Binary
Binary expressions.
Definition MCExpr.h:41
ExprKind getKind() const
Definition MCExpr.h:85
SMLoc getLoc() const
Definition MCExpr.h:86
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
virtual void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &OS)=0
Print the specified MCInst to the specified raw_ostream.
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
unsigned getNumOperands() const
Definition MCInst.h:212
const MCOperand & getOperand(unsigned i) const
Definition MCInst.h:210
void addLineEntry(const MCDwarfLineEntry &LineEntry, MCSection *Sec)
Definition MCDwarf.h:241
const MCExpr * getExpr() const
Definition MCInst.h:118
bool isExpr() const
Definition MCInst.h:69
Instances of this class represent a pseudo probe instance for a pseudo probe table entry,...
Wrapper class representing physical registers. Should be passed by value.
Definition MCRegister.h:41
This represents a section on Windows.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h:580
MCFragment & getDummyFragment()
Definition MCSection.h:686
MCSymbol * getBeginSymbol()
Definition MCSection.h:653
Streaming machine code generation interface.
Definition MCStreamer.h:222
virtual void emitCFIGnuArgsSize(int64_t Size, SMLoc Loc={})
virtual void emitNops(int64_t NumBytes, int64_t ControlledNopLength, SMLoc Loc, const MCSubtargetInfo &STI)
MCSymbol * emitLineTableLabel()
virtual void emitAssignment(MCSymbol *Symbol, const MCExpr *Value)
Emit an assignment of Value to Symbol.
virtual void emitCFILLVMVectorOffset(int64_t Register, int64_t RegisterSizeInBits, int64_t MaskRegister, int64_t MaskRegisterSizeInBits, int64_t Offset, SMLoc Loc={})
void switchSectionNoPrint(MCSection *Section)
Similar to switchSection, but does not print the section directive.
virtual void emitCFIDefCfa(int64_t Register, int64_t Offset, SMLoc Loc={})
virtual void emitWinCFIUnwindVersion(uint8_t Version, SMLoc Loc=SMLoc())
virtual void visitUsedSymbol(const MCSymbol &Sym)
void setDefaultWinCFIUnwindVersion(uint8_t V)
Set the default unwind version for new WinCFI frames.
void emitCFIStartProc(bool IsSimple, SMLoc Loc=SMLoc())
virtual bool emitCVFuncIdDirective(unsigned FunctionId)
Introduces a function id for use with .cv_loc.
bool checkCVLocSection(unsigned FuncId, SMLoc Loc)
Returns true if the .cv_loc directive is in the right section.
virtual void finishImpl()
Streamer specific finalization.
virtual void emitCFIBKeyFrame()
virtual void beginCOFFSymbolDef(const MCSymbol *Symbol)
Start emitting COFF symbol definition.
virtual void emitWinCFIPushReg(MCRegister Register, SMLoc Loc=SMLoc())
virtual void emitBinaryData(StringRef Data)
Functionally identical to EmitBytes.
virtual bool popSection()
Restore the current and previous section from the section stack.
virtual MCSymbol * emitCFILabel()
When emitting an object file, create and emit a real label.
std::unique_ptr< MCLFIRewriter > LFIRewriter
Definition MCStreamer.h:299
virtual void emitWindowsUnwindTables()
virtual raw_ostream & getCommentOS()
Return a raw_ostream that comments can be written to.
virtual void emitZerofill(MCSection *Section, MCSymbol *Symbol=nullptr, uint64_t Size=0, Align ByteAlignment=Align(1), SMLoc Loc=SMLoc())
Emit the zerofill section and an optional symbol.
virtual void emitWinEHHandler(const MCSymbol *Sym, bool Unwind, bool Except, SMLoc Loc=SMLoc())
virtual void emitCFISections(bool EH, bool Debug, bool SFrame)
MCSection * getAssociatedPDataSection(const MCSection *TextSec)
Get the .pdata section used for the given section.
virtual void emitDwarfLocLabelDirective(SMLoc Loc, StringRef Name)
This implements the '.loc_label Name' directive.
bool hasUnfinishedDwarfFrameInfo()
virtual ~MCStreamer()
virtual void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI)
Emit the given Instruction into the current section.
virtual void emitCFINegateRAStateWithPC(SMLoc Loc={})
virtual void emitCFISameValue(int64_t Register, SMLoc Loc={})
virtual void emitSyntaxDirective(StringRef Syntax, StringRef Options)
virtual bool emitCVFileDirective(unsigned FileNo, StringRef Filename, ArrayRef< uint8_t > Checksum, unsigned ChecksumKind)
Associate a filename with a specified logical file number, and also specify that file's checksum info...
virtual void emitCFIReturnColumn(int64_t Register)
virtual void emitCOFFSymbolType(int Type)
Emit the type of the symbol.
virtual void emitCFIPersonality(const MCSymbol *Sym, unsigned Encoding)
virtual void emitDwarfUnitLength(uint64_t Length, const Twine &Comment)
Emit a unit length field.
virtual void emitCFIWindowSave(SMLoc Loc={})
virtual void emitCOFFSymbolIndex(MCSymbol const *Symbol)
Emits the symbol table index of a Symbol into the current section.
virtual void emitCFILLVMRegisterPair(int64_t Register, int64_t R1, int64_t R1SizeInBits, int64_t R2, int64_t R2SizeInBits, SMLoc Loc={})
virtual void emitCodeAlignment(Align Alignment, const MCSubtargetInfo &STI, unsigned MaxBytesToEmit=0)
Emit nops until the byte alignment ByteAlignment is reached.
SmallVector< MCDwarfFrameInfo, 0 > DwarfFrameInfos
Definition MCStreamer.h:273
virtual void emitWinCFIUnwindV2Start(SMLoc Loc=SMLoc())
virtual void emitWinCFIEndEpilogue(SMLoc Loc=SMLoc())
virtual void emitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset)
Emits a COFF image relative relocation.
virtual void endCOFFSymbolDef()
Marks the end of the symbol definition.
virtual void emitWinCFIPushFrame(bool Code, SMLoc Loc=SMLoc())
virtual void emitWinEHHandlerData(SMLoc Loc=SMLoc())
virtual MCAssembler * getAssemblerPtr()
Definition MCStreamer.h:331
virtual void emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi, const MCSymbol *Lo)
Emit the absolute difference between two symbols encoded with ULEB128.
virtual void emitXCOFFSymbolLinkageWithVisibility(MCSymbol *Symbol, MCSymbolAttr Linkage, MCSymbolAttr Visibility)
Emit a symbol's linkage and visibility with a linkage directive for XCOFF.
virtual void emitCFIUndefined(int64_t Register, SMLoc Loc={})
void setTargetStreamer(MCTargetStreamer *TS)
Definition MCStreamer.h:309
virtual void emitWinCFISaveXMM(MCRegister Register, unsigned Offset, SMLoc Loc=SMLoc())
virtual void emitCFIStartProcImpl(MCDwarfFrameInfo &Frame)
virtual void emitCOFFSecNumber(MCSymbol const *Symbol)
Emits the physical number of the section containing the given symbol as assigned during object writin...
virtual void emitCFINegateRAState(SMLoc Loc={})
virtual void emitCFILsda(const MCSymbol *Sym, unsigned Encoding)
MCContext & getContext() const
Definition MCStreamer.h:326
SMLoc getStartTokLoc() const
Definition MCStreamer.h:314
virtual Expected< unsigned > tryEmitDwarfFileDirective(unsigned FileNo, StringRef Directory, StringRef Filename, std::optional< MD5::MD5Result > Checksum=std::nullopt, std::optional< StringRef > Source=std::nullopt, unsigned CUID=0)
Associate a filename with a specified logical file number.
virtual void addExplicitComment(const Twine &T)
Add explicit comment T.
virtual void AddComment(const Twine &T, bool EOL=true)
Add a textual comment.
Definition MCStreamer.h:404
virtual void emitWinCFIBeginEpilogue(SMLoc Loc=SMLoc())
virtual void initSections(const MCSubtargetInfo &STI)
Create the default sections and set the initial one.
virtual void emitELFSize(MCSymbol *Symbol, const MCExpr *Value)
Emit an ELF .size directive.
virtual void emitXCOFFLocalCommonSymbol(MCSymbol *LabelSym, uint64_t Size, MCSymbol *CsectSym, Align Alignment)
Emits an lcomm directive with XCOFF csect information.
virtual void emitCFIMTETaggedFrame()
virtual void emitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset)
Emits a COFF section relative relocation.
virtual void emitBundleLock(bool AlignToEnd, const MCSubtargetInfo &STI)
The following instructions are a bundle-locked group.
MCSection * getAssociatedXDataSection(const MCSection *TextSec)
Get the .xdata section used for the given section.
virtual void emitRawComment(const Twine &T, bool TabPrefix=true)
Print T and prefix it with the comment string (normally #) and optionally a tab.
virtual void emitWinCFIStartProc(const MCSymbol *Symbol, SMLoc Loc=SMLoc())
void emitValue(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
void emitSymbolValue(const MCSymbol *Sym, unsigned Size, bool IsSectionRelative=false)
Special case of EmitValue that avoids the client having to pass in a MCExpr for MCSymbols.
virtual void emitDwarfLineStartLabel(MCSymbol *StartSym)
Emit the debug line start label.
virtual void emitCFIEscape(StringRef Values, SMLoc Loc={})
virtual void emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size)
Emit the absolute difference between two symbols.
virtual void emitXCOFFExceptDirective(const MCSymbol *Symbol, const MCSymbol *Trap, unsigned Lang, unsigned Reason, unsigned FunctionSize, bool hasDebug)
Emit an XCOFF .except directive which adds information about a trap instruction to the object file ex...
virtual void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc())
Emit a label for Symbol into the current section.
virtual void emitCOFFSectionIndex(MCSymbol const *Symbol)
Emits a COFF section index.
virtual void emitCFIRememberState(SMLoc Loc)
virtual void reset()
State management.
virtual void emitValueToAlignment(Align Alignment, int64_t Fill=0, uint8_t FillLen=1, unsigned MaxBytesToEmit=0)
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
virtual void emitCFILabelDirective(SMLoc Loc, StringRef Name)
virtual void emitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator, StringRef FileName, StringRef Comment={})
This implements the DWARF2 '.loc fileno lineno ...' assembler directive.
virtual void emitCVLinetableDirective(unsigned FunctionId, const MCSymbol *FnStart, const MCSymbol *FnEnd)
This implements the CodeView '.cv_linetable' assembler directive.
virtual void emitCOFFSecOffset(MCSymbol const *Symbol)
Emits the offset of the symbol from the beginning of the section during object writing (i....
MCTargetStreamer * getTargetStreamer()
Definition MCStreamer.h:336
MCStreamer(MCContext &Ctx)
MCFragment * CurFrag
Definition MCStreamer.h:271
virtual void emitDarwinTargetVariantBuildVersion(unsigned Platform, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion)
Definition MCStreamer.h:525
virtual void emitIntValue(uint64_t Value, unsigned Size)
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers.
unsigned getNumFrameInfos()
virtual void emitWinCFISaveReg(MCRegister Register, unsigned Offset, SMLoc Loc=SMLoc())
virtual void emitWinCFIEndProlog(SMLoc Loc=SMLoc())
virtual void emitWinCFIEndProc(SMLoc Loc=SMLoc())
virtual void emitSubsectionsViaSymbols()
Emit a .subsection_via_symbols directive.
void emitVersionForTarget(const Triple &Target, const VersionTuple &SDKVersion, const Triple *DarwinTargetVariantTriple, const VersionTuple &DarwinTargetVariantSDKVersion)
virtual void emitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame)
virtual void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue)
Set the DescValue for the Symbol.
virtual void emitCFIDefCfaRegister(int64_t Register, SMLoc Loc={})
virtual void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment)
Emit a local common (.lcomm) symbol.
virtual MCSymbol * getDwarfLineTableSymbol(unsigned CUID)
virtual void emitCFIRegister(int64_t Register1, int64_t Register2, SMLoc Loc={})
virtual void emitCOFFSafeSEH(MCSymbol const *Symbol)
virtual void emitWinCFIFuncletOrFuncEnd(SMLoc Loc=SMLoc())
This is used on platforms, such as Windows on ARM64, that require function or funclet sizes to be emi...
virtual void emitXCOFFRenameDirective(const MCSymbol *Name, StringRef Rename)
Emit a XCOFF .rename directive which creates a synonym for an illegal or undesirable name.
virtual void emitBundleUnlock(const MCSubtargetInfo &STI)
Ends a bundle-locked group.
virtual void emitPseudoProbe(uint64_t Guid, uint64_t Index, uint64_t Type, uint64_t Attr, uint64_t Discriminator, const MCPseudoProbeInlineStack &InlineStack, MCSymbol *FnSym)
Emit the a pseudo probe into the current section.
void setLFIRewriter(std::unique_ptr< MCLFIRewriter > Rewriter)
virtual void emitCGProfileEntry(const MCSymbolRefExpr *From, const MCSymbolRefExpr *To, uint64_t Count)
virtual void emitCFIAdjustCfaOffset(int64_t Adjustment, SMLoc Loc={})
unsigned emitULEB128IntValue(uint64_t Value, unsigned PadTo=0)
Special case of EmitULEB128Value that avoids the client having to pass in a MCExpr for constant integ...
virtual void emitWinCFIPush2Regs(MCRegister Reg1, MCRegister Reg2, SMLoc Loc=SMLoc())
virtual void emitULEB128Value(const MCExpr *Value)
ArrayRef< MCDwarfFrameInfo > getDwarfFrameInfos() const
virtual void emitPrefAlign(Align A, const MCSymbol &End, bool EmitNops, uint8_t Fill, const MCSubtargetInfo &STI)
virtual void emitCFILLVMVectorRegisterMask(int64_t Register, int64_t SpillRegister, int64_t SpillRegisterLaneSizeInBits, int64_t MaskRegister, int64_t MaskRegisterSizeInBits, SMLoc Loc={})
virtual void emitCFIRelOffset(int64_t Register, int64_t Offset, SMLoc Loc)
virtual void emitValueToOffset(const MCExpr *Offset, unsigned char Value, SMLoc Loc)
Emit some number of copies of Value until the byte offset Offset is reached.
MCSymbol * endSection(MCSection *Section)
virtual void switchSection(MCSection *Section, uint32_t Subsec=0)
Set the current section where code is being emitted to Section.
virtual void emitExplicitComments()
Emit added explicit comments.
WinEH::FrameInfo * EnsureValidWinFrameInfo(SMLoc Loc)
Retrieve the current frame info if one is available and it is not yet closed.
virtual void emitCFIRestoreState(SMLoc Loc)
virtual void emitXCOFFRefDirective(const MCSymbol *Symbol)
Emit a XCOFF .ref directive which creates R_REF type entry in the relocation table for one or more sy...
virtual void emitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol)
virtual void emitCVDefRangeDirective(ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)
This implements the CodeView '.cv_def_range' assembler directive.
void emitInt32(uint64_t Value)
Definition MCStreamer.h:769
virtual void emitCFIOffset(int64_t Register, int64_t Offset, SMLoc Loc={})
virtual void emitWinCFISetFrame(MCRegister Register, unsigned Offset, SMLoc Loc=SMLoc())
void maybeEmitDwarf64Mark()
Emit a special value of 0xffffffff if producing 64-bit debugging info.
virtual void emitCFIDefCfaOffset(int64_t Offset, SMLoc Loc={})
virtual void emitWinCFISplitChained(SMLoc Loc=SMLoc())
virtual void emitCVLocDirective(unsigned FunctionId, unsigned FileNo, unsigned Line, unsigned Column, bool PrologueEnd, bool IsStmt, StringRef FileName, SMLoc Loc)
This implements the CodeView '.cv_loc' assembler directive.
virtual void emitWinCFIAllocStack(unsigned Size, SMLoc Loc=SMLoc())
virtual void emitFileDirective(StringRef Filename)
Switch to a new logical file.
virtual void emitSLEB128Value(const MCExpr *Value)
virtual void emitCFIValOffset(int64_t Register, int64_t Offset, SMLoc Loc={})
virtual void emitELFSymverDirective(const MCSymbol *OriginalSym, StringRef Name, bool KeepOriginalSym)
Emit an ELF .symver directive.
virtual void emitXCOFFCInfoSym(StringRef Name, StringRef Metadata)
Emit a C_INFO symbol with XCOFF embedded metadata to the .info section.
MCSection * getCurrentSectionOnly() const
Definition MCStreamer.h:438
virtual void emitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc())
Emit the expression Value into the output as a native integer of the given Size bytes.
void emitRawText(const Twine &String)
If this file is backed by a assembly streamer, this dumps the specified string in the output ....
void emitZeros(uint64_t NumBytes)
Emit NumBytes worth of zeros.
void addFragment(MCFragment *F)
unsigned emitSLEB128IntValue(int64_t Value)
Special case of EmitSLEB128Value that avoids the client having to pass in a MCExpr for constant integ...
virtual bool emitCVInlineSiteIdDirective(unsigned FunctionId, unsigned IAFunc, unsigned IAFile, unsigned IALine, unsigned IACol, SMLoc Loc)
Introduces an inline call site id for use with .cv_loc.
virtual void emitCFISignalFrame()
virtual void emitCFILLVMVectorRegisters(int64_t Register, ArrayRef< MCCFIInstruction::VectorRegisterWithLane > VRs, SMLoc Loc={})
virtual void emitVersionMin(MCVersionMinType Type, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion)
Specify the Mach-O minimum deployment target version.
Definition MCStreamer.h:515
virtual void emitCOFFSymbolStorageClass(int StorageClass)
Emit the storage class of the symbol.
virtual void emitConditionalAssignment(MCSymbol *Symbol, const MCExpr *Value)
Emit an assignment of Value to Symbol, but only if Value is also emitted.
virtual void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, Align ByteAlignment=Align(1))
Emit a thread local bss (.tbss) symbol.
virtual void emitCFIRestore(int64_t Register, SMLoc Loc={})
WinEH::FrameInfo::Epilog * CurrentWinEpilog
Definition MCStreamer.h:269
virtual void emitCVInlineLinetableDirective(unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)
This implements the CodeView '.cv_inline_linetable' assembler directive.
void emitFill(uint64_t NumBytes, uint8_t FillValue)
Emit NumBytes bytes worth of the value specified by FillValue.
virtual void emitBundleAlignMode(Align Alignment)
Enable aligned instruction bundling with the given bundle size, from this point onward.
virtual void emitRawTextImpl(StringRef String)
EmitRawText - If this file is backed by an assembly streamer, this dumps the specified string in the ...
virtual void emitBytes(StringRef Data)
Emit the bytes in Data into the output.
void finish(SMLoc EndLoc=SMLoc())
Finish emission of machine code.
virtual void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol)
Emit an weak reference from Alias to Symbol.
void visitUsedExpr(const MCExpr &Expr)
virtual void emitDwarfFile0Directive(StringRef Directory, StringRef Filename, std::optional< MD5::MD5Result > Checksum, std::optional< StringRef > Source, unsigned CUID=0)
Specify the "root" file of the compilation, using the ".file 0" extension.
virtual void emitBuildVersion(unsigned Platform, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion)
Emit/Specify Mach-O build version command.
Definition MCStreamer.h:521
virtual void changeSection(MCSection *, uint32_t)
This is called by popSection and switchSection, if the current section changes.
virtual void emitCFINonHintPAuthFrame()
virtual void emitCFILLVMDefAspaceCfa(int64_t Register, int64_t Offset, int64_t AddressSpace, SMLoc Loc={})
virtual void emitCFILLVMSetRAState(unsigned State, MCSymbol *PACSym, SMLoc Loc={})
Generic base class for all target subtargets.
Represent a reference to a symbol from inside an expression.
Definition MCExpr.h:190
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.h:213
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
bool isInSection() const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute).
Definition MCSymbol.h:237
StringRef getName() const
getName - Get the symbol name.
Definition MCSymbol.h:188
Target specific streamer interface.
Definition MCStreamer.h:95
virtual void emitDwarfFileDirective(StringRef Directive)
virtual void emitValue(const MCExpr *Value)
virtual void prettyPrintAsm(MCInstPrinter &InstPrinter, uint64_t Address, const MCInst &Inst, const MCSubtargetInfo &STI, raw_ostream &OS)
virtual void finish()
virtual void emitAssignment(MCSymbol *Symbol, const MCExpr *Value)
virtual void emitRawBytes(StringRef Data)
Emit the bytes in Data into the output.
MCStreamer & Streamer
Definition MCStreamer.h:97
MCTargetStreamer(MCStreamer &S)
virtual void changeSection(const MCSection *CurSection, MCSection *Section, uint32_t SubSection, raw_ostream &OS)
Update streamer for a new active section.
virtual void emitLabel(MCSymbol *Symbol)
virtual void emitConstantPools()
Root of the metadata hierarchy.
Definition Metadata.h:64
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
StringRef str() const
Explicit conversion to StringRef.
void resize(size_type N)
pointer data()
Return a pointer to the vector's buffer, even if empty().
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
bool isMacOSX() const
Is this a Mac OS X triple.
Definition Triple.h:682
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
LLVM Value Representation.
Definition Value.h:75
Represents a version number in the form major[.minor[.subminor[.build]]].
bool empty() const
Determine whether this version information is empty (e.g., all version components are zero).
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
A raw_ostream that writes to an SmallVector or SmallString.
StringRef str() const
Return a StringRef for the vector contents.
This class represents a function that is read from a sample profile.
Definition FunctionId.h:36
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ IMAGE_SCN_LNK_COMDAT
Definition COFF.h:309
@ IMAGE_COMDAT_SELECT_ANY
Definition COFF.h:456
detail::packed_endian_specific_integral< uint16_t, llvm::endianness::little, unaligned > ulittle16_t
Definition Endian.h:267
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
Definition CodeView.h:48
@ DWARF64
Definition Dwarf.h:93
uint8_t getDwarfOffsetByteSize(DwarfFormat Format)
The size of a reference determined by the DWARF 32/64-bit format.
Definition Dwarf.h:1203
@ DW_LENGTH_lo_reserved
Special values for an initial length field.
Definition Dwarf.h:56
@ DW_LENGTH_DWARF64
Indicator of 64-bit DWARF format.
Definition Dwarf.h:57
value_type byte_swap(value_type value, endianness endian)
Swap the bytes of value to match the given endianness.
Definition Endian.h:45
detail::packed_endian_specific_integral< uint16_t, llvm::endianness::little, unaligned > ulittle16_t
Definition Endian.h:267
constexpr bool IsLittleEndianHost
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
@ Length
Definition DWP.cpp:577
LLVM_ABI void StoreIntToMemory(const APInt &IntVal, uint8_t *Dst, unsigned StoreBytes)
Fills the StoreBytes bytes of memory starting from Dst with the integer held in IntVal.
Definition APInt.cpp:3085
RelativeUniformCounterPtr Values
Definition InstrProf.h:91
@ Debug
Register 'use' is for debugging purpose.
constexpr bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
Definition MathExtras.h:244
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
SmallVector< InlineSite, 8 > MCPseudoProbeInlineStack
MCVersionMinType
@ MCVM_WatchOSVersionMin
.watchos_version_min
@ MCVM_OSXVersionMin
.macosx_version_min
@ MCVM_TvOSVersionMin
.tvos_version_min
@ MCVM_IOSVersionMin
.ios_version_min
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Definition Error.cpp:163
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.
Definition MathExtras.h:190
LLVM_ABI raw_ostream & nulls()
This returns a reference to a raw_ostream which simply discards output.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
Definition InstrProf.h:145
unsigned encodeSLEB128(int64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a SLEB128 value to an output stream.
Definition LEB128.h:24
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
constexpr bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
Definition MathExtras.h:249
unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a ULEB128 value to an output stream.
Definition LEB128.h:79
std::pair< MCSection *, uint32_t > MCSectionSubPair
Definition MCStreamer.h:68
@ End
Run the machine verifier once, at the end of the pipeline.
Definition CodeGen.h:320
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
Information describing a function or inlined call site introduced by .cv_func_id or ....
Definition MCCodeView.h:98
MCSection * Section
The section of the first .cv_loc directive used for this function, or null if none has been seen yet.
Definition MCCodeView.h:118
const MCSymbol * Personality
Definition MCDwarf.h:904
unsigned PersonalityEncoding
Definition MCDwarf.h:908
std::vector< MCCFIInstruction > Instructions
Definition MCDwarf.h:906
const MCSymbol * Lsda
Definition MCDwarf.h:905
unsigned CurrentCfaRegister
Definition MCDwarf.h:907
static WinEH::Instruction SaveXMM(MCSymbol *L, unsigned Reg, unsigned Offset)
Definition MCWin64EH.h:45
static WinEH::Instruction PushNonVol(MCSymbol *L, unsigned Reg)
Definition MCWin64EH.h:26
static WinEH::Instruction PushMachFrame(MCSymbol *L, bool Code)
Definition MCWin64EH.h:36
static WinEH::Instruction SaveNonVol(MCSymbol *L, unsigned Reg, unsigned Offset)
Definition MCWin64EH.h:39
static WinEH::Instruction Alloc(MCSymbol *L, unsigned Size)
Definition MCWin64EH.h:32
static WinEH::Instruction SetFPReg(MCSymbol *L, unsigned Reg, unsigned Off)
Definition MCWin64EH.h:51
static WinEH::Instruction Push2(MCSymbol *L, unsigned Reg1, unsigned Reg2)
Definition MCWin64EH.h:29
std::vector< Instruction > Instructions
Definition MCWinEH.h:68
const MCSymbol * Function
Definition MCWinEH.h:51
MCSection * TextSection
Definition MCWinEH.h:55
FrameInfo * ChainedParent
Definition MCWinEH.h:67
const MCSymbol * PrologEnd
Definition MCWinEH.h:53
MapVector< MCSymbol *, Epilog > EpilogMap
Definition MCWinEH.h:77
const MCSymbol * FuncletOrFuncEnd
Definition MCWinEH.h:49
const MCSymbol * End
Definition MCWinEH.h:48
static constexpr uint8_t DefaultVersion
Definition MCWinEH.h:63
const MCSymbol * ExceptionHandler
Definition MCWinEH.h:50