LLVM 19.0.0git
Classes | Public Member Functions | Protected Member Functions | List of all members
llvm::MCObjectStreamer Class Referenceabstract

Streaming object file generation interface. More...

#include "llvm/MC/MCObjectStreamer.h"

Inheritance diagram for llvm::MCObjectStreamer:
Inheritance graph
[legend]

Public Member Functions

void reset () override
 state management
 
bool isIntegratedAssemblerRequired () const override
 Object streamers require the integrated assembler.
 
void emitFrames (MCAsmBackend *MAB)
 
void emitCFISections (bool EH, bool Debug) override
 
MCFragmentgetCurrentFragment () const
 
void insert (MCFragment *F)
 
MCDataFragmentgetOrCreateDataFragment (const MCSubtargetInfo *STI=nullptr)
 Get a data fragment to write into, creating a new one if the current fragment is not a data fragment.
 
void visitUsedSymbol (const MCSymbol &Sym) override
 
void flushPendingLabels ()
 Create a data fragment for any pending labels across all Sections and Subsections.
 
MCAssemblergetAssembler ()
 
MCAssemblergetAssemblerPtr () override
 
MCStreamer Interface
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 *Symbol) override
 Emit an weak reference from Alias to Symbol.
 
void changeSection (MCSection *Section, const MCExpr *Subsection) override
 Update streamer for a new active section.
 
void emitInstruction (const MCInst &Inst, const MCSubtargetInfo &STI) override
 Emit the given Instruction into the current section.
 
virtual void emitInstToFragment (const MCInst &Inst, const MCSubtargetInfo &)
 Emit an instruction to a special fragment, because this instruction can change its size during relaxation.
 
void emitBundleAlignMode (Align Alignment) override
 Set the bundle alignment mode from now on in the section.
 
void emitBundleLock (bool AlignToEnd) override
 The following instructions are a bundle-locked group.
 
void emitBundleUnlock () override
 Ends a bundle-locked group.
 
void emitBytes (StringRef Data) override
 Emit the bytes in Data into the output.
 
void emitValueToAlignment (Align Alignment, int64_t Value=0, unsigned ValueSize=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) 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) 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 emitDTPRel32Value (const MCExpr *Value) override
 Emit the expression Value into the output as a dtprel (32-bit DTP relative) value.
 
void emitDTPRel64Value (const MCExpr *Value) override
 Emit the expression Value into the output as a dtprel (64-bit DTP relative) value.
 
void emitTPRel32Value (const MCExpr *Value) override
 Emit the expression Value into the output as a tprel (32-bit TP relative) value.
 
void emitTPRel64Value (const MCExpr *Value) override
 Emit the expression Value into the output as a tprel (64-bit TP relative) value.
 
void emitGPRel32Value (const MCExpr *Value) override
 Emit the expression Value into the output as a gprel32 (32-bit GP relative) value.
 
void emitGPRel64Value (const MCExpr *Value) override
 Emit the expression Value into the output as a gprel64 (64-bit GP relative) value.
 
std::optional< std::pair< bool, std::string > > emitRelocDirective (const MCExpr &Offset, StringRef Name, const MCExpr *Expr, SMLoc Loc, const MCSubtargetInfo &STI) 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.
 
- Public Member Functions inherited from llvm::MCStreamer
 MCStreamer (const MCStreamer &)=delete
 
MCStreameroperator= (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.
 
MCContextgetContext () const
 
virtual MCAssemblergetAssemblerPtr ()
 
void setUseAssemblerInfoForParsing (bool v)
 
bool getUseAssemblerInfoForParsing ()
 
MCTargetStreamergetTargetStreamer ()
 
void setAllowAutoPadding (bool v)
 
bool getAllowAutoPadding () const
 
virtual MCSymbolemitCFILabel ()
 When emitting an object file, create and emit a real label.
 
WinEH::FrameInfoEnsureValidWinFrameInfo (SMLoc Loc)
 Retrieve the current frame info if one is available and it is not yet closed.
 
unsigned getNumFrameInfos ()
 
ArrayRef< MCDwarfFrameInfogetDwarfFrameInfos () const
 
bool hasUnfinishedDwarfFrameInfo ()
 
unsigned getNumWinFrameInfos ()
 
ArrayRef< std::unique_ptr< WinEH::FrameInfo > > getWinFrameInfos () 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< unsignedtryEmitDwarfFileDirective (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)
 This implements the DWARF2 '.loc fileno lineno ...' assembler 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 MCSymbolgetDwarfLineTableSymbol (unsigned CUID)
 
virtual void emitCFISections (bool EH, bool Debug)
 
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 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 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)
 
MCSectiongetAssociatedPDataSection (const MCSection *TextSec)
 Get the .pdata section used for the given section.
 
MCSectiongetAssociatedXDataSection (const MCSection *TextSec)
 Get the .xdata section used for the given section.
 
virtual void emitSyntaxDirective ()
 
virtual std::optional< std::pair< bool, std::string > > emitRelocDirective (const MCExpr &Offset, StringRef Name, const MCExpr *Expr, SMLoc Loc, const MCSubtargetInfo &STI)
 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.
 
virtual void emitBundleAlignMode (Align Alignment)
 Set the bundle alignment mode from now on in the section.
 
virtual void emitBundleLock (bool AlignToEnd)
 The following instructions are a bundle-locked group.
 
virtual void emitBundleUnlock ()
 Ends a bundle-locked group.
 
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 MCSymbolemitDwarfUnitLength (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)
 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 void doFinalizationAtSectionEnd (MCSection *Section)
 Do finalization for the streamer at the end of a section.
 
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_ostreamgetCommentOS ()
 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.
 
MCSectiongetCurrentSectionOnly () const
 
MCSectionSubPair getPreviousSection () const
 Return the previous section that the streamer is emitting code to.
 
unsigned getSymbolOrder (const MCSymbol *Sym) const
 Returns an index to represent the order a symbol was emitted in.
 
void pushSection ()
 Save the current and previous section on the section stack.
 
bool popSection ()
 Restore the current and previous section from the section stack.
 
bool subSection (const MCExpr *Subsection)
 
virtual void switchSection (MCSection *Section, const MCExpr *Subsection=nullptr)
 Set the current section where code is being emitted to Section.
 
void switchSectionNoChange (MCSection *Section, const MCExpr *Subsection=nullptr)
 Set the current section where code is being emitted to Section.
 
virtual void initSections (bool NoExecStack, const MCSubtargetInfo &STI)
 Create the default sections and set the initial one.
 
MCSymbolendSection (MCSection *Section)
 
void assignFragment (MCSymbol *Symbol, MCFragment *Fragment)
 Sets the symbol's section.
 
virtual StringRef getMnemonic (MCInst &MI)
 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 emitAssemblerFlag (MCAssemblerFlag Flag)
 Note in the output the specified Flag.
 
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 void emitThumbFunc (MCSymbol *Func)
 Note in the output that the specified Func is a Thumb mode function (ARM target only).
 
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 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())=0
 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 (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 ()
 
bool changeSectionImpl (MCSection *Section, const MCExpr *Subsection)
 
void addPendingLabel (MCSymbol *label)
 Assign a label to the current Section and Subsection even though a fragment is not yet present.
 
void flushPendingLabels (MCFragment *F, uint64_t FOffset=0)
 If any labels have been emitted but not assigned fragments in the current Section and Subsection, ensure that they get assigned to fragment F.
 
- Protected Member Functions inherited from llvm::MCStreamer
 MCStreamer (MCContext &Ctx)
 
virtual void emitCFIStartProcImpl (MCDwarfFrameInfo &Frame)
 
virtual void emitCFIEndProcImpl (MCDwarfFrameInfo &CurFrame)
 
WinEH::FrameInfogetCurrentWinFrameInfo ()
 
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.
 

Detailed Description

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 42 of file MCObjectStreamer.h.

Constructor & Destructor Documentation

◆ MCObjectStreamer()

MCObjectStreamer::MCObjectStreamer ( MCContext Context,
std::unique_ptr< MCAsmBackend TAB,
std::unique_ptr< MCObjectWriter OW,
std::unique_ptr< MCCodeEmitter Emitter 
)
protected

Definition at line 27 of file MCObjectStreamer.cpp.

References Context, and llvm::MCStreamer::setAllowAutoPadding().

◆ ~MCObjectStreamer()

MCObjectStreamer::~MCObjectStreamer ( )
protecteddefault

Member Function Documentation

◆ addPendingLabel()

void MCObjectStreamer::addPendingLabel ( MCSymbol label)
protected

Assign a label to the current Section and Subsection even though a fragment is not yet present.

Use flushPendingLabels(F) to associate a fragment with this label.

Definition at line 50 of file MCObjectStreamer.cpp.

References llvm::MCSection::addPendingLabel(), llvm::MCStreamer::getCurrentSectionOnly(), and Sym.

Referenced by emitLabel(), and emitLabelAtPos().

◆ changeSection()

void MCObjectStreamer::changeSection ( MCSection ,
const MCExpr  
)
overridevirtual

Update streamer for a new active section.

This is called by popSection and switchSection, if the current section changes.

Reimplemented from llvm::MCStreamer.

Reimplemented in llvm::MCWasmStreamer, and RISCVELFStreamer.

Definition at line 367 of file MCObjectStreamer.cpp.

References changeSectionImpl().

Referenced by llvm::MCWasmStreamer::changeSection().

◆ changeSectionImpl()

bool MCObjectStreamer::changeSectionImpl ( MCSection Section,
const MCExpr Subsection 
)
protected

◆ emitAbsoluteSymbolDiff()

void MCObjectStreamer::emitAbsoluteSymbolDiff ( const MCSymbol Hi,
const MCSymbol Lo,
unsigned  Size 
)
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.

Precondition
Offset of Hi is greater than the offset Lo.

Reimplemented from llvm::MCStreamer.

Definition at line 159 of file MCObjectStreamer.cpp.

References absoluteSymbolDiff(), llvm::MCStreamer::emitAbsoluteSymbolDiff(), llvm::MCStreamer::emitIntValue(), getAssembler(), llvm::MCStreamer::getContext(), llvm::Hi, llvm::Lo, and Size.

◆ emitAbsoluteSymbolDiffAsULEB128()

void MCObjectStreamer::emitAbsoluteSymbolDiffAsULEB128 ( const MCSymbol Hi,
const MCSymbol Lo 
)
overridevirtual

Emit the absolute difference between two symbols encoded with ULEB128.

Reimplemented from llvm::MCStreamer.

Definition at line 168 of file MCObjectStreamer.cpp.

References absoluteSymbolDiff(), llvm::MCStreamer::emitAbsoluteSymbolDiffAsULEB128(), llvm::MCStreamer::emitULEB128IntValue(), getAssembler(), llvm::MCStreamer::getContext(), llvm::Hi, and llvm::Lo.

◆ emitAddrsig()

void MCObjectStreamer::emitAddrsig ( )
overridevirtual

◆ emitAddrsigSym()

void MCObjectStreamer::emitAddrsigSym ( const MCSymbol Sym)
overridevirtual

◆ emitAssignment()

void MCObjectStreamer::emitAssignment ( MCSymbol Symbol,
const MCExpr Value 
)
overridevirtual

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.

Parameters
Symbol- The symbol being assigned to.
Value- The value for the symbol.

Reimplemented from llvm::MCStreamer.

Definition at line 397 of file MCObjectStreamer.cpp.

References llvm::MCStreamer::emitAssignment(), emitPendingAssignments(), getAssembler(), and llvm::MCAssembler::registerSymbol().

Referenced by emitConditionalAssignment(), and emitPendingAssignments().

◆ emitBundleAlignMode()

void MCObjectStreamer::emitBundleAlignMode ( Align  Alignment)
overridevirtual

Set the bundle alignment mode from now on in the section.

The value 1 means turn the bundle alignment off.

Reimplemented from llvm::MCStreamer.

Definition at line 492 of file MCObjectStreamer.cpp.

References BundlingNotImplementedMsg, and llvm_unreachable.

◆ emitBundleLock()

void MCObjectStreamer::emitBundleLock ( bool  AlignToEnd)
overridevirtual

The following instructions are a bundle-locked group.

Parameters
AlignToEnd- If true, the bundle-locked group will be aligned to the end of a bundle.

Reimplemented from llvm::MCStreamer.

Definition at line 496 of file MCObjectStreamer.cpp.

References BundlingNotImplementedMsg, and llvm_unreachable.

◆ emitBundleUnlock()

void MCObjectStreamer::emitBundleUnlock ( )
overridevirtual

Ends a bundle-locked group.

Reimplemented from llvm::MCStreamer.

Definition at line 500 of file MCObjectStreamer.cpp.

References BundlingNotImplementedMsg, and llvm_unreachable.

◆ emitBytes()

void MCObjectStreamer::emitBytes ( StringRef  Data)
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 RISCVELFStreamer.

Definition at line 636 of file MCObjectStreamer.cpp.

References llvm::Data, DF, flushPendingLabels(), llvm::MCStreamer::getCurrentSectionOnly(), getOrCreateDataFragment(), and llvm::MCDwarfLineEntry::make().

Referenced by llvm::CSKYELFStreamer::emitBytes(), RISCVELFStreamer::emitBytes(), llvm::MCWinCOFFStreamer::emitCommonSymbol(), and llvm::MCELFStreamer::emitIdent().

◆ emitCFISections()

void MCObjectStreamer::emitCFISections ( bool  EH,
bool  Debug 
)
overridevirtual

Reimplemented from llvm::MCStreamer.

Definition at line 242 of file MCObjectStreamer.cpp.

References Debug, and llvm::MCStreamer::emitCFISections().

◆ emitCodeAlignment()

void MCObjectStreamer::emitCodeAlignment ( Align  Alignment,
const MCSubtargetInfo STI,
unsigned  MaxBytesToEmit = 0 
)
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.

Parameters
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 655 of file MCObjectStreamer.cpp.

References emitValueToAlignment(), and getCurrentFragment().

Referenced by llvm::MCELFStreamer::initSections(), and llvm::MCWinCOFFStreamer::initSections().

◆ emitConditionalAssignment()

void MCObjectStreamer::emitConditionalAssignment ( MCSymbol Symbol,
const MCExpr Value 
)
overridevirtual

Emit an assignment of Value to Symbol, but only if Value is also emitted.

Reimplemented from llvm::MCStreamer.

Definition at line 403 of file MCObjectStreamer.cpp.

References emitAssignment().

◆ emitCVDefRangeDirective()

void MCObjectStreamer::emitCVDefRangeDirective ( ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > >  Ranges,
StringRef  FixedSizePortion 
)
overridevirtual

This implements the CodeView '.cv_def_range' assembler directive.

Reimplemented from llvm::MCStreamer.

Definition at line 614 of file MCObjectStreamer.cpp.

References llvm::MCStreamer::emitCVDefRangeDirective(), llvm::CodeViewContext::emitDefRange(), flushPendingLabels(), llvm::MCStreamer::getContext(), and llvm::MCContext::getCVContext().

◆ emitCVFileChecksumOffsetDirective()

void MCObjectStreamer::emitCVFileChecksumOffsetDirective ( unsigned  FileNo)
overridevirtual

This implements the CodeView '.cv_filechecksumoffset' assembler directive.

Reimplemented from llvm::MCStreamer.

Definition at line 632 of file MCObjectStreamer.cpp.

References llvm::CodeViewContext::emitFileChecksumOffset(), llvm::MCStreamer::getContext(), and llvm::MCContext::getCVContext().

◆ emitCVFileChecksumsDirective()

void MCObjectStreamer::emitCVFileChecksumsDirective ( )
overridevirtual

This implements the CodeView '.cv_filechecksums' assembler directive.

Reimplemented from llvm::MCStreamer.

Definition at line 628 of file MCObjectStreamer.cpp.

References llvm::CodeViewContext::emitFileChecksums(), llvm::MCStreamer::getContext(), and llvm::MCContext::getCVContext().

◆ emitCVInlineLinetableDirective()

void MCObjectStreamer::emitCVInlineLinetableDirective ( unsigned  PrimaryFunctionId,
unsigned  SourceFileId,
unsigned  SourceLineNum,
const MCSymbol FnStartSym,
const MCSymbol FnEndSym 
)
overridevirtual

This implements the CodeView '.cv_inline_linetable' assembler directive.

Reimplemented from llvm::MCStreamer.

Definition at line 604 of file MCObjectStreamer.cpp.

References llvm::MCStreamer::emitCVInlineLinetableDirective(), llvm::CodeViewContext::emitInlineLineTableForFunction(), llvm::MCStreamer::getContext(), and llvm::MCContext::getCVContext().

◆ emitCVLinetableDirective()

void MCObjectStreamer::emitCVLinetableDirective ( unsigned  FunctionId,
const MCSymbol FnStart,
const MCSymbol FnEnd 
)
overridevirtual

This implements the CodeView '.cv_linetable' assembler directive.

Reimplemented from llvm::MCStreamer.

Definition at line 596 of file MCObjectStreamer.cpp.

References llvm::MCStreamer::emitCVLinetableDirective(), llvm::CodeViewContext::emitLineTableForFunction(), End, llvm::MCStreamer::getContext(), and llvm::MCContext::getCVContext().

◆ emitCVLocDirective()

void MCObjectStreamer::emitCVLocDirective ( unsigned  FunctionId,
unsigned  FileNo,
unsigned  Line,
unsigned  Column,
bool  PrologueEnd,
bool  IsStmt,
StringRef  FileName,
SMLoc  Loc 
)
overridevirtual

◆ emitCVStringTableDirective()

void MCObjectStreamer::emitCVStringTableDirective ( )
overridevirtual

This implements the CodeView '.cv_stringtable' assembler directive.

Reimplemented from llvm::MCStreamer.

Definition at line 625 of file MCObjectStreamer.cpp.

References llvm::CodeViewContext::emitStringTable(), llvm::MCStreamer::getContext(), and llvm::MCContext::getCVContext().

◆ emitDTPRel32Value()

void MCObjectStreamer::emitDTPRel32Value ( const MCExpr Value)
overridevirtual

Emit the expression Value into the output as a dtprel (32-bit DTP relative) value.

This is used to implement assembler directives such as .dtprelword on targets that support them.

Reimplemented from llvm::MCStreamer.

Definition at line 669 of file MCObjectStreamer.cpp.

References llvm::MCFixup::create(), DF, llvm::FK_DTPRel_4, flushPendingLabels(), and getOrCreateDataFragment().

◆ emitDTPRel64Value()

void MCObjectStreamer::emitDTPRel64Value ( const MCExpr Value)
overridevirtual

Emit the expression Value into the output as a dtprel (64-bit DTP relative) value.

This is used to implement assembler directives such as .dtpreldword on targets that support them.

Reimplemented from llvm::MCStreamer.

Definition at line 679 of file MCObjectStreamer.cpp.

References llvm::MCFixup::create(), DF, llvm::FK_DTPRel_8, flushPendingLabels(), and getOrCreateDataFragment().

◆ emitDwarfAdvanceFrameAddr()

void MCObjectStreamer::emitDwarfAdvanceFrameAddr ( const MCSymbol LastLabel,
const MCSymbol Label,
SMLoc  Loc 
)

Definition at line 573 of file MCObjectStreamer.cpp.

References buildSymbolDiff(), and insert().

◆ emitDwarfAdvanceLineAddr()

void MCObjectStreamer::emitDwarfAdvanceLineAddr ( int64_t  LineDelta,
const MCSymbol LastLabel,
const MCSymbol Label,
unsigned  PointerSize 
)
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 542 of file MCObjectStreamer.cpp.

References buildSymbolDiff(), emitDwarfSetLineAddr(), llvm::MCAssembler::getDWARFLinetableParams(), and insert().

Referenced by emitDwarfLineEndEntry().

◆ emitDwarfLineEndEntry()

void MCObjectStreamer::emitDwarfLineEndEntry ( MCSection Section,
MCSymbol LastLabel 
)
overridevirtual

◆ emitDwarfLocDirective()

void MCObjectStreamer::emitDwarfLocDirective ( unsigned  FileNo,
unsigned  Line,
unsigned  Column,
unsigned  Flags,
unsigned  Isa,
unsigned  Discriminator,
StringRef  FileName 
)
overridevirtual

This implements the DWARF2 '.loc fileno lineno ...' assembler directive.

Reimplemented from llvm::MCStreamer.

Definition at line 504 of file MCObjectStreamer.cpp.

References llvm::MCStreamer::emitDwarfLocDirective(), llvm::MCStreamer::getCurrentSectionOnly(), and llvm::MCDwarfLineEntry::make().

◆ emitFileDirective() [1/2]

void MCObjectStreamer::emitFileDirective ( StringRef  Filename)
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 896 of file MCObjectStreamer.cpp.

References llvm::MCAssembler::addFileName(), and getAssembler().

◆ emitFileDirective() [2/2]

void MCObjectStreamer::emitFileDirective ( StringRef  Filename,
StringRef  CompilerVersion,
StringRef  TimeStamp,
StringRef  Description 
)
overridevirtual

Emit ".file assembler diretive with additioal info.

Reimplemented from llvm::MCStreamer.

Definition at line 900 of file MCObjectStreamer.cpp.

References llvm::MCAssembler::addFileName(), getAssembler(), llvm::MCAssembler::setCompilerVersion(), and llvm::StringRef::str().

◆ emitFill() [1/5]

void MCStreamer::emitFill ( const MCExpr NumBytes,
uint64_t  FillValue,
SMLoc  Loc = SMLoc() 
)
virtual

Emit Size bytes worth of the value specified by FillValue.

This is used to implement assembler directives such as .space or .skip.

Parameters
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 834 of file MCStreamer.cpp.

References Context.

◆ emitFill() [2/5]

void MCObjectStreamer::emitFill ( const MCExpr NumBytes,
uint64_t  FillValue,
SMLoc  Loc = SMLoc() 
)
overridevirtual

Emit Size bytes worth of the value specified by FillValue.

This is used to implement assembler directives such as .space or .skip.

Parameters
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 RISCVELFStreamer.

Definition at line 846 of file MCObjectStreamer.cpp.

References assert(), DF, flushPendingLabels(), llvm::MCStreamer::getCurrentSectionOnly(), getOrCreateDataFragment(), and insert().

Referenced by llvm::CSKYELFStreamer::emitFill(), and RISCVELFStreamer::emitFill().

◆ emitFill() [3/5]

void MCStreamer::emitFill ( const MCExpr NumValues,
int64_t  Size,
int64_t  Expr,
SMLoc  Loc = SMLoc() 
)
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.

Parameters
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 845 of file MCStreamer.cpp.

◆ emitFill() [4/5]

void MCObjectStreamer::emitFill ( const MCExpr NumValues,
int64_t  Size,
int64_t  Expr,
SMLoc  Loc = SMLoc() 
)
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.

Parameters
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 855 of file MCObjectStreamer.cpp.

References assert(), DF, llvm::SourceMgr::DK_Warning, llvm::MCStreamer::emitIntValue(), flushPendingLabels(), getAssemblerPtr(), llvm::MCStreamer::getContext(), llvm::MCStreamer::getCurrentSectionOnly(), getOrCreateDataFragment(), llvm::MCContext::getSourceManager(), insert(), llvm::SourceMgr::PrintMessage(), and Size.

◆ emitFill() [5/5]

void MCStreamer::emitFill ( uint64_t  NumBytes,
uint8_t  FillValue 
)

Emit NumBytes bytes worth of the value specified by FillValue.

This implements directives such as '.space'.

Definition at line 825 of file MCStreamer.cpp.

◆ emitFrames()

void MCObjectStreamer::emitFrames ( MCAsmBackend MAB)

◆ emitGPRel32Value()

void MCObjectStreamer::emitGPRel32Value ( const MCExpr Value)
overridevirtual

Emit the expression Value into the output as a gprel32 (32-bit GP relative) value.

This is used to implement assembler directives such as .gprel32 on targets that support them.

Reimplemented from llvm::MCStreamer.

Definition at line 709 of file MCObjectStreamer.cpp.

References llvm::MCFixup::create(), DF, llvm::FK_GPRel_4, flushPendingLabels(), and getOrCreateDataFragment().

◆ emitGPRel64Value()

void MCObjectStreamer::emitGPRel64Value ( const MCExpr Value)
overridevirtual

Emit the expression Value into the output as a gprel64 (64-bit GP relative) value.

This is used to implement assembler directives such as .gpdword on targets that support them.

Reimplemented from llvm::MCStreamer.

Definition at line 719 of file MCObjectStreamer.cpp.

References llvm::MCFixup::create(), DF, llvm::FK_GPRel_4, flushPendingLabels(), and getOrCreateDataFragment().

◆ emitInstruction()

void MCObjectStreamer::emitInstruction ( const MCInst Inst,
const MCSubtargetInfo STI 
)
overridevirtual

◆ emitInstToFragment()

void MCObjectStreamer::emitInstToFragment ( const MCInst Inst,
const MCSubtargetInfo STI 
)
virtual

Emit an instruction to a special fragment, because this instruction can change its size during relaxation.

Definition at line 471 of file MCObjectStreamer.cpp.

References llvm::MCCodeEmitter::encodeInstruction(), getAssembler(), llvm::MCAssembler::getEmitter(), insert(), and llvm_unreachable.

◆ emitLabel()

void MCObjectStreamer::emitLabel ( MCSymbol Symbol,
SMLoc  Loc = SMLoc() 
)
overridevirtual

Emit a label for Symbol into the current section.

This corresponds to an assembler statement such as: foo:

Parameters
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 290 of file MCObjectStreamer.cpp.

References addPendingLabel(), llvm::MCStreamer::emitLabel(), emitPendingAssignments(), F, getAssembler(), getCurrentFragment(), and llvm::MCAssembler::registerSymbol().

Referenced by llvm::MCDwarfFrameEmitter::Emit(), emitCVLocDirective(), llvm::MCELFStreamer::emitLabel(), llvm::MCWasmStreamer::emitLabel(), and llvm::MCWinCOFFStreamer::emitLabel().

◆ emitLabelAtPos()

void MCObjectStreamer::emitLabelAtPos ( MCSymbol Symbol,
SMLoc  Loc,
MCFragment F,
uint64_t  Offset 
)
virtual

◆ emitNops()

void MCObjectStreamer::emitNops ( int64_t  NumBytes,
int64_t  ControlledNopLength,
SMLoc  Loc,
const MCSubtargetInfo STI 
)
overridevirtual

◆ emitPendingAssignments()

void MCObjectStreamer::emitPendingAssignments ( MCSymbol Symbol)

Emits pending conditional assignments that depend on Symbol being emitted.

Definition at line 314 of file MCObjectStreamer.cpp.

References A, and emitAssignment().

Referenced by emitAssignment(), and emitLabel().

◆ emitRelocDirective()

std::optional< std::pair< bool, std::string > > MCObjectStreamer::emitRelocDirective ( const MCExpr Offset,
StringRef  Name,
const MCExpr Expr,
SMLoc  Loc,
const MCSubtargetInfo STI 
)
overridevirtual

◆ emitSLEB128Value()

void MCObjectStreamer::emitSLEB128Value ( const MCExpr Value)
overridevirtual

Reimplemented from llvm::MCStreamer.

Definition at line 353 of file MCObjectStreamer.cpp.

References llvm::MCStreamer::emitSLEB128IntValue(), getAssemblerPtr(), and insert().

◆ emitTPRel32Value()

void MCObjectStreamer::emitTPRel32Value ( const MCExpr Value)
overridevirtual

Emit the expression Value into the output as a tprel (32-bit TP relative) value.

This is used to implement assembler directives such as .tprelword on targets that support them.

Reimplemented from llvm::MCStreamer.

Definition at line 689 of file MCObjectStreamer.cpp.

References llvm::MCFixup::create(), DF, llvm::FK_TPRel_4, flushPendingLabels(), and getOrCreateDataFragment().

◆ emitTPRel64Value()

void MCObjectStreamer::emitTPRel64Value ( const MCExpr Value)
overridevirtual

Emit the expression Value into the output as a tprel (64-bit TP relative) value.

This is used to implement assembler directives such as .tpreldword on targets that support them.

Reimplemented from llvm::MCStreamer.

Definition at line 699 of file MCObjectStreamer.cpp.

References llvm::MCFixup::create(), DF, llvm::FK_TPRel_8, flushPendingLabels(), and getOrCreateDataFragment().

◆ emitULEB128Value()

void MCObjectStreamer::emitULEB128Value ( const MCExpr Value)
overridevirtual

Reimplemented from llvm::MCStreamer.

Definition at line 344 of file MCObjectStreamer.cpp.

References llvm::MCStreamer::emitULEB128IntValue(), getAssemblerPtr(), and insert().

◆ emitValueImpl()

void MCObjectStreamer::emitValueImpl ( const MCExpr Value,
unsigned  Size,
SMLoc  Loc = SMLoc() 
)
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.

Parameters
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 RISCVELFStreamer.

Definition at line 248 of file MCObjectStreamer.cpp.

References llvm::MCFixup::create(), DF, llvm::MCStreamer::emitIntValue(), llvm::MCStreamer::emitValueImpl(), flushPendingLabels(), getAssemblerPtr(), llvm::MCStreamer::getContext(), llvm::MCStreamer::getCurrentSectionOnly(), llvm::MCFixup::getKindForSize(), getOrCreateDataFragment(), llvm::isIntN(), llvm::isUIntN(), llvm::MCDwarfLineEntry::make(), llvm::MCContext::reportError(), and Size.

Referenced by llvm::MCELFStreamer::emitValueImpl().

◆ emitValueToAlignment()

void MCObjectStreamer::emitValueToAlignment ( Align  Alignment,
int64_t  Value = 0,
unsigned  ValueSize = 1,
unsigned  MaxBytesToEmit = 0 
)
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.

Parameters
Alignment- The alignment to reach.
Value- The value to use when filling bytes.
ValueSize- 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 643 of file MCObjectStreamer.cpp.

References llvm::MCSection::ensureMinAlignment(), llvm::MCStreamer::getCurrentSectionOnly(), insert(), and llvm::Align::value().

Referenced by llvm::MCDwarfFrameEmitter::Emit(), emitCodeAlignment(), llvm::MCXCOFFStreamer::emitCommonSymbol(), llvm::MCWinCOFFStreamer::emitLocalCommonSymbol(), and llvm::MCELFStreamer::emitValueToAlignment().

◆ emitValueToOffset()

void MCObjectStreamer::emitValueToOffset ( const MCExpr Offset,
unsigned char  Value,
SMLoc  Loc 
)
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.

Parameters
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 662 of file MCObjectStreamer.cpp.

References insert(), and llvm::Offset.

◆ emitWeakReference()

void MCObjectStreamer::emitWeakReference ( MCSymbol Alias,
const MCSymbol Symbol 
)
overridevirtual

Emit an weak reference from Alias to Symbol.

This corresponds to an assembler statement such as: .weakref alias, symbol

Parameters
Alias- The alias that is being created.
Symbol- The symbol being aliased.

Reimplemented from llvm::MCStreamer.

Reimplemented in llvm::MCWasmStreamer, and llvm::MCWinCOFFStreamer.

Definition at line 362 of file MCObjectStreamer.cpp.

References llvm::report_fatal_error().

◆ finishImpl()

void MCObjectStreamer::finishImpl ( )
overridevirtual

◆ flushPendingLabels() [1/2]

void MCObjectStreamer::flushPendingLabels ( )

◆ flushPendingLabels() [2/2]

void MCObjectStreamer::flushPendingLabels ( MCFragment F,
uint64_t  FOffset = 0 
)
protected

If any labels have been emitted but not assigned fragments in the current Section and Subsection, ensure that they get assigned to fragment F.

Optionally, one can provide an offset FOffset as a symbol offset within the fragment.

Definition at line 70 of file MCObjectStreamer.cpp.

References llvm::MCSection::addPendingLabel(), assert(), F, llvm::MCSection::flushPendingLabels(), llvm::MCStreamer::getCurrentSectionOnly(), and Sym.

◆ getAssembler()

MCAssembler & llvm::MCObjectStreamer::getAssembler ( )
inline

Definition at line 128 of file MCObjectStreamer.h.

Referenced by llvm::AVRELFStreamer::AVRELFStreamer(), llvm::MCELFStreamer::changeSection(), llvm::MCWasmStreamer::changeSection(), changeSectionImpl(), createELFStreamer(), llvm::createELFStreamer(), llvm::createGOFFStreamer(), llvm::MipsELFStreamer::createPendingLabelRelocs(), llvm::createRISCVELFStreamer(), llvm::createSPIRVStreamer(), llvm::createWasmStreamer(), llvm::createXCOFFStreamer(), llvm::CSKYTargetELFStreamer::CSKYTargetELFStreamer(), llvm::MCPseudoProbeSections::emit(), emitAbsoluteSymbolDiff(), emitAbsoluteSymbolDiffAsULEB128(), emitAddrsig(), emitAddrsigSym(), llvm::MCELFStreamer::emitAssemblerFlag(), llvm::MCWasmStreamer::emitAssemblerFlag(), llvm::MCWinCOFFStreamer::emitAssemblerFlag(), emitAssignment(), llvm::MCELFStreamer::emitBundleAlignMode(), llvm::MCELFStreamer::emitBundleLock(), llvm::MCELFStreamer::emitBundleUnlock(), llvm::MCELFStreamer::emitCGProfileEntry(), llvm::MCWinCOFFStreamer::emitCGProfileEntry(), llvm::MCWinCOFFStreamer::emitCOFFSafeSEH(), llvm::MCWinCOFFStreamer::emitCOFFSymbolIndex(), llvm::MCWinCOFFStreamer::emitCOFFSymbolStorageClass(), llvm::MCWinCOFFStreamer::emitCOFFSymbolType(), llvm::MCELFStreamer::emitCommonSymbol(), llvm::MCWinCOFFStreamer::emitCommonSymbol(), llvm::MCXCOFFStreamer::emitCommonSymbol(), llvm::MipsTargetELFStreamer::emitDirectiveAbiCalls(), llvm::MipsTargetELFStreamer::emitDirectiveCpLoad(), llvm::MipsTargetELFStreamer::emitDirectiveCpsetup(), llvm::MipsTargetELFStreamer::emitDirectiveEnd(), llvm::MipsTargetELFStreamer::emitDirectiveNaN2008(), llvm::MipsTargetELFStreamer::emitDirectiveNaNLegacy(), llvm::MipsTargetELFStreamer::emitDirectiveOptionPic0(), llvm::MipsTargetELFStreamer::emitDirectiveOptionPic2(), llvm::MipsTargetELFStreamer::emitDirectiveSetMips16(), llvm::MipsTargetELFStreamer::emitDirectiveSetNoReorder(), llvm::RISCVTargetELFStreamer::emitDirectiveVariantCC(), llvm::MCELFStreamer::emitELFSymverDirective(), emitFileDirective(), llvm::MipsTargetELFStreamer::emitFrame(), llvm::MCELFStreamer::emitIdent(), emitInstruction(), llvm::PPCELFStreamer::emitInstruction(), llvm::PPCXCOFFStreamer::emitInstruction(), llvm::MCXCOFFStreamer::emitInstToData(), llvm::MCWinCOFFStreamer::emitInstToData(), emitInstToFragment(), llvm::MipsTargetELFStreamer::emitLabel(), emitLabel(), emitLabelAtPos(), llvm::MCELFStreamer::emitLocalCommonSymbol(), llvm::MipsTargetELFStreamer::emitMipsAbiFlags(), llvm::MipsRegInfoRecord::EmitMipsOptionRecord(), llvm::MCELFStreamer::emitSymbolAttribute(), llvm::MCWasmStreamer::emitSymbolAttribute(), llvm::MCWinCOFFStreamer::emitSymbolAttribute(), llvm::MCXCOFFStreamer::emitSymbolAttribute(), llvm::MCELFStreamer::emitWeakReference(), llvm::MCWasmStreamer::emitWeakReference(), llvm::MCWinCOFFStreamer::emitWeakReference(), llvm::MCXCOFFStreamer::emitXCOFFCInfoSym(), llvm::MCXCOFFStreamer::emitXCOFFExceptDirective(), llvm::MCXCOFFStreamer::emitXCOFFRefDirective(), llvm::MCWinCOFFStreamer::finalizeCGProfile(), llvm::MCWinCOFFStreamer::finalizeCGProfileEntry(), llvm::AMDGPUTargetELFStreamer::finish(), llvm::LoongArchTargetELFStreamer::finish(), llvm::MipsTargetELFStreamer::finish(), llvm::RISCVTargetELFStreamer::finish(), llvm::MCELFStreamer::finishImpl(), finishImpl(), llvm::HexagonMCELFStreamer::HexagonMCEmitCommonSymbol(), llvm::HexagonMCELFStreamer::HexagonMCEmitLocalCommonSymbol(), llvm::LoongArchTargetELFStreamer::LoongArchTargetELFStreamer(), llvm::MipsTargetELFStreamer::MipsTargetELFStreamer(), llvm::MSP430TargetELFStreamer::MSP430TargetELFStreamer(), llvm::RISCVTargetELFStreamer::RISCVTargetELFStreamer(), and llvm::MipsTargetELFStreamer::setUsesMicroMips().

◆ getAssemblerPtr()

MCAssembler * MCObjectStreamer::getAssemblerPtr ( )
overridevirtual

◆ getCurrentFragment()

MCFragment * MCObjectStreamer::getCurrentFragment ( ) const

◆ getOrCreateDataFragment()

MCDataFragment * MCObjectStreamer::getOrCreateDataFragment ( const MCSubtargetInfo STI = nullptr)

◆ insert()

void llvm::MCObjectStreamer::insert ( MCFragment F)
inline

◆ isIntegratedAssemblerRequired()

bool llvm::MCObjectStreamer::isIntegratedAssemblerRequired ( ) const
inlineoverridevirtual

Object streamers require the integrated assembler.

Reimplemented from llvm::MCStreamer.

Definition at line 87 of file MCObjectStreamer.h.

◆ mayHaveInstructions()

bool MCObjectStreamer::mayHaveInstructions ( MCSection Sec) const
overridevirtual

Reimplemented from llvm::MCStreamer.

Definition at line 415 of file MCObjectStreamer.cpp.

References llvm::MCSection::hasInstructions().

◆ reset()

void MCObjectStreamer::reset ( )
overridevirtual

◆ visitUsedSymbol()

void MCObjectStreamer::visitUsedSymbol ( const MCSymbol Sym)
overridevirtual

The documentation for this class was generated from the following files: