83 for (
const unsigned char C :
Data.bytes()) {
95 :
Context(Ctx), CurrentWinFrameInfo(nullptr),
96 CurrentProcWinFrameInfoStartIndex(0), UseAssemblerInfoForParsing(
false) {
97 SectionStack.
push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
103 DwarfFrameInfos.clear();
104 CurrentWinFrameInfo =
nullptr;
105 WinFrameInfos.clear();
106 SymbolOrdering.
clear();
107 SectionStack.
clear();
108 SectionStack.
push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
118 return DwarfFrameInfos;
127 for (
auto &FI : DwarfFrameInfos)
128 FI.CompactUnwindEncoding =
141 unsigned Index = IsLittleEndian ? 0 : 8 -
Size;
145 if (
Value.getNumWords() == 1) {
153 const unsigned Size =
Value.getBitWidth() / 8;
185 bool IsSectionRelative) {
187 "SectionRelative value requires 4-bytes");
189 if (!IsSectionRelative)
233 std::optional<MD5::MD5Result> Checksum, std::optional<StringRef> Source,
241 std::optional<MD5::MD5Result> Checksum,
242 std::optional<StringRef> Source,
263 unsigned Column,
unsigned Flags,
264 unsigned Isa,
unsigned Discriminator,
281 return !FrameInfoStack.empty();
287 "this directive must appear between "
288 ".cfi_startproc and .cfi_endproc directives");
291 return &DwarfFrameInfos[FrameInfoStack.back().first];
296 unsigned ChecksumKind) {
306 unsigned IAFunc,
unsigned IAFile,
307 unsigned IALine,
unsigned IACol,
309 if (
getContext().getCVContext().getCVFunctionInfo(IAFunc) ==
nullptr) {
311 ".cv_func_id or .cv_inline_site_id");
316 FunctionId, IAFunc, IAFile, IALine, IACol);
320 unsigned Line,
unsigned Column,
321 bool PrologueEnd,
bool IsStmt,
330 Loc,
"function id not introduced by .cv_func_id or .cv_inline_site_id");
340 "all .cv_loc directives for a function must be in the same section");
351 unsigned SourceFileId,
352 unsigned SourceLineNum,
361 const T &DefRangeHeader) {
362 BytePrefix.
resize(2 +
sizeof(
T));
363 codeview::ulittle16_t SymKindLE = codeview::ulittle16_t(SymKind);
364 memcpy(&BytePrefix[0], &SymKindLE, 2);
365 memcpy(&BytePrefix[2], &DefRangeHeader,
sizeof(
T));
369 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
373 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
381 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
390 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
398 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
416 Symbol->setFragment(Fragment);
420 SymbolOrdering[Symbol] = 1 + SymbolOrdering.
size();
424 Symbol->redefineIfPossible();
426 if (!Symbol->isUndefined() || Symbol->isVariable())
428 "' is already defined");
430 assert(!Symbol->isVariable() &&
"Cannot emit a variable symbol!");
432 assert(!Symbol->getFragment() &&
"Unexpected fragment on symbol data!");
433 assert(Symbol->isUndefined() &&
"Cannot define a symbol twice!");
448 if (!FrameInfoStack.empty() &&
451 Loc,
"starting new .cfi frame before finishing the previous one");
469 DwarfFrameInfos.push_back(Frame);
480 FrameInfoStack.pop_back();
582 CurFrame->
Lsda = Sym;
701 Loc,
".seh_* directives are not supported on this target");
704 if (!CurrentWinFrameInfo || CurrentWinFrameInfo->
End) {
706 Loc,
".seh_ directive must appear within an active frame");
709 return CurrentWinFrameInfo;
716 Loc,
".seh_* directives are not supported on this target");
717 if (CurrentWinFrameInfo && !CurrentWinFrameInfo->
End)
719 Loc,
"Starting a function before ending the previous one!");
723 CurrentProcWinFrameInfoStartIndex = WinFrameInfos.size();
724 WinFrameInfos.emplace_back(
725 std::make_unique<WinEH::FrameInfo>(Symbol, StartProc));
726 CurrentWinFrameInfo = WinFrameInfos.back().get();
738 CurFrame->
End = Label;
742 for (
size_t I = CurrentProcWinFrameInfoStartIndex,
E = WinFrameInfos.size();
766 WinFrameInfos.emplace_back(std::make_unique<WinEH::FrameInfo>(
767 CurFrame->
Function, StartProc, CurFrame));
768 CurrentWinFrameInfo = WinFrameInfos.back().get();
778 Loc,
"End of a chained region outside a chained region!");
782 CurFrame->
End = Label;
793 Loc,
"Chained unwind areas can't have handlers!");
795 if (!Except && !Unwind)
819 if (TextSec ==
Context.getObjectFileInfo()->getTextSection())
822 const auto *TextSecCOFF = cast<MCSectionCOFF>(TextSec);
823 auto *MainCFISecCOFF = cast<MCSectionCOFF>(MainCFISec);
824 unsigned UniqueID = TextSecCOFF->getOrAssignWinCFISectionID(NextWinCFIID);
830 KeySym = TextSecCOFF->getCOMDATSymbol();
835 if (!
Context.getAsmInfo()->hasCOFFAssociativeComdats()) {
836 std::string
SectionName = (MainCFISecCOFF->getName() +
"$" +
837 TextSecCOFF->getName().split(
'$').second)
846 return Context.getAssociativeCOFFSection(MainCFISecCOFF, KeySym, UniqueID);
851 getContext().getObjectFileInfo()->getPDataSection(),
857 getContext().getObjectFileInfo()->getXDataSection(),
886 Loc,
"frame register and offset can be set at most once");
891 Loc,
"frame offset must be less than or equal to 240");
907 "stack allocation size must be non-zero");
910 Loc,
"stack allocation size is not a multiple of 8");
926 Loc,
"register save offset is not 8 byte aligned");
956 Loc,
"If present, PushMachFrame must be the first UOP");
992 "it (target backend is likely missing an AsmStreamer "
1006 if ((!DwarfFrameInfos.empty() && !DwarfFrameInfos.back().End) ||
1007 (!WinFrameInfos.empty() && !WinFrameInfos.back()->End)) {
1035 const Twine &Comment) {
1056 Symbol->setVariableValue(
Value);
1076 cast<MCTargetExpr>(Expr).visitUsedExpr(*
this);
1122 Context.getMCPseudoProbeTable().getProbeSections().addPseudoProbe(
1123 FnSym, Probe, InlineStack);
1183 llvm_unreachable(
"emitXCOFFSymbolLinkageWithVisibility is only supported on "
1194 llvm_unreachable(
"emitXCOFFRefDirective is only supported on XCOFF targets");
1199 unsigned Lang,
unsigned Reason,
1200 unsigned FunctionSize,
1210 Align ByteAlignment) {}
1227 unsigned MaxBytesToEmit) {}
1229 unsigned MaxBytesToEmit) {}
1238 assert(Section &&
"Cannot switch to a null section!");
1240 SectionStack.
back().second = curSection;
1244 assert(!Section->hasEnded() &&
"Section already ended");
1245 MCSymbol *Sym = Section->getBeginSymbol();
1267 return !Min.
empty() && Min > TargetVersion ? Min : TargetVersion;
1273 switch (
Target.getOS()) {
1279 "mac Catalyst should use LC_BUILD_VERSION");
1293 switch (
Target.getOS()) {
1299 if (
Target.isMacCatalystEnvironment())
1318 switch (
Target.getOS()) {
1323 if (
Target.isMacCatalystEnvironment())
1343 const Triple *DarwinTargetVariantTriple,
1345 if (!
Target.isOSBinFormatMachO() || !
Target.isOSDarwin())
1348 if (
Target.getOSMajorVersion() == 0)
1352 switch (
Target.getOS()) {
1355 Target.getMacOSXVersion(Version);
1359 Version =
Target.getiOSVersion();
1362 Version =
Target.getWatchOSVersion();
1365 Version =
Target.getDriverKitVersion();
1370 assert(Version.getMajor() != 0 &&
"A non-zero major version is expected");
1371 auto LinkedTargetVersion =
1374 bool ShouldEmitBuildVersion =
false;
1375 if (BuildVersionOSVersion.empty() ||
1376 LinkedTargetVersion >= BuildVersionOSVersion) {
1377 if (
Target.isMacCatalystEnvironment() && DarwinTargetVariantTriple &&
1378 DarwinTargetVariantTriple->
isMacOSX()) {
1380 DarwinTargetVariantSDKVersion,
1385 LinkedTargetVersion.getMajor(),
1386 LinkedTargetVersion.getMinor().value_or(0),
1387 LinkedTargetVersion.getSubminor().value_or(0), SDKVersion);
1391 LinkedTargetVersion.getMajor(),
1392 LinkedTargetVersion.getMinor().value_or(0),
1393 LinkedTargetVersion.getSubminor().value_or(0), SDKVersion);
1394 ShouldEmitBuildVersion =
true;
1397 if (
const Triple *TVT = DarwinTargetVariantTriple) {
1398 if (
Target.isMacOSX() && TVT->isMacCatalystEnvironment()) {
1399 auto TVLinkedTargetVersion =
1403 TVLinkedTargetVersion.getMajor(),
1404 TVLinkedTargetVersion.getMinor().value_or(0),
1405 TVLinkedTargetVersion.getSubminor().value_or(0),
1406 DarwinTargetVariantSDKVersion);
1410 if (ShouldEmitBuildVersion)
1414 LinkedTargetVersion.getMajor(),
1415 LinkedTargetVersion.getMinor().value_or(0),
1416 LinkedTargetVersion.getSubminor().value_or(0), SDKVersion);
BlockVerifier::State From
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static VersionTuple getMachoBuildVersionSupportedOS(const Triple &Target)
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 MachO::PlatformType getMachoBuildVersionPlatformType(const Triple &Target)
static unsigned encodeSEHRegNum(MCContext &Ctx, MCRegister Reg)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallString class.
Class for arbitrary precision integers.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Holds state from .cv_file and .cv_loc directives for later emission.
bool addFile(MCStreamer &OS, unsigned FileNumber, StringRef Filename, ArrayRef< uint8_t > ChecksumBytes, uint8_t ChecksumKind)
MCCVFunctionInfo * getCVFunctionInfo(unsigned FuncId)
Retreive the function info if this is a valid function id, or nullptr.
bool recordFunctionId(unsigned FuncId)
Records the function id of a normal function.
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.
Generic interface to target specific assembler backends.
virtual uint32_t generateCompactUnwindEncoding(ArrayRef< MCCFIInstruction >) const
Generate the compact unwind encoding for the CFI instructions.
This class is intended to be used as a base class for asm properties and features specific to the tar...
StringRef getPrivateGlobalPrefix() const
bool isLittleEndian() const
True if the target is little endian.
const std::vector< MCCFIInstruction > & getInitialFrameState() const
const char * getData8bitsDirective() const
bool doesSetDirectiveSuppressReloc() const
bool usesWindowsCFI() const
Binary assembler expressions.
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static MCCFIInstruction cfiDefCfaOffset(MCSymbol *L, int Offset)
.cfi_def_cfa_offset modifies a rule for computing CFA.
static MCCFIInstruction createRestore(MCSymbol *L, unsigned Register)
.cfi_restore says that the rule for Register is now the same as it was at the beginning of the functi...
static MCCFIInstruction createSameValue(MCSymbol *L, unsigned Register)
.cfi_same_value Current value of Register is the same as in the previous frame.
static MCCFIInstruction createGnuArgsSize(MCSymbol *L, int Size)
A special wrapper for .cfi_escape that indicates GNU_ARGS_SIZE.
static MCCFIInstruction createDefCfaRegister(MCSymbol *L, unsigned Register)
.cfi_def_cfa_register modifies a rule for computing CFA.
static MCCFIInstruction createUndefined(MCSymbol *L, unsigned Register)
.cfi_undefined From now on the previous value of Register can't be restored anymore.
static MCCFIInstruction createAdjustCfaOffset(MCSymbol *L, int Adjustment)
.cfi_adjust_cfa_offset Same as .cfi_def_cfa_offset, but Offset is a relative value that is added/subt...
static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register, int Offset)
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it.
static MCCFIInstruction createRememberState(MCSymbol *L)
.cfi_remember_state Save all current rules for all registers.
static MCCFIInstruction createLLVMDefAspaceCfa(MCSymbol *L, unsigned Register, int Offset, unsigned AddressSpace)
.cfi_llvm_def_aspace_cfa defines the rule for computing the CFA to be the result of evaluating the DW...
static MCCFIInstruction createWindowSave(MCSymbol *L)
.cfi_window_save SPARC register window is saved.
static MCCFIInstruction createRestoreState(MCSymbol *L)
.cfi_restore_state Restore the previously saved state.
static MCCFIInstruction createNegateRAState(MCSymbol *L)
.cfi_negate_ra_state AArch64 negate RA state.
static MCCFIInstruction createEscape(MCSymbol *L, StringRef Vals, StringRef Comment="")
.cfi_escape Allows the user to add arbitrary bytes to the unwind info.
static MCCFIInstruction createOffset(MCSymbol *L, unsigned Register, int Offset)
.cfi_offset Previous value of Register is saved at offset Offset from CFA.
static MCCFIInstruction createRelOffset(MCSymbol *L, unsigned Register, int Offset)
.cfi_rel_offset Previous value of Register is saved at offset Offset from the current CFA register.
static MCCFIInstruction createRegister(MCSymbol *L, unsigned Register1, unsigned Register2)
.cfi_register Previous value of Register1 is saved in register Register2.
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Context object for machine code objects.
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)
CodeViewContext & getCVContext()
const MCRegisterInfo * getRegisterInfo() const
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.
const MCAsmInfo * getAsmInfo() const
void reportError(SMLoc L, const Twine &Msg)
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
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.
const Triple & getTargetTriple() const
void setLabel(MCSymbol *Label)
MCSymbol * getLabel() const
Base class for the full range of assembler expressions which are needed for parsing.
@ Unary
Unary expressions.
@ Constant
Constant expressions.
@ SymbolRef
References to labels and assigned expressions.
@ Target
Target specific expression.
@ Binary
Binary expressions.
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.
unsigned getNumOperands() const
const MCOperand & getOperand(unsigned i) const
const MCExpr * getExpr() const
Instances of this class represent a pseudo probe instance for a pseudo probe table entry,...
int getSEHRegNum(MCRegister RegNum) const
Map a target register to an equivalent SEH register number.
Wrapper class representing physical registers. Should be passed by value.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Streaming machine code generation interface.
virtual void emitNops(int64_t NumBytes, int64_t ControlledNopLength, SMLoc Loc, const MCSubtargetInfo &STI)
virtual void emitAssignment(MCSymbol *Symbol, const MCExpr *Value)
Emit an assignment of Value to Symbol.
virtual void visitUsedSymbol(const MCSymbol &Sym)
void emitCFIStartProc(bool IsSimple, SMLoc Loc=SMLoc())
virtual bool emitCVFuncIdDirective(unsigned FunctionId)
Introduces a function id for use with .cv_loc.
virtual void finishImpl()
Streamer specific finalization.
void assignFragment(MCSymbol *Symbol, MCFragment *Fragment)
Sets the symbol's section.
virtual void emitDTPRel64Value(const MCExpr *Value)
Emit the expression Value into the output as a dtprel (64-bit DTP relative) value.
virtual void emitCFIDefCfaOffset(int64_t Offset)
virtual void emitCFIBKeyFrame()
void generateCompactUnwindEncodings(MCAsmBackend *MAB)
virtual void beginCOFFSymbolDef(const MCSymbol *Symbol)
Start emitting COFF symbol definition.
virtual void emitSyntaxDirective()
virtual void emitWinCFIPushReg(MCRegister Register, SMLoc Loc=SMLoc())
virtual void emitBinaryData(StringRef Data)
Functionally identical to EmitBytes.
virtual void initSections(bool NoExecStack, const MCSubtargetInfo &STI)
Create the default sections and set the initial one.
virtual MCSymbol * emitCFILabel()
When emitting an object file, create and emit a real label.
virtual void emitWindowsUnwindTables()
virtual raw_ostream & getCommentOS()
Return a raw_ostream that comments can be written to.
virtual void emitCFIGnuArgsSize(int64_t Size)
virtual void emitWinEHHandler(const MCSymbol *Sym, bool Unwind, bool Except, SMLoc Loc=SMLoc())
virtual void emitBundleLock(bool AlignToEnd)
The following instructions are a bundle-locked group.
MCSection * getAssociatedPDataSection(const MCSection *TextSec)
Get the .pdata section used for the given section.
bool hasUnfinishedDwarfFrameInfo()
virtual void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI)
Emit the given Instruction into the current section.
virtual void emitCFILLVMDefAspaceCfa(int64_t Register, int64_t Offset, int64_t AddressSpace)
virtual void emitGPRel64Value(const MCExpr *Value)
Emit the expression Value into the output as a gprel64 (64-bit GP relative) value.
virtual void emitCFIRegister(int64_t Register1, int64_t Register2)
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 emitCOFFSymbolIndex(MCSymbol const *Symbol)
Emits the symbol table index of a Symbol into the current section.
virtual void emitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator, StringRef FileName)
This implements the DWARF2 '.loc fileno lineno ...' assembler directive.
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 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.
void setTargetStreamer(MCTargetStreamer *TS)
virtual void emitWinCFISaveXMM(MCRegister Register, unsigned Offset, SMLoc Loc=SMLoc())
virtual void emitCFIStartProcImpl(MCDwarfFrameInfo &Frame)
virtual void emitXCOFFRefDirective(StringRef Sym)
Emit a XCOFF .ref directive which creates R_REF type entry in the relocation table for one or more sy...
virtual void emitGPRel32Value(const MCExpr *Value)
Emit the expression Value into the output as a gprel32 (32-bit GP relative) value.
virtual void emitCFILsda(const MCSymbol *Sym, unsigned Encoding)
virtual void emitCFIRememberState()
MCContext & getContext() const
SMLoc getStartTokLoc() const
virtual void emitBundleUnlock()
Ends a bundle-locked group.
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.
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 emitTPRel32Value(const MCExpr *Value)
Emit the expression Value into the output as a tprel (32-bit TP relative) value.
virtual void emitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset)
Emits a COFF section relative relocation.
MCSection * getAssociatedXDataSection(const MCSection *TextSec)
Get the .xdata section used for the given section.
virtual void emitCFIOffset(int64_t Register, int64_t Offset)
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.
bool checkCVLocSection(unsigned FuncId, unsigned FileNo, SMLoc Loc)
Returns true if the the .cv_loc directive is in the right section.
virtual void emitCFIWindowSave()
virtual void emitCFIRestoreState()
virtual void emitDwarfLineStartLabel(MCSymbol *StartSym)
Emit the debug line start label.
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 reset()
State management.
virtual void emitCVLinetableDirective(unsigned FunctionId, const MCSymbol *FnStart, const MCSymbol *FnEnd)
This implements the CodeView '.cv_linetable' assembler directive.
virtual void emitCFIRestore(int64_t Register)
virtual void emitTPRel64Value(const MCExpr *Value)
Emit the expression Value into the output as a tprel (64-bit TP relative) value.
virtual void emitCFISections(bool EH, bool Debug)
MCTargetStreamer * getTargetStreamer()
MCStreamer(MCContext &Ctx)
virtual void emitAssemblerFlag(MCAssemblerFlag Flag)
Note in the output the specified Flag.
virtual void emitDarwinTargetVariantBuildVersion(unsigned Platform, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion)
virtual void emitValueToAlignment(Align Alignment, int64_t Value=0, unsigned ValueSize=1, unsigned MaxBytesToEmit=0)
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
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 emitWinCFIEndChained(SMLoc Loc=SMLoc())
virtual void emitWinCFIEndProlog(SMLoc Loc=SMLoc())
virtual void emitWinCFIEndProc(SMLoc Loc=SMLoc())
void emitVersionForTarget(const Triple &Target, const VersionTuple &SDKVersion, const Triple *DarwinTargetVariantTriple, const VersionTuple &DarwinTargetVariantSDKVersion)
virtual void emitCodeAlignment(Align Alignment, const MCSubtargetInfo *STI, unsigned MaxBytesToEmit=0)
Emit nops until the byte alignment ByteAlignment is reached.
virtual void emitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame)
virtual void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue)
Set the DescValue for the Symbol.
virtual void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment)
Emit a local common (.lcomm) symbol.
virtual MCSymbol * getDwarfLineTableSymbol(unsigned CUID)
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 changeSection(MCSection *, const MCExpr *)
Update streamer for a new active section.
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 emitCFIUndefined(int64_t Register)
virtual void emitCGProfileEntry(const MCSymbolRefExpr *From, const MCSymbolRefExpr *To, uint64_t Count)
virtual void emitCFIDefCfaRegister(int64_t Register)
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 emitULEB128Value(const MCExpr *Value)
ArrayRef< MCDwarfFrameInfo > getDwarfFrameInfos() const
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, const MCExpr *Subsection=nullptr)
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 emitThumbFunc(MCSymbol *Func)
Note in the output that the specified Func is a Thumb mode function (ARM target only).
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)
virtual void emitWinCFISetFrame(MCRegister Register, unsigned Offset, SMLoc Loc=SMLoc())
virtual void emitCFINegateRAState()
void maybeEmitDwarf64Mark()
Emit a special value of 0xffffffff if producing 64-bit debugging info.
virtual void emitCFIAdjustCfaOffset(int64_t Adjustment)
virtual void emitDTPRel32Value(const MCExpr *Value)
Emit the expression Value into the output as a dtprel (32-bit DTP relative) value.
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 emitPseudoProbe(uint64_t Guid, uint64_t Index, uint64_t Type, uint64_t Attr, const MCPseudoProbeInlineStack &InlineStack, MCSymbol *FnSym)
Emit the a pseudo probe into the current section.
virtual void emitCFISameValue(int64_t Register)
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 emitELFSymverDirective(const MCSymbol *OriginalSym, StringRef Name, bool KeepOriginalSym)
Emit an ELF .symver directive.
MCSection * getCurrentSectionOnly() const
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.
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 emitCFIDefCfa(int64_t Register, int64_t Offset)
virtual void emitVersionMin(MCVersionMinType Type, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion)
Specify the Mach-O minimum deployment target version.
virtual void emitCOFFSymbolStorageClass(int StorageClass)
Emit the storage class of the symbol.
virtual void emitCFIRelOffset(int64_t Register, int64_t Offset)
virtual void emitConditionalAssignment(MCSymbol *Symbol, const MCExpr *Value)
Emit an assignment of Value to Symbol, but only if Value is also emitted.
virtual void emitWinCFIStartChained(SMLoc Loc=SMLoc())
virtual void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, Align ByteAlignment=Align(1))
Emit a thread local bss (.tbss) symbol.
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)
Set the bundle alignment mode from now on in the section.
virtual void emitRawTextImpl(StringRef String)
EmitRawText - If this file is backed by an assembly streamer, this dumps the specified string in the ...
virtual void emitCFIEscape(StringRef Values)
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.
Generic base class for all target subtargets.
Represent a reference to a symbol from inside an expression.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
bool isInSection() const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute).
Target specific streamer interface.
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 ~MCTargetStreamer()
virtual void emitAssignment(MCSymbol *Symbol, const MCExpr *Value)
virtual void emitRawBytes(StringRef Data)
Emit the bytes in Data into the output.
MCTargetStreamer(MCStreamer &S)
virtual void emitLabel(MCSymbol *Symbol)
virtual void changeSection(const MCSection *CurSection, MCSection *Section, const MCExpr *SubSection, raw_ostream &OS)
Update streamer for a new active section.
virtual void emitConstantPools()
Wrapper class representing virtual and physical registers.
Represents a location in source code.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringRef str() const
Explicit conversion to StringRef.
void push_back(const T &Elt)
pointer data()
Return a pointer to the vector's buffer, even if empty().
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
bool isMacOSX() const
Is this a Mac OS X triple.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
void print(raw_ostream &O, bool IsForDebug=false) const
Implement operator<< on Value.
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.
A raw_ostream that writes to an SmallVector or SmallString.
StringRef str() const
Return a StringRef for the vector contents.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ IMAGE_COMDAT_SELECT_ANY
@ C
The default llvm calling convention, compatible with C.
@ PLATFORM_WATCHOSSIMULATOR
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
uint8_t getDwarfOffsetByteSize(DwarfFormat Format)
The size of a reference determined by the DWARF 32/64-bit format.
@ DW_LENGTH_lo_reserved
Special values for an initial length field.
@ DW_LENGTH_DWARF64
Indicator of 64-bit DWARF format.
value_type byte_swap(value_type value, endianness endian)
static const bool IsLittleEndianHost
This is an optimization pass for GlobalISel generic memory operations.
void StoreIntToMemory(const APInt &IntVal, uint8_t *Dst, unsigned StoreBytes)
StoreIntToMemory - Fills the StoreBytes bytes of memory starting from Dst with the integer held in In...
bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
@ MCVM_WatchOSVersionMin
.watchos_version_min
@ MCVM_OSXVersionMin
.macosx_version_min
@ MCVM_TvOSVersionMin
.tvos_version_min
@ MCVM_IOSVersionMin
.ios_version_min
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
raw_ostream & nulls()
This returns a reference to a raw_ostream which simply discards output.
bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
std::pair< MCSection *, const MCExpr * > MCSectionSubPair
unsigned encodeSLEB128(int64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a SLEB128 value to an output stream.
unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)
Utility function to encode a ULEB128 value to an output stream.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Information describing a function or inlined call site introduced by .cv_func_id or ....
MCSection * Section
The section of the first .cv_loc directive used for this function, or null if none has been seen yet.
const MCSymbol * Personality
unsigned PersonalityEncoding
std::vector< MCCFIInstruction > Instructions
unsigned CurrentCfaRegister
static WinEH::Instruction SaveXMM(MCSymbol *L, unsigned Reg, unsigned Offset)
static WinEH::Instruction PushNonVol(MCSymbol *L, unsigned Reg)
static WinEH::Instruction PushMachFrame(MCSymbol *L, bool Code)
static WinEH::Instruction SaveNonVol(MCSymbol *L, unsigned Reg, unsigned Offset)
static WinEH::Instruction Alloc(MCSymbol *L, unsigned Size)
static WinEH::Instruction SetFPReg(MCSymbol *L, unsigned Reg, unsigned Off)
std::vector< Instruction > Instructions
const MCSymbol * Function
const MCSymbol * PrologEnd
const MCSymbol * FuncletOrFuncEnd
const FrameInfo * ChainedParent
const MCSymbol * ExceptionHandler