LLVM 22.0.0git
|
Streaming object file generation interface. More...
#include "llvm/MC/MCObjectStreamer.h"
Public Member Functions | |
void | reset () override |
state management | |
bool | isIntegratedAssemblerRequired () const override |
Object streamers require the integrated assembler. | |
void | emitFrames (MCAsmBackend *MAB) |
MCSymbol * | emitCFILabel () override |
When emitting an object file, create and emit a real label. | |
void | emitCFISections (bool EH, bool Debug, bool SFrame) override |
void | visitUsedSymbol (const MCSymbol &Sym) override |
MCAssembler & | getAssembler () |
MCAssembler * | getAssemblerPtr () override |
MCStreamer Interface | |
uint8_t * | getCurFragEnd () const |
MCFragment * | allocFragSpace (size_t Headroom) |
void | newFragment () |
template<typename FT , typename... Args> | |
FT * | newSpecialFragment (Args &&...args) |
void | ensureHeadroom (size_t Headroom) |
void | appendContents (ArrayRef< char > Contents) |
void | appendContents (size_t Num, uint8_t Elt) |
void | addFixup (const MCExpr *Value, MCFixupKind Kind) |
void | emitLabel (MCSymbol *Symbol, SMLoc Loc=SMLoc()) override |
Emit a label for Symbol into the current section. | |
virtual void | emitLabelAtPos (MCSymbol *Symbol, SMLoc Loc, MCFragment &F, uint64_t Offset) |
void | emitAssignment (MCSymbol *Symbol, const MCExpr *Value) override |
Emit an assignment of Value to Symbol . | |
void | emitConditionalAssignment (MCSymbol *Symbol, const MCExpr *Value) override |
Emit an assignment of Value to Symbol , but only if Value is also emitted. | |
void | emitValueImpl (const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc()) override |
Emit the expression Value into the output as a native integer of the given Size bytes. | |
void | emitULEB128Value (const MCExpr *Value) override |
void | emitSLEB128Value (const MCExpr *Value) override |
void | emitWeakReference (MCSymbol *Alias, const MCSymbol *Target) override |
Emit an weak reference from Alias to Symbol . | |
void | changeSection (MCSection *Section, uint32_t Subsection=0) override |
This is called by popSection and switchSection, if the current section changes. | |
void | emitInstruction (const MCInst &Inst, const MCSubtargetInfo &STI) override |
Emit the given Instruction into the current section. | |
void | emitInstToFragment (const MCInst &Inst, const MCSubtargetInfo &) |
Emit an instruction to a special fragment, because this instruction can change its size during relaxation. | |
void | emitBytes (StringRef Data) override |
Emit the bytes in Data into the output. | |
void | emitValueToAlignment (Align Alignment, int64_t Fill=0, uint8_t FillLen=1, unsigned MaxBytesToEmit=0) override |
Emit some number of copies of Value until the byte alignment ByteAlignment is reached. | |
void | emitCodeAlignment (Align ByteAlignment, const MCSubtargetInfo *STI, unsigned MaxBytesToEmit=0) override |
Emit nops until the byte alignment ByteAlignment is reached. | |
void | emitValueToOffset (const MCExpr *Offset, unsigned char Value, SMLoc Loc) override |
Emit some number of copies of Value until the byte offset Offset is reached. | |
void | emitDwarfLocDirective (unsigned FileNo, unsigned Line, unsigned Column, unsigned Flags, unsigned Isa, unsigned Discriminator, StringRef FileName, StringRef Comment={}) override |
This implements the DWARF2 '.loc fileno lineno ...' assembler directive. | |
void | emitDwarfAdvanceLineAddr (int64_t LineDelta, const MCSymbol *LastLabel, const MCSymbol *Label, unsigned PointerSize) override |
If targets does not support representing debug line section by .loc/.file directives in assembly output, we need to populate debug line section with raw debug line contents. | |
void | emitDwarfLineEndEntry (MCSection *Section, MCSymbol *LastLabel, MCSymbol *EndLabel=nullptr) override |
Emit the debug line end entry. | |
void | emitDwarfAdvanceFrameAddr (const MCSymbol *LastLabel, const MCSymbol *Label, SMLoc Loc) |
void | emitCVLocDirective (unsigned FunctionId, unsigned FileNo, unsigned Line, unsigned Column, bool PrologueEnd, bool IsStmt, StringRef FileName, SMLoc Loc) override |
This implements the CodeView '.cv_loc' assembler directive. | |
void | emitCVLinetableDirective (unsigned FunctionId, const MCSymbol *Begin, const MCSymbol *End) override |
This implements the CodeView '.cv_linetable' assembler directive. | |
void | emitCVInlineLinetableDirective (unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym) override |
This implements the CodeView '.cv_inline_linetable' assembler directive. | |
void | emitCVDefRangeDirective (ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion) override |
This implements the CodeView '.cv_def_range' assembler directive. | |
void | emitCVStringTableDirective () override |
This implements the CodeView '.cv_stringtable' assembler directive. | |
void | emitCVFileChecksumsDirective () override |
This implements the CodeView '.cv_filechecksums' assembler directive. | |
void | emitCVFileChecksumOffsetDirective (unsigned FileNo) override |
This implements the CodeView '.cv_filechecksumoffset' assembler directive. | |
void | emitRelocDirective (const MCExpr &Offset, StringRef Name, const MCExpr *Expr, SMLoc Loc={}) override |
Record a relocation described by the .reloc directive. | |
void | emitFill (const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc=SMLoc()) override |
Emit Size bytes worth of the value specified by FillValue . | |
void | emitFill (const MCExpr &NumValues, int64_t Size, int64_t Expr, SMLoc Loc=SMLoc()) override |
Emit NumValues copies of Size bytes. | |
void | emitNops (int64_t NumBytes, int64_t ControlledNopLength, SMLoc Loc, const MCSubtargetInfo &STI) override |
void | emitFileDirective (StringRef Filename) override |
Switch to a new logical file. | |
void | emitFileDirective (StringRef Filename, StringRef CompilerVersion, StringRef TimeStamp, StringRef Description) override |
Emit ".file assembler diretive with additioal info. | |
void | emitAddrsig () override |
void | emitAddrsigSym (const MCSymbol *Sym) override |
void | finishImpl () override |
Streamer specific finalization. | |
void | emitAbsoluteSymbolDiff (const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) override |
Emit the absolute difference between two symbols if possible. | |
void | emitAbsoluteSymbolDiffAsULEB128 (const MCSymbol *Hi, const MCSymbol *Lo) override |
Emit the absolute difference between two symbols encoded with ULEB128. | |
bool | mayHaveInstructions (MCSection &Sec) const override |
void | emitPendingAssignments (MCSymbol *Symbol) |
Emits pending conditional assignments that depend on Symbol being emitted. | |
void | emitFill (uint64_t NumBytes, uint8_t FillValue) |
Emit NumBytes bytes worth of the value specified by FillValue. | |
virtual void | emitFill (const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc=SMLoc()) |
Emit Size bytes worth of the value specified by FillValue . | |
virtual void | emitFill (const MCExpr &NumValues, int64_t Size, int64_t Expr, SMLoc Loc=SMLoc()) |
Emit NumValues copies of Size bytes. | |
![]() | |
MCStreamer (const MCStreamer &)=delete | |
MCStreamer & | operator= (const MCStreamer &)=delete |
virtual | ~MCStreamer () |
void | visitUsedExpr (const MCExpr &Expr) |
virtual void | visitUsedSymbol (const MCSymbol &Sym) |
void | setTargetStreamer (MCTargetStreamer *TS) |
void | setStartTokLocPtr (const SMLoc *Loc) |
SMLoc | getStartTokLoc () const |
virtual void | reset () |
State management. | |
MCContext & | getContext () const |
bool | isObj () const |
virtual MCAssembler * | getAssemblerPtr () |
void | setUseAssemblerInfoForParsing (bool v) |
bool | getUseAssemblerInfoForParsing () |
MCTargetStreamer * | getTargetStreamer () |
void | setAllowAutoPadding (bool v) |
bool | getAllowAutoPadding () const |
MCSymbol * | emitLineTableLabel () |
virtual MCSymbol * | emitCFILabel () |
When emitting an object file, create and emit a real label. | |
WinEH::FrameInfo * | EnsureValidWinFrameInfo (SMLoc Loc) |
Retrieve the current frame info if one is available and it is not yet closed. | |
unsigned | getNumFrameInfos () |
ArrayRef< MCDwarfFrameInfo > | getDwarfFrameInfos () const |
bool | hasUnfinishedDwarfFrameInfo () |
unsigned | getNumWinFrameInfos () |
ArrayRef< std::unique_ptr< WinEH::FrameInfo > > | getWinFrameInfos () const |
WinEH::FrameInfo::Epilog * | getCurrentWinEpilog () const |
bool | isInEpilogCFI () const |
void | generateCompactUnwindEncodings (MCAsmBackend *MAB) |
virtual void | emitFileDirective (StringRef Filename) |
Switch to a new logical file. | |
virtual void | emitFileDirective (StringRef Filename, StringRef CompilerVersion, StringRef TimeStamp, StringRef Description) |
Emit ".file assembler diretive with additioal info. | |
virtual void | emitIdent (StringRef IdentString) |
Emit the "identifiers" directive. | |
unsigned | emitDwarfFileDirective (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 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 | 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 | emitCFIBKeyFrame () |
virtual void | emitCFIMTETaggedFrame () |
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 | emitDwarfLocLabelDirective (SMLoc Loc, StringRef Name) |
This implements the '.loc_label Name' directive. | |
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 information. | |
virtual bool | emitCVFuncIdDirective (unsigned FunctionId) |
Introduces a function id for use with .cv_loc. | |
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 | 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 | emitCVLinetableDirective (unsigned FunctionId, const MCSymbol *FnStart, const MCSymbol *FnEnd) |
This implements the CodeView '.cv_linetable' assembler directive. | |
virtual void | emitCVInlineLinetableDirective (unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym) |
This implements the CodeView '.cv_inline_linetable' assembler directive. | |
virtual void | emitCVDefRangeDirective (ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion) |
This implements the CodeView '.cv_def_range' assembler directive. | |
virtual void | emitCVDefRangeDirective (ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, codeview::DefRangeRegisterRelHeader DRHdr) |
virtual void | emitCVDefRangeDirective (ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, codeview::DefRangeSubfieldRegisterHeader DRHdr) |
virtual void | emitCVDefRangeDirective (ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, codeview::DefRangeRegisterHeader DRHdr) |
virtual void | emitCVDefRangeDirective (ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, codeview::DefRangeFramePointerRelHeader DRHdr) |
virtual void | emitCVStringTableDirective () |
This implements the CodeView '.cv_stringtable' assembler directive. | |
virtual void | emitCVFileChecksumsDirective () |
This implements the CodeView '.cv_filechecksums' assembler directive. | |
virtual void | emitCVFileChecksumOffsetDirective (unsigned FileNo) |
This implements the CodeView '.cv_filechecksumoffset' assembler directive. | |
virtual void | emitCVFPOData (const MCSymbol *ProcSym, SMLoc Loc={}) |
This implements the CodeView '.cv_fpo_data' assembler directive. | |
virtual void | emitAbsoluteSymbolDiff (const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) |
Emit the absolute difference between two symbols. | |
virtual void | emitAbsoluteSymbolDiffAsULEB128 (const MCSymbol *Hi, const MCSymbol *Lo) |
Emit the absolute difference between two symbols encoded with ULEB128. | |
virtual MCSymbol * | getDwarfLineTableSymbol (unsigned CUID) |
virtual void | emitCFISections (bool EH, bool Debug, bool SFrame) |
void | emitCFIStartProc (bool IsSimple, SMLoc Loc=SMLoc()) |
void | emitCFIEndProc () |
virtual void | emitCFIDefCfa (int64_t Register, int64_t Offset, SMLoc Loc={}) |
virtual void | emitCFIDefCfaOffset (int64_t Offset, SMLoc Loc={}) |
virtual void | emitCFIDefCfaRegister (int64_t Register, SMLoc Loc={}) |
virtual void | emitCFILLVMDefAspaceCfa (int64_t Register, int64_t Offset, int64_t AddressSpace, SMLoc Loc={}) |
virtual void | emitCFIOffset (int64_t Register, int64_t Offset, SMLoc Loc={}) |
virtual void | emitCFIPersonality (const MCSymbol *Sym, unsigned Encoding) |
virtual void | emitCFILsda (const MCSymbol *Sym, unsigned Encoding) |
virtual void | emitCFIRememberState (SMLoc Loc) |
virtual void | emitCFIRestoreState (SMLoc Loc) |
virtual void | emitCFISameValue (int64_t Register, SMLoc Loc={}) |
virtual void | emitCFIRestore (int64_t Register, SMLoc Loc={}) |
virtual void | emitCFIRelOffset (int64_t Register, int64_t Offset, SMLoc Loc) |
virtual void | emitCFIAdjustCfaOffset (int64_t Adjustment, SMLoc Loc={}) |
virtual void | emitCFIEscape (StringRef Values, SMLoc Loc={}) |
virtual void | emitCFIReturnColumn (int64_t Register) |
virtual void | emitCFIGnuArgsSize (int64_t Size, SMLoc Loc={}) |
virtual void | emitCFISignalFrame () |
virtual void | emitCFIUndefined (int64_t Register, SMLoc Loc={}) |
virtual void | emitCFIRegister (int64_t Register1, int64_t Register2, SMLoc Loc={}) |
virtual void | emitCFIWindowSave (SMLoc Loc={}) |
virtual void | emitCFINegateRAState (SMLoc Loc={}) |
virtual void | emitCFINegateRAStateWithPC (SMLoc Loc={}) |
virtual void | emitCFILabelDirective (SMLoc Loc, StringRef Name) |
virtual void | emitCFIValOffset (int64_t Register, int64_t Offset, SMLoc Loc={}) |
virtual void | emitWinCFIStartProc (const MCSymbol *Symbol, SMLoc Loc=SMLoc()) |
virtual void | emitWinCFIEndProc (SMLoc Loc=SMLoc()) |
virtual void | emitWinCFIFuncletOrFuncEnd (SMLoc Loc=SMLoc()) |
This is used on platforms, such as Windows on ARM64, that require function or funclet sizes to be emitted in .xdata before the End marker is emitted for the frame. | |
virtual void | emitWinCFIStartChained (SMLoc Loc=SMLoc()) |
virtual void | emitWinCFIEndChained (SMLoc Loc=SMLoc()) |
virtual void | emitWinCFIPushReg (MCRegister Register, SMLoc Loc=SMLoc()) |
virtual void | emitWinCFISetFrame (MCRegister Register, unsigned Offset, SMLoc Loc=SMLoc()) |
virtual void | emitWinCFIAllocStack (unsigned Size, SMLoc Loc=SMLoc()) |
virtual void | emitWinCFISaveReg (MCRegister Register, unsigned Offset, SMLoc Loc=SMLoc()) |
virtual void | emitWinCFISaveXMM (MCRegister Register, unsigned Offset, SMLoc Loc=SMLoc()) |
virtual void | emitWinCFIPushFrame (bool Code, SMLoc Loc=SMLoc()) |
virtual void | emitWinCFIEndProlog (SMLoc Loc=SMLoc()) |
virtual void | emitWinCFIBeginEpilogue (SMLoc Loc=SMLoc()) |
virtual void | emitWinCFIEndEpilogue (SMLoc Loc=SMLoc()) |
virtual void | emitWinCFIUnwindV2Start (SMLoc Loc=SMLoc()) |
virtual void | emitWinCFIUnwindVersion (uint8_t Version, SMLoc Loc=SMLoc()) |
virtual void | emitWinEHHandler (const MCSymbol *Sym, bool Unwind, bool Except, SMLoc Loc=SMLoc()) |
virtual void | emitWinEHHandlerData (SMLoc Loc=SMLoc()) |
virtual void | emitCGProfileEntry (const MCSymbolRefExpr *From, const MCSymbolRefExpr *To, uint64_t Count) |
MCSection * | getAssociatedPDataSection (const MCSection *TextSec) |
Get the .pdata section used for the given section. | |
MCSection * | getAssociatedXDataSection (const MCSection *TextSec) |
Get the .xdata section used for the given section. | |
virtual void | emitSyntaxDirective () |
virtual void | emitRelocDirective (const MCExpr &Offset, StringRef Name, const MCExpr *Expr, SMLoc Loc={}) |
Record a relocation described by the .reloc directive. | |
virtual void | emitAddrsig () |
virtual void | emitAddrsigSym (const MCSymbol *Sym) |
virtual void | emitInstruction (const MCInst &Inst, const MCSubtargetInfo &STI) |
Emit the given Instruction into the current section. | |
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 | emitRawText (const Twine &String) |
If this file is backed by a assembly streamer, this dumps the specified string in the output .s file. | |
virtual void | finishImpl () |
Streamer specific finalization. | |
void | finish (SMLoc EndLoc=SMLoc()) |
Finish emission of machine code. | |
virtual bool | mayHaveInstructions (MCSection &Sec) const |
void | maybeEmitDwarf64Mark () |
Emit a special value of 0xffffffff if producing 64-bit debugging info. | |
virtual void | emitDwarfUnitLength (uint64_t Length, const Twine &Comment) |
Emit a unit length field. | |
virtual MCSymbol * | emitDwarfUnitLength (const Twine &Prefix, const Twine &Comment) |
Emit a unit length field. | |
virtual void | emitDwarfLineStartLabel (MCSymbol *StartSym) |
Emit the debug line start label. | |
virtual void | emitDwarfLineEndEntry (MCSection *Section, MCSymbol *LastLabel, MCSymbol *EndLabel=nullptr) |
Emit the debug line end entry. | |
virtual void | emitDwarfAdvanceLineAddr (int64_t LineDelta, const MCSymbol *LastLabel, const MCSymbol *Label, unsigned PointerSize) |
If targets does not support representing debug line section by .loc/.file directives in assembly output, we need to populate debug line section with raw debug line contents. | |
virtual bool | isVerboseAsm () const |
Return true if this streamer supports verbose assembly and if it is enabled. | |
virtual bool | hasRawTextSupport () const |
Return true if this asm streamer supports emitting unformatted text to the .s file with EmitRawText. | |
virtual void | AddComment (const Twine &T, bool EOL=true) |
Add a textual comment. | |
virtual raw_ostream & | getCommentOS () |
Return a raw_ostream that comments can be written to. | |
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 | addExplicitComment (const Twine &T) |
Add explicit comment T. | |
virtual void | emitExplicitComments () |
Emit added explicit comments. | |
virtual void | addBlankLine () |
Emit a blank line to a .s file to pretty it up. | |
MCSectionSubPair | getCurrentSection () const |
Return the current section that the streamer is emitting code to. | |
MCSection * | getCurrentSectionOnly () const |
MCSectionSubPair | getPreviousSection () const |
Return the previous section that the streamer is emitting code to. | |
MCFragment * | getCurrentFragment () const |
size_t | getCurFragSize () const |
void | pushSection () |
Save the current and previous section on the section stack. | |
virtual bool | popSection () |
Restore the current and previous section from the section stack. | |
virtual void | switchSection (MCSection *Section, uint32_t Subsec=0) |
Set the current section where code is being emitted to Section . | |
bool | switchSection (MCSection *Section, const MCExpr *) |
void | switchSectionNoPrint (MCSection *Section) |
Similar to switchSection, but does not print the section directive. | |
virtual void | initSections (bool NoExecStack, const MCSubtargetInfo &STI) |
Create the default sections and set the initial one. | |
MCSymbol * | endSection (MCSection *Section) |
virtual StringRef | getMnemonic (const MCInst &MI) const |
Returns the mnemonic for MI , if the streamer has access to a instruction printer and returns an empty string otherwise. | |
virtual void | emitEHSymAttributes (const MCSymbol *Symbol, MCSymbol *EHSymbol) |
virtual void | emitSubsectionsViaSymbols () |
Emit a .subsection_via_symbols directive. | |
virtual void | emitLinkerOptions (ArrayRef< std::string > Kind) |
Emit the given list Options of strings as linker options into the output. | |
virtual void | emitDataRegion (MCDataRegionType Kind) |
Note in the output the specified region Kind . | |
virtual void | emitVersionMin (MCVersionMinType Type, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion) |
Specify the Mach-O minimum deployment target version. | |
virtual void | emitBuildVersion (unsigned Platform, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion) |
Emit/Specify Mach-O build version command. | |
virtual void | emitDarwinTargetVariantBuildVersion (unsigned Platform, unsigned Major, unsigned Minor, unsigned Update, VersionTuple SDKVersion) |
void | emitVersionForTarget (const Triple &Target, const VersionTuple &SDKVersion, const Triple *DarwinTargetVariantTriple, const VersionTuple &DarwinTargetVariantSDKVersion) |
virtual bool | emitSymbolAttribute (MCSymbol *Symbol, MCSymbolAttr Attribute)=0 |
Add the given Attribute to Symbol . | |
virtual void | emitSymbolDesc (MCSymbol *Symbol, unsigned DescValue) |
Set the DescValue for the Symbol . | |
virtual void | beginCOFFSymbolDef (const MCSymbol *Symbol) |
Start emitting COFF symbol definition. | |
virtual void | emitCOFFSymbolStorageClass (int StorageClass) |
Emit the storage class of the symbol. | |
virtual void | emitCOFFSymbolType (int Type) |
Emit the type of the symbol. | |
virtual void | endCOFFSymbolDef () |
Marks the end of the symbol definition. | |
virtual void | emitCOFFSafeSEH (MCSymbol const *Symbol) |
virtual void | emitCOFFSymbolIndex (MCSymbol const *Symbol) |
Emits the symbol table index of a Symbol into the current section. | |
virtual void | emitCOFFSectionIndex (MCSymbol const *Symbol) |
Emits a COFF section index. | |
virtual void | emitCOFFSecRel32 (MCSymbol const *Symbol, uint64_t Offset) |
Emits a COFF section relative relocation. | |
virtual void | emitCOFFImgRel32 (MCSymbol const *Symbol, int64_t Offset) |
Emits a COFF image relative relocation. | |
virtual void | emitCOFFSecNumber (MCSymbol const *Symbol) |
Emits the physical number of the section containing the given symbol as assigned during object writing (i.e., this is not a runtime relocation). | |
virtual void | emitCOFFSecOffset (MCSymbol const *Symbol) |
Emits the offset of the symbol from the beginning of the section during object writing (i.e., this is not a runtime relocation). | |
virtual void | emitXCOFFLocalCommonSymbol (MCSymbol *LabelSym, uint64_t Size, MCSymbol *CsectSym, Align Alignment) |
Emits an lcomm directive with XCOFF csect information. | |
virtual void | emitXCOFFSymbolLinkageWithVisibility (MCSymbol *Symbol, MCSymbolAttr Linkage, MCSymbolAttr Visibility) |
Emit a symbol's linkage and visibility with a linkage directive for XCOFF. | |
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 | 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 exception section. | |
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 symbols. | |
virtual void | emitXCOFFCInfoSym (StringRef Name, StringRef Metadata) |
Emit a C_INFO symbol with XCOFF embedded metadata to the .info section. | |
virtual void | emitELFSize (MCSymbol *Symbol, const MCExpr *Value) |
Emit an ELF .size directive. | |
virtual void | emitELFSymverDirective (const MCSymbol *OriginalSym, StringRef Name, bool KeepOriginalSym) |
Emit an ELF .symver directive. | |
virtual void | emitLOHDirective (MCLOHType Kind, const MCLOHArgs &Args) |
Emit a Linker Optimization Hint (LOH) directive. | |
virtual void | emitGNUAttribute (unsigned Tag, unsigned Value) |
Emit a .gnu_attribute directive. | |
virtual void | emitCommonSymbol (MCSymbol *Symbol, uint64_t Size, Align ByteAlignment)=0 |
Emit a common symbol. | |
virtual void | emitLocalCommonSymbol (MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) |
Emit a local common (.lcomm) symbol. | |
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 | emitTBSSSymbol (MCSection *Section, MCSymbol *Symbol, uint64_t Size, Align ByteAlignment=Align(1)) |
Emit a thread local bss (.tbss) symbol. | |
virtual void | emitBinaryData (StringRef Data) |
Functionally identical to EmitBytes. | |
void | emitValue (const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc()) |
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. | |
virtual void | emitIntValue (const APInt &Value) |
virtual void | emitIntValueInHex (uint64_t Value, unsigned Size) |
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers & prints in Hex format for certain modes. | |
void | emitInt8 (uint64_t Value) |
void | emitInt16 (uint64_t Value) |
void | emitInt32 (uint64_t Value) |
void | emitInt64 (uint64_t Value) |
virtual void | emitIntValueInHexWithPadding (uint64_t Value, unsigned Size) |
Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers & prints in Hex format for certain modes, pads the field with leading zeros to Size width. | |
unsigned | emitULEB128IntValue (uint64_t Value, unsigned PadTo=0) |
Special case of EmitULEB128Value that avoids the client having to pass in a MCExpr for constant integers. | |
unsigned | emitSLEB128IntValue (int64_t Value) |
Special case of EmitSLEB128Value that avoids the client having to pass in a MCExpr for constant integers. | |
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. | |
void | emitFill (uint64_t NumBytes, uint8_t FillValue) |
Emit NumBytes bytes worth of the value specified by FillValue. | |
void | emitZeros (uint64_t NumBytes) |
Emit NumBytes worth of zeros. | |
Protected Member Functions | |
MCObjectStreamer (MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter) | |
~MCObjectStreamer () | |
![]() | |
MCStreamer (MCContext &Ctx) | |
virtual void | changeSection (MCSection *, uint32_t) |
This is called by popSection and switchSection, if the current section changes. | |
void | addFragment (MCFragment *F) |
virtual void | emitCFIStartProcImpl (MCDwarfFrameInfo &Frame) |
virtual void | emitCFIEndProcImpl (MCDwarfFrameInfo &CurFrame) |
WinEH::FrameInfo * | getCurrentWinFrameInfo () |
virtual void | emitWindowsUnwindTables (WinEH::FrameInfo *Frame) |
virtual void | emitWindowsUnwindTables () |
virtual void | emitRawTextImpl (StringRef String) |
EmitRawText - If this file is backed by an assembly streamer, this dumps the specified string in the output .s file. | |
bool | checkCVLocSection (unsigned FuncId, unsigned FileNo, SMLoc Loc) |
Returns true if the .cv_loc directive is in the right section. | |
Additional Inherited Members | |
![]() | |
bool | IsObj = false |
WinEH::FrameInfo::Epilog * | CurrentWinEpilog = nullptr |
MCFragment * | CurFrag = nullptr |
Streaming object file generation interface.
This class provides an implementation of the MCStreamer interface which is suitable for use with the assembler backend. Specific object file formats are expected to subclass this interface to implement directives specific to that file format or custom semantics expected by the object writer implementation.
Definition at line 39 of file MCObjectStreamer.h.
|
protected |
Definition at line 27 of file MCObjectStreamer.cpp.
References assert(), Context, llvm::MCStreamer::IsObj, and llvm::MCStreamer::setAllowAutoPadding().
|
protecteddefault |
void MCObjectStreamer::addFixup | ( | const MCExpr * | Value, |
MCFixupKind | Kind | ||
) |
Definition at line 125 of file MCObjectStreamer.cpp.
References llvm::MCFragment::addFixup(), llvm::MCFixup::create(), llvm::MCStreamer::CurFrag, and llvm::MCStreamer::getCurFragSize().
Referenced by llvm::MCWinCOFFStreamer::emitCOFFImgRel32(), llvm::MCWinCOFFStreamer::emitCOFFSecNumber(), llvm::MCWinCOFFStreamer::emitCOFFSecOffset(), llvm::MCWinCOFFStreamer::emitCOFFSecRel32(), llvm::MCWinCOFFStreamer::emitCOFFSectionIndex(), emitValueImpl(), and llvm::MCXCOFFStreamer::emitXCOFFRefDirective().
MCFragment * MCObjectStreamer::allocFragSpace | ( | size_t | Headroom | ) |
Definition at line 57 of file MCObjectStreamer.cpp.
References llvm::Block, F, FragBlockSize, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and Size.
Referenced by changeSection(), ensureHeadroom(), and newFragment().
Definition at line 109 of file MCObjectStreamer.cpp.
References assert(), llvm::copy(), llvm::MCStreamer::CurFrag, ensureHeadroom(), getCurFragEnd(), and llvm::ArrayRef< T >::size().
Referenced by emitBytes(), llvm::MCWinCOFFStreamer::emitCOFFImgRel32(), llvm::MCWinCOFFStreamer::emitCOFFSecNumber(), llvm::MCWinCOFFStreamer::emitCOFFSecOffset(), llvm::MCWinCOFFStreamer::emitCOFFSecRel32(), llvm::MCWinCOFFStreamer::emitCOFFSectionIndex(), and emitValueImpl().
void MCObjectStreamer::appendContents | ( | size_t | Num, |
uint8_t | Elt | ||
) |
Definition at line 117 of file MCObjectStreamer.cpp.
References llvm::MCStreamer::CurFrag, llvm::Data, ensureHeadroom(), llvm::fill(), and getCurFragEnd().
This is called by popSection and switchSection, if the current section changes.
Reimplemented from llvm::MCStreamer.
Reimplemented in llvm::MCWasmStreamer, llvm::RISCVELFStreamer, llvm::MCWinCOFFStreamer, and llvm::MCXCOFFStreamer.
Definition at line 313 of file MCObjectStreamer.cpp.
References llvm::MCStreamer::addFragment(), llvm::alignToPowerOf2(), allocFragSpace(), assert(), changeSection(), llvm::MCContext::clearDwarfLocSeen(), llvm::MCStreamer::CurFrag, End, F, getAssembler(), llvm::MCStreamer::getContext(), getCurFragEnd(), I, LLVM_LIKELY, NewFragHeadroom, llvm::MCAssembler::registerSection(), llvm::MCAssembler::registerSymbol(), and Sym.
Referenced by llvm::MCWasmStreamer::changeSection(), llvm::MCELFStreamer::changeSection(), llvm::MCGOFFStreamer::changeSection(), changeSection(), llvm::MCWinCOFFStreamer::changeSection(), and llvm::MCXCOFFStreamer::changeSection().
|
overridevirtual |
Emit the absolute difference between two symbols if possible.
Emit the absolute difference between Hi
and Lo
, as long as we can compute it. Currently, that requires that both symbols are in the same data fragment and that the target has not specified that diff expressions require relocations to be emitted. Otherwise, do nothing and return false
.
Hi
is greater than the offset Lo
. Reimplemented from llvm::MCStreamer.
Definition at line 150 of file MCObjectStreamer.cpp.
References absoluteSymbolDiff(), llvm::MCStreamer::emitAbsoluteSymbolDiff(), llvm::MCStreamer::emitIntValue(), llvm::Hi, llvm::Lo, and Size.
|
overridevirtual |
Emit the absolute difference between two symbols encoded with ULEB128.
Reimplemented from llvm::MCStreamer.
Definition at line 159 of file MCObjectStreamer.cpp.
References absoluteSymbolDiff(), llvm::MCStreamer::emitAbsoluteSymbolDiffAsULEB128(), llvm::MCStreamer::emitULEB128IntValue(), llvm::Hi, and llvm::Lo.
|
overridevirtual |
Reimplemented from llvm::MCStreamer.
Definition at line 755 of file MCObjectStreamer.cpp.
References llvm::MCObjectWriter::emitAddrsigSection(), getAssembler(), and llvm::MCAssembler::getWriter().
Reimplemented from llvm::MCStreamer.
Definition at line 759 of file MCObjectStreamer.cpp.
References llvm::MCObjectWriter::addAddrsigSymbol(), getAssembler(), llvm::MCAssembler::getWriter(), and Sym.
Emit an assignment of Value
to Symbol
.
This corresponds to an assembler statement such as: symbol = value
The assignment generates no code, but has the side effect of binding the value in the current context. For the assembly streamer, this prints the binding into the .s file.
Symbol | - The symbol being assigned to. |
Value | - The value for the symbol. |
Reimplemented from llvm::MCStreamer.
Definition at line 368 of file MCObjectStreamer.cpp.
References llvm::MCStreamer::emitAssignment(), emitPendingAssignments(), getAssembler(), and llvm::MCAssembler::registerSymbol().
Referenced by emitConditionalAssignment(), and emitPendingAssignments().
|
overridevirtual |
Emit the bytes in Data
into the output.
This is used to implement assembler directives such as .byte, .ascii, etc.
Reimplemented from llvm::MCStreamer.
Reimplemented in llvm::CSKYELFStreamer, and llvm::RISCVELFStreamer.
Definition at line 640 of file MCObjectStreamer.cpp.
References appendContents(), llvm::Data, llvm::MCStreamer::getCurrentSectionOnly(), and llvm::MCDwarfLineEntry::make().
Referenced by llvm::CSKYELFStreamer::emitBytes(), llvm::RISCVELFStreamer::emitBytes(), llvm::MCWinCOFFStreamer::emitCommonSymbol(), emitDwarfAdvanceLineAddr(), and llvm::MCELFStreamer::emitIdent().
|
overridevirtual |
When emitting an object file, create and emit a real label.
When emitting textual assembly, this should do nothing to avoid polluting our output.
Reimplemented from llvm::MCStreamer.
Reimplemented in llvm::MipsELFStreamer.
Definition at line 229 of file MCObjectStreamer.cpp.
References llvm::MCContext::createTempSymbol(), emitLabel(), and llvm::MCStreamer::getContext().
Reimplemented from llvm::MCStreamer.
Definition at line 200 of file MCObjectStreamer.cpp.
References Debug, and llvm::MCStreamer::emitCFISections().
|
overridevirtual |
Emit nops until the byte alignment ByteAlignment
is reached.
This used to align code where the alignment bytes may be executed. This can emit different bytes for different sizes to optimize execution.
Alignment | - The alignment to reach. |
STI | - The MCSubtargetInfo in operation when padding is emitted. |
MaxBytesToEmit | - The maximum numbers of bytes to emit, or 0. If the alignment cannot be reached in this many bytes, no bytes are emitted. |
Reimplemented from llvm::MCStreamer.
Definition at line 658 of file MCObjectStreamer.cpp.
References emitValueToAlignment(), F, and llvm::MCStreamer::getCurrentFragment().
Referenced by llvm::MipsTargetELFStreamer::finish(), llvm::MCELFStreamer::initSections(), and llvm::MCWinCOFFStreamer::initSections().
|
overridevirtual |
Emit an assignment of Value
to Symbol
, but only if Value
is also emitted.
Reimplemented from llvm::MCStreamer.
Definition at line 374 of file MCObjectStreamer.cpp.
References emitAssignment().
|
overridevirtual |
This implements the CodeView '.cv_def_range' assembler directive.
Reimplemented from llvm::MCStreamer.
Definition at line 620 of file MCObjectStreamer.cpp.
References llvm::MCStreamer::emitCVDefRangeDirective(), llvm::CodeViewContext::emitDefRange(), llvm::MCStreamer::getContext(), and llvm::MCContext::getCVContext().
|
overridevirtual |
This implements the CodeView '.cv_filechecksumoffset' assembler directive.
Reimplemented from llvm::MCStreamer.
Definition at line 636 of file MCObjectStreamer.cpp.
References llvm::CodeViewContext::emitFileChecksumOffset(), llvm::MCStreamer::getContext(), and llvm::MCContext::getCVContext().
|
overridevirtual |
This implements the CodeView '.cv_filechecksums' assembler directive.
Reimplemented from llvm::MCStreamer.
Definition at line 632 of file MCObjectStreamer.cpp.
References llvm::CodeViewContext::emitFileChecksums(), llvm::MCStreamer::getContext(), and llvm::MCContext::getCVContext().
|
overridevirtual |
This implements the CodeView '.cv_inline_linetable' assembler directive.
Reimplemented from llvm::MCStreamer.
Definition at line 610 of file MCObjectStreamer.cpp.
References llvm::MCStreamer::emitCVInlineLinetableDirective(), llvm::CodeViewContext::emitInlineLineTableForFunction(), llvm::MCStreamer::getContext(), and llvm::MCContext::getCVContext().
|
overridevirtual |
This implements the CodeView '.cv_linetable' assembler directive.
Reimplemented from llvm::MCStreamer.
Definition at line 602 of file MCObjectStreamer.cpp.
References llvm::MCStreamer::emitCVLinetableDirective(), llvm::CodeViewContext::emitLineTableForFunction(), End, llvm::MCStreamer::getContext(), and llvm::MCContext::getCVContext().
|
overridevirtual |
This implements the CodeView '.cv_loc' assembler directive.
Reimplemented from llvm::MCStreamer.
Definition at line 586 of file MCObjectStreamer.cpp.
References llvm::MCStreamer::checkCVLocSection(), llvm::MCContext::createTempSymbol(), emitLabel(), llvm::MCStreamer::getContext(), llvm::MCContext::getCVContext(), and llvm::CodeViewContext::recordCVLoc().
|
overridevirtual |
This implements the CodeView '.cv_stringtable' assembler directive.
Reimplemented from llvm::MCStreamer.
Definition at line 629 of file MCObjectStreamer.cpp.
References llvm::CodeViewContext::emitStringTable(), llvm::MCStreamer::getContext(), and llvm::MCContext::getCVContext().
void MCObjectStreamer::emitDwarfAdvanceFrameAddr | ( | const MCSymbol * | LastLabel, |
const MCSymbol * | Label, | ||
SMLoc | Loc | ||
) |
Definition at line 577 of file MCObjectStreamer.cpp.
References buildSymbolDiff(), F, llvm::MCFragment::FT_DwarfFrame, llvm::MCStreamer::getCurrentFragment(), and newFragment().
|
overridevirtual |
If targets does not support representing debug line section by .loc/.file directives in assembly output, we need to populate debug line section with raw debug line contents.
Reimplemented from llvm::MCStreamer.
Definition at line 527 of file MCObjectStreamer.cpp.
References absoluteSymbolDiff(), buildSymbolDiff(), emitBytes(), emitDwarfSetLineAddr(), llvm::MCDwarfLineAddr::encode(), F, llvm::MCFragment::FT_Dwarf, llvm::MCStreamer::getContext(), llvm::MCStreamer::getCurrentFragment(), and newFragment().
Referenced by emitDwarfLineEndEntry().
|
overridevirtual |
Emit the debug line end entry.
Reimplemented from llvm::MCStreamer.
Definition at line 555 of file MCObjectStreamer.cpp.
References emitDwarfAdvanceLineAddr(), llvm::MCStreamer::endSection(), llvm::MCContext::getAsmInfo(), llvm::MCAsmInfo::getCodePointerSize(), llvm::MCStreamer::getContext(), llvm::MCObjectFileInfo::getDwarfLineSection(), llvm::MCContext::getObjectFileInfo(), INT64_MAX, and llvm::MCStreamer::switchSection().
|
overridevirtual |
This implements the DWARF2 '.loc fileno lineno ...' assembler directive.
Reimplemented from llvm::MCStreamer.
Definition at line 489 of file MCObjectStreamer.cpp.
References llvm::MCStreamer::emitDwarfLocDirective(), llvm::MCStreamer::getCurrentSectionOnly(), and llvm::MCDwarfLineEntry::make().
|
overridevirtual |
Switch to a new logical file.
This is used to implement the '.file "foo.c"' assembler directive.
Reimplemented from llvm::MCStreamer.
Definition at line 738 of file MCObjectStreamer.cpp.
References getAssembler().
|
overridevirtual |
Emit ".file assembler diretive with additioal info.
Reimplemented from llvm::MCStreamer.
Definition at line 743 of file MCObjectStreamer.cpp.
References getAssembler(), llvm::MCAssembler::getWriter(), and llvm::StringRef::size().
|
virtual |
Emit Size
bytes worth of the value specified by FillValue
.
This is used to implement assembler directives such as .space or .skip.
NumBytes | - The number of bytes to emit. |
FillValue | - The value to use when filling bytes. |
Loc | - The location of the expression for error reporting. |
Reimplemented from llvm::MCStreamer.
Definition at line 788 of file MCStreamer.cpp.
|
overridevirtual |
Emit Size
bytes worth of the value specified by FillValue
.
This is used to implement assembler directives such as .space or .skip.
NumBytes | - The number of bytes to emit. |
FillValue | - The value to use when filling bytes. |
Loc | - The location of the expression for error reporting. |
Reimplemented from llvm::MCStreamer.
Reimplemented in llvm::CSKYELFStreamer, and llvm::RISCVELFStreamer.
Definition at line 699 of file MCObjectStreamer.cpp.
References assert(), and llvm::MCStreamer::getCurrentSectionOnly().
Referenced by llvm::CSKYELFStreamer::emitFill(), and llvm::RISCVELFStreamer::emitFill().
|
virtual |
Emit NumValues
copies of Size
bytes.
Each Size
bytes is taken from the lowest order 4 bytes of Expr
expression.
This is used to implement assembler directives such as .fill.
NumValues | - The number of copies of Size bytes to emit. |
Size | - The size (in bytes) of each repeated value. |
Expr | - The expression from which Size bytes are used. |
Reimplemented from llvm::MCStreamer.
Definition at line 799 of file MCStreamer.cpp.
|
overridevirtual |
Emit NumValues
copies of Size
bytes.
Each Size
bytes is taken from the lowest order 4 bytes of Expr
expression.
This is used to implement assembler directives such as .fill.
NumValues | - The number of copies of Size bytes to emit. |
Size | - The size (in bytes) of each repeated value. |
Expr | - The expression from which Size bytes are used. |
Reimplemented from llvm::MCStreamer.
Definition at line 705 of file MCObjectStreamer.cpp.
References assert(), llvm::SourceMgr::DK_Warning, llvm::MCStreamer::emitIntValue(), getAssembler(), llvm::MCStreamer::getContext(), llvm::MCStreamer::getCurrentSectionOnly(), llvm::MCContext::getSourceManager(), llvm::SourceMgr::PrintMessage(), and Size.
Emit NumBytes bytes worth of the value specified by FillValue.
This implements directives such as '.space'.
Definition at line 779 of file MCStreamer.cpp.
void MCObjectStreamer::emitFrames | ( | MCAsmBackend * | MAB | ) |
Definition at line 181 of file MCObjectStreamer.cpp.
References llvm::MCSFrameEmitter::emit(), llvm::MCDwarfFrameEmitter::Emit(), llvm::MCStreamer::getContext(), and llvm::MCStreamer::getNumFrameInfos().
Referenced by llvm::MCELFStreamer::finishImpl(), and llvm::MCWasmStreamer::finishImpl().
|
overridevirtual |
Emit the given Instruction
into the current section.
Reimplemented from llvm::MCStreamer.
Reimplemented in llvm::CSKYELFStreamer, llvm::HexagonMCELFStreamer, llvm::MipsELFStreamer, llvm::PPCELFStreamer, llvm::PPCXCOFFStreamer, and llvm::RISCVELFStreamer.
Definition at line 390 of file MCObjectStreamer.cpp.
References llvm::MCAsmBackend::allowEnhancedRelaxation(), llvm::MCStreamer::emitInstruction(), emitInstToFragment(), getAssembler(), llvm::MCAssembler::getBackend(), llvm::MCStreamer::getCurrentSectionOnly(), llvm::MCInst::getOpcode(), llvm::MCInst::getOperands(), llvm::MCAssembler::getRelaxAll(), llvm::MCDwarfLineEntry::make(), llvm::MCAsmBackend::mayNeedRelaxation(), llvm::MCAsmBackend::relaxInstruction(), and llvm::MCSection::setHasInstructions().
Referenced by llvm::MipsTargetELFStreamer::emitDirectiveCpLoad(), llvm::MipsTargetELFStreamer::emitDirectiveCpreturn(), llvm::CSKYELFStreamer::emitInstruction(), llvm::HexagonMCELFStreamer::emitInstruction(), llvm::MipsELFStreamer::emitInstruction(), llvm::PPCELFStreamer::emitInstruction(), llvm::PPCXCOFFStreamer::emitInstruction(), and llvm::RISCVELFStreamer::emitInstruction().
void MCObjectStreamer::emitInstToFragment | ( | const MCInst & | Inst, |
const MCSubtargetInfo & | STI | ||
) |
Emit an instruction to a special fragment, because this instruction can change its size during relaxation.
Definition at line 461 of file MCObjectStreamer.cpp.
References llvm::Data, llvm::MCCodeEmitter::encodeInstruction(), F, Fixup, llvm::MCFragment::FT_Relaxable, getAssembler(), llvm::MCStreamer::getCurrentFragment(), llvm::MCAssembler::getEmitter(), and newFragment().
Referenced by emitInstruction().
Emit a label for Symbol
into the current section.
This corresponds to an assembler statement such as: foo:
Symbol | - The symbol to emit. A given symbol should only be emitted as a label once, and symbols emitted as a label should never be used in an assignment. |
Reimplemented from llvm::MCStreamer.
Reimplemented in llvm::MCWasmStreamer, llvm::MCWinCOFFStreamer, llvm::MipsELFStreamer, and llvm::PPCELFStreamer.
Definition at line 246 of file MCObjectStreamer.cpp.
References llvm::MCStreamer::CurFrag, llvm::MCStreamer::emitLabel(), emitPendingAssignments(), F, getAssembler(), and llvm::MCAssembler::registerSymbol().
Referenced by llvm::MCSFrameEmitter::emit(), llvm::MCDwarfFrameEmitter::Emit(), emitCFILabel(), emitCVLocDirective(), llvm::MCELFStreamer::emitLabel(), llvm::MCWasmStreamer::emitLabel(), and llvm::MCWinCOFFStreamer::emitLabel().
|
virtual |
Reimplemented in llvm::MCELFStreamer, and llvm::MCWasmStreamer.
Definition at line 277 of file MCObjectStreamer.cpp.
References assert(), llvm::MCStreamer::emitLabel(), F, getAssembler(), llvm::MCStreamer::getCurrentSectionOnly(), llvm::Offset, and llvm::MCAssembler::registerSymbol().
Referenced by llvm::MCELFStreamer::emitLabelAtPos(), and llvm::MCWasmStreamer::emitLabelAtPos().
|
overridevirtual |
Reimplemented from llvm::MCStreamer.
Definition at line 732 of file MCObjectStreamer.cpp.
References assert(), and llvm::MCStreamer::getCurrentSectionOnly().
void MCObjectStreamer::emitPendingAssignments | ( | MCSymbol * | Symbol | ) |
Emits pending conditional assignments that depend on Symbol
being emitted.
Definition at line 265 of file MCObjectStreamer.cpp.
References A, and emitAssignment().
Referenced by emitAssignment(), and emitLabel().
|
overridevirtual |
Record a relocation described by the .reloc directive.
Reimplemented from llvm::MCStreamer.
Definition at line 673 of file MCObjectStreamer.cpp.
References llvm::MCAssembler::addRelocDirective(), llvm::MCSymbolRefExpr::create(), llvm::MCBinaryExpr::createAdd(), getAssembler(), llvm::MCSection::getBeginSymbol(), llvm::MCStreamer::getContext(), llvm::MCStreamer::getCurrentSectionOnly(), Name, llvm::Offset, llvm::MCContext::reportError(), and llvm::MCStreamer::visitUsedExpr().
Reimplemented from llvm::MCStreamer.
Definition at line 297 of file MCObjectStreamer.cpp.
References llvm::MCStreamer::emitSLEB128IntValue(), F, getAssembler(), llvm::MCStreamer::getCurrentFragment(), and newFragment().
Reimplemented from llvm::MCStreamer.
Definition at line 286 of file MCObjectStreamer.cpp.
References llvm::MCStreamer::emitULEB128IntValue(), F, getAssembler(), llvm::MCStreamer::getCurrentFragment(), and newFragment().
|
overridevirtual |
Emit the expression Value
into the output as a native integer of the given Size
bytes.
This is used to implement assembler directives such as .word, .quad, etc.
Value | - The value to emit. |
Size | - The size of the integer (in bytes) to emit. This must match a native machine width. |
Loc | - The location of the expression for error reporting. |
Reimplemented from llvm::MCStreamer.
Reimplemented in llvm::CSKYELFStreamer, llvm::MipsELFStreamer, and llvm::RISCVELFStreamer.
Definition at line 207 of file MCObjectStreamer.cpp.
References addFixup(), appendContents(), llvm::MCStreamer::emitIntValue(), llvm::MCStreamer::emitValueImpl(), ensureHeadroom(), getAssemblerPtr(), llvm::MCStreamer::getContext(), llvm::MCStreamer::getCurrentSectionOnly(), llvm::MCFixup::getDataKindForSize(), llvm::isIntN(), llvm::isUIntN(), llvm::MCDwarfLineEntry::make(), llvm::MCContext::reportError(), and Size.
Referenced by llvm::CSKYELFStreamer::emitValueImpl(), llvm::MipsELFStreamer::emitValueImpl(), and llvm::RISCVELFStreamer::emitValueImpl().
|
overridevirtual |
Emit some number of copies of Value
until the byte alignment ByteAlignment
is reached.
If the number of bytes need to emit for the alignment is not a multiple of ValueSize
, then the contents of the emitted fill bytes is undefined.
This used to implement the .align assembler directive.
Alignment | - The alignment to reach. |
Fill | - The value to use when filling bytes. |
FillLen | - The size of the integer (in bytes) to emit for Value . This must match a native machine width. |
MaxBytesToEmit | - The maximum numbers of bytes to emit, or 0. If the alignment cannot be reached in this many bytes, no bytes are emitted. |
Reimplemented from llvm::MCStreamer.
Definition at line 645 of file MCObjectStreamer.cpp.
References F, llvm::MCStreamer::getCurrentFragment(), newFragment(), and llvm::Align::value().
Referenced by llvm::MCDwarfFrameEmitter::Emit(), emitCodeAlignment(), llvm::MCELFStreamer::emitCommonSymbol(), llvm::MCXCOFFStreamer::emitCommonSymbol(), llvm::MCWinCOFFStreamer::emitLocalCommonSymbol(), llvm::MipsTargetELFStreamer::finish(), and llvm::HexagonMCELFStreamer::HexagonMCEmitCommonSymbol().
|
overridevirtual |
Emit some number of copies of Value
until the byte offset Offset
is reached.
This is used to implement assembler directives such as .org.
Offset | - The offset to reach. This may be an expression, but the expression must be associated with the current section. |
Value | - The value to use when filling bytes. |
Reimplemented from llvm::MCStreamer.
Definition at line 667 of file MCObjectStreamer.cpp.
References llvm::Offset.
|
overridevirtual |
Emit an weak reference from Alias
to Symbol
.
This corresponds to an assembler statement such as: .weakref alias, symbol
Alias | - The alias that is being created. |
Symbol | - The symbol being aliased. |
Reimplemented from llvm::MCStreamer.
Reimplemented in llvm::MCWinCOFFStreamer.
Definition at line 308 of file MCObjectStreamer.cpp.
References llvm::reportFatalUsageError().
void MCObjectStreamer::ensureHeadroom | ( | size_t | Headroom | ) |
Definition at line 80 of file MCObjectStreamer.cpp.
References llvm::MCStreamer::addFragment(), allocFragSpace(), and F.
Referenced by appendContents(), llvm::MCWinCOFFStreamer::emitCOFFImgRel32(), llvm::MCWinCOFFStreamer::emitCOFFSecNumber(), llvm::MCWinCOFFStreamer::emitCOFFSecOffset(), llvm::MCWinCOFFStreamer::emitCOFFSecRel32(), llvm::MCWinCOFFStreamer::emitCOFFSectionIndex(), and emitValueImpl().
|
overridevirtual |
Streamer specific finalization.
Reimplemented from llvm::MCStreamer.
Reimplemented in llvm::MCWasmStreamer, and llvm::MCWinCOFFStreamer.
Definition at line 763 of file MCObjectStreamer.cpp.
References llvm::MCPseudoProbeTable::emit(), llvm::MCGenDwarfInfo::Emit(), llvm::MCDwarfLineTable::emit(), llvm::MCAssembler::Finish(), getAssembler(), llvm::MCStreamer::getContext(), and llvm::MCContext::RemapDebugPaths().
Referenced by llvm::MCELFStreamer::finishImpl(), llvm::MCWasmStreamer::finishImpl(), and llvm::MCWinCOFFStreamer::finishImpl().
|
inline |
Definition at line 87 of file MCObjectStreamer.h.
Referenced by llvm::MCWasmStreamer::changeSection(), llvm::MCELFStreamer::changeSection(), changeSection(), llvm::MCWinCOFFStreamer::changeSection(), llvm::MipsELFStreamer::createPendingLabelRelocs(), llvm::MCPseudoProbeSections::emit(), emitAddrsig(), emitAddrsigSym(), emitAssignment(), llvm::MCWinCOFFStreamer::emitCOFFSafeSEH(), llvm::MCWinCOFFStreamer::emitCOFFSymbolIndex(), llvm::MCWinCOFFStreamer::emitCOFFSymbolStorageClass(), llvm::MCWinCOFFStreamer::emitCOFFSymbolType(), llvm::MCELFStreamer::emitCommonSymbol(), llvm::MCWinCOFFStreamer::emitCommonSymbol(), llvm::MCXCOFFStreamer::emitCommonSymbol(), llvm::MipsTargetELFStreamer::emitDirectiveCpLoad(), llvm::MipsTargetELFStreamer::emitDirectiveCpsetup(), llvm::MipsTargetELFStreamer::emitDirectiveEnd(), llvm::RISCVTargetELFStreamer::emitDirectiveVariantCC(), emitFileDirective(), emitFill(), llvm::MipsTargetELFStreamer::emitFrame(), llvm::MCELFStreamer::emitIdent(), emitInstruction(), llvm::PPCELFStreamer::emitInstruction(), llvm::PPCXCOFFStreamer::emitInstruction(), llvm::X86_MC::emitInstruction(), emitInstToFragment(), llvm::MipsTargetELFStreamer::emitLabel(), emitLabel(), emitLabelAtPos(), llvm::MCELFStreamer::emitLocalCommonSymbol(), llvm::MipsTargetELFStreamer::emitMipsAbiFlags(), emitRelocDirective(), emitSLEB128Value(), llvm::MCELFStreamer::emitSymbolAttribute(), llvm::MCWasmStreamer::emitSymbolAttribute(), llvm::MCWinCOFFStreamer::emitSymbolAttribute(), llvm::MCXCOFFStreamer::emitSymbolAttribute(), emitULEB128Value(), llvm::MCWinCOFFStreamer::emitWeakReference(), llvm::MCWinCOFFStreamer::finalizeCGProfileEntry(), llvm::MipsTargetELFStreamer::finish(), finishImpl(), llvm::MCWinCOFFStreamer::finishImpl(), llvm::MCELFStreamer::getWriter(), llvm::MCGOFFStreamer::getWriter(), llvm::MCWinCOFFStreamer::getWriter(), llvm::MCXCOFFStreamer::getWriter(), llvm::HexagonMCELFStreamer::HexagonMCEmitCommonSymbol(), llvm::HexagonMCELFStreamer::HexagonMCEmitLocalCommonSymbol(), llvm::LoongArchTargetELFStreamer::LoongArchTargetELFStreamer(), llvm::MipsTargetELFStreamer::MipsTargetELFStreamer(), and llvm::RISCVTargetELFStreamer::RISCVTargetELFStreamer().
|
overridevirtual |
Reimplemented from llvm::MCStreamer.
Definition at line 44 of file MCObjectStreamer.cpp.
References llvm::MCStreamer::getUseAssemblerInfoForParsing().
Referenced by llvm::MCPseudoProbe::emit(), and emitValueImpl().
|
inline |
Definition at line 92 of file MCObjectStreamer.h.
References llvm::MCStreamer::CurFrag, and llvm::MCFragment::getFixedSize().
Referenced by appendContents(), changeSection(), and newFragment().
|
inlineoverridevirtual |
Object streamers require the integrated assembler.
Reimplemented from llvm::MCStreamer.
Definition at line 78 of file MCObjectStreamer.h.
Reimplemented from llvm::MCStreamer.
Definition at line 386 of file MCObjectStreamer.cpp.
References llvm::MCSection::hasInstructions().
void MCObjectStreamer::newFragment | ( | ) |
Definition at line 66 of file MCObjectStreamer.cpp.
References llvm::MCStreamer::addFragment(), llvm::alignToPowerOf2(), allocFragSpace(), End, F, getCurFragEnd(), LLVM_LIKELY, and NewFragHeadroom.
Referenced by llvm::MCPseudoProbe::emit(), emitDwarfAdvanceFrameAddr(), emitDwarfAdvanceLineAddr(), emitInstToFragment(), emitSLEB128Value(), emitULEB128Value(), and emitValueToAlignment().
|
inline |
Definition at line 102 of file MCObjectStreamer.h.
References llvm::BumpPtrAllocatorImpl< AllocatorT, SlabSize, SizeThreshold, GrowthDelay >::Allocate(), args, and F.
|
overridevirtual |
state management
Reimplemented from llvm::MCStreamer.
Reimplemented in llvm::MCWasmStreamer, llvm::MCWinCOFFStreamer, and llvm::CSKYELFStreamer.
Definition at line 167 of file MCObjectStreamer.cpp.
References llvm::SmallVectorImpl< T >::clear(), llvm::MCStreamer::getContext(), llvm::MCStreamer::reset(), and llvm::BumpPtrAllocatorImpl< AllocatorT, SlabSize, SizeThreshold, GrowthDelay >::Reset().
Referenced by llvm::MCELFStreamer::reset(), llvm::MCWasmStreamer::reset(), and llvm::MCWinCOFFStreamer::reset().
Reimplemented from llvm::MCStreamer.
Definition at line 196 of file MCObjectStreamer.cpp.
References Sym.
Referenced by llvm::MCWinCOFFStreamer::emitCOFFImgRel32(), llvm::MCWinCOFFStreamer::emitCOFFSecNumber(), llvm::MCWinCOFFStreamer::emitCOFFSecOffset(), llvm::MCWinCOFFStreamer::emitCOFFSecRel32(), and llvm::MCWinCOFFStreamer::emitCOFFSectionIndex().