Go to the documentation of this file.
9 #ifndef LLVM_MC_MCOBJECTSTREAMER_H
10 #define LLVM_MC_MCOBJECTSTREAMER_H
24 struct MCDwarfFrameInfo;
27 class MCSubtargetInfo;
33 class raw_pwrite_stream;
43 std::unique_ptr<MCAssembler> Assembler;
49 unsigned CurSubsectionIdx;
50 struct PendingMCFixup {
55 : Sym(McSym),
Fixup(McFixup),
DF(
F) {}
59 struct PendingAssignment {
74 void resolvePendingFixups();
78 std::unique_ptr<MCObjectWriter> OW,
79 std::unique_ptr<MCCodeEmitter>
Emitter);
84 void reset()
override;
98 F->setParent(CurSection);
156 unsigned ValueSize = 1,
157 unsigned MaxBytesToEmit = 0)
override;
159 unsigned MaxBytesToEmit = 0)
override;
163 unsigned Flags,
unsigned Isa,
164 unsigned Discriminator,
173 unsigned Column,
bool PrologueEnd,
bool IsStmt,
178 unsigned SourceFileId,
179 unsigned SourceLineNum,
183 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
194 std::optional<std::pair<bool, std::string>>
200 void emitFill(
const MCExpr &NumValues, int64_t Size, int64_t Expr,
202 void emitNops(int64_t NumBytes, int64_t ControlledNopLength,
SMLoc Loc,
223 unsigned Size)
override;
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 emitCVLinetableDirective(unsigned FunctionId, const MCSymbol *Begin, const MCSymbol *End) override
This implements the CodeView '.cv_linetable' assembler directive.
void emitFileDirective(StringRef Filename) override
Switch to a new logical file.
This is an optimization pass for GlobalISel generic memory operations.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
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.
Context object for machine code objects.
MCObjectStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
void emitDTPRel64Value(const MCExpr *Value) override
Emit the expression Value into the output as a dtprel (64-bit DTP relative) value.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
void emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi, const MCSymbol *Lo) override
Emit the absolute difference between two symbols encoded with ULEB128.
void emitBundleLock(bool AlignToEnd) override
The following instructions are a bundle-locked group.
void emitConditionalAssignment(MCSymbol *Symbol, const MCExpr *Value) override
Emit an assignment of Value to Symbol, but only if Value is also emitted.
void emitCFISections(bool EH, bool Debug) override
void emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) override
Emit the absolute difference between two symbols if possible.
virtual void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCFragment *F, uint64_t Offset)
void emitCodeAlignment(Align ByteAlignment, const MCSubtargetInfo *STI, unsigned MaxBytesToEmit=0) override
Emit nops until the byte alignment ByteAlignment is reached.
void visitUsedSymbol(const MCSymbol &Sym) override
void emitCVFileChecksumOffsetDirective(unsigned FileNo) override
This implements the CodeView '.cv_filechecksumoffset' assembler directive.
Instances of this class represent a single low-level machine instruction.
void changeSection(MCSection *Section, const MCExpr *Subsection) override
Update streamer for a new active section.
void reset() override
state management
void emitDTPRel32Value(const MCExpr *Value) override
Emit the expression Value into the output as a dtprel (32-bit DTP relative) value.
MCSection::FragmentListType & getFragmentList()
Streaming machine code generation interface.
dxil DXContainer Global Emitter
Generic interface to target specific assembler backends.
Represents a location in source code.
void emitGPRel32Value(const MCExpr *Value) override
Emit the expression Value into the output as a gprel32 (32-bit GP relative) value.
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 emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
constexpr uint64_t PointerSize
aarch64 pointer size.
Streaming object file generation interface.
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 emitPendingAssignments(MCSymbol *Symbol)
Emits pending conditional assignments that depend on Symbol being emitted.
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 outp...
void emitDwarfLineEndEntry(MCSection *Section, MCSymbol *LastLabel) override
Emit the debug line end entry.
void emitTPRel32Value(const MCExpr *Value) override
Emit the expression Value into the output as a tprel (32-bit TP relative) value.
void emitNops(int64_t NumBytes, int64_t ControlledNopLength, SMLoc Loc, const MCSubtargetInfo &STI) override
void emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override
Emit an assignment of Value to Symbol.
MCFragment * getCurrentFragment() const
This struct is a compact representation of a valid (non-zero power of two) alignment.
MCSection * getCurrentSectionOnly() const
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.
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
void addPendingLabel(MCSymbol *label)
Assign a label to the current Section and Subsection even though a fragment is not yet present.
void emitBundleAlignMode(Align Alignment) override
Set the bundle alignment mode from now on in the section.
void emitCVFileChecksumsDirective() override
This implements the CodeView '.cv_filechecksums' assembler directive.
void emitBundleUnlock() override
Ends a bundle-locked group.
void emitSLEB128Value(const MCExpr *Value) override
void insert(MCFragment *F)
bool isIntegratedAssemblerRequired() const override
Object streamers require the integrated assembler.
MCAssembler & getAssembler()
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
MCDataFragment * getOrCreateDataFragment(const MCSubtargetInfo *STI=nullptr)
Get a data fragment to write into, creating a new one if the current fragment is not a data fragment.
PowerPC TLS Dynamic Call Fixup
bool changeSectionImpl(MCSection *Section, const MCExpr *Subsection)
StringRef - Represent a constant reference to a string, i.e.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override
Emit an weak reference from Alias to Symbol.
virtual void emitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &)
Emit an instruction to a special fragment, because this instruction can change its size during relaxa...
void emitAddrsigSym(const MCSymbol *Sym) override
void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc=SMLoc()) override
Emit Size bytes worth of the value specified by FillValue.
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.
Iterator for intrusive lists based on ilist_node.
void emitULEB128Value(const MCExpr *Value) override
void emitCVDefRangeDirective(ArrayRef< std::pair< const MCSymbol *, const MCSymbol * >> Ranges, StringRef FixedSizePortion) override
This implements the CodeView '.cv_def_range' assembler directive.
void emitAddrsig() override
iterator insert(iterator where, pointer New)
void emitCVStringTableDirective() override
This implements the CodeView '.cv_stringtable' assembler directive.
void emitBytes(StringRef Data) override
Emit the bytes in Data into the output.
void flushPendingLabels()
Create a data fragment for any pending labels across all Sections and Subsections.
void emitFill(uint64_t NumBytes, uint8_t FillValue)
Emit NumBytes bytes worth of the value specified by FillValue.
void emitGPRel64Value(const MCExpr *Value) override
Emit the expression Value into the output as a gprel64 (64-bit GP relative) value.
A SetVector that performs no allocations if smaller than a certain size.
void emitTPRel64Value(const MCExpr *Value) override
Emit the expression Value into the output as a tprel (64-bit TP relative) value.
bool mayHaveInstructions(MCSection &Sec) const override
void finishImpl() override
Streamer specific finalization.
void emitFrames(MCAsmBackend *MAB)
Fragment for data and encoded instructions.
void emitCVInlineLinetableDirective(unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym) override
This implements the CodeView '.cv_inline_linetable' assembler directive.
Generic base class for all target subtargets.
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
LLVM Value Representation.
Base class for the full range of assembler expressions which are needed for parsing.
void emitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel, const MCSymbol *Label)
MCAssembler * getAssemblerPtr() override