LLVM: include/llvm/MC/MCObjectStreamer.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_MC_MCOBJECTSTREAMER_H

10#define LLVM_MC_MCOBJECTSTREAMER_H

11

17

18namespace llvm {

31

32

33

34

35

36

37

38

40 std::unique_ptr Assembler;

41 bool EmitEHFrame;

42 bool EmitDebugFrame;

43 bool EmitSFrame;

44

45 struct PendingAssignment {

48 };

49

50

51

53 pendingAssignments;

54

56

57 size_t FragSpace = 0;

58

59

61

66

67protected:

69 std::unique_ptr OW,

70 std::unique_ptr Emitter);

72

73public:

74

75 void reset() override;

76

77

79

83

84public:

86

89

90

91

96

98

99

100

101 template <typename FT, typename... Args>

103 auto *F = new (SpecialFragAllocator.Allocate(sizeof(FT), alignof(FT)))

104 FT(std::forward(args)...);

105 addSpecialFragment(F);

106 return F;

107 }

108

112

113

115

129

130

131

133

137 unsigned MaxBytesToEmit = 0) override;

139 unsigned MaxBytesToEmit = 0) override;

143 unsigned Flags, unsigned Isa,

144 unsigned Discriminator, StringRef FileName,

145 StringRef Comment = {}) override;

147 const MCSymbol *Label,

148 unsigned PointerSize) override;

150 MCSymbol *EndLabel = nullptr) override;

152 const MCSymbol *Label, SMLoc Loc);

154 const MCSymbol *FREBegin,

155 MCFragment *FDEFrag, SMLoc Loc);

156 void emitCVLocDirective(unsigned FunctionId, unsigned FileNo, unsigned Line,

157 unsigned Column, bool PrologueEnd, bool IsStmt,

158 StringRef FileName, SMLoc Loc) override;

160 const MCSymbol *End) override;

162 unsigned SourceFileId,

163 unsigned SourceLineNum,

164 const MCSymbol *FnStartSym,

165 const MCSymbol *FnEndSym) override;

167 ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,

168 StringRef FixedSizePortion) override;

173 const MCExpr *Expr, SMLoc Loc = {}) override;

175 void emitFill(const MCExpr &NumBytes, uint64_t FillValue,

176 SMLoc Loc = SMLoc()) override;

177 void emitFill(const MCExpr &NumValues, int64_t Size, int64_t Expr,

178 SMLoc Loc = SMLoc()) override;

179 void emitNops(int64_t NumBytes, int64_t ControlledNopLength, SMLoc Loc,

180 const MCSubtargetInfo &STI) override;

182 void emitFileDirective(StringRef Filename, StringRef CompilerVersion,

183 StringRef TimeStamp, StringRef Description) override;

184

187

189

190

191

192

193

194

195

196

197

198

200 unsigned Size) override;

201

203 const MCSymbol *Lo) override;

204

206

207

208

210};

211

212}

213

214#endif

dxil DXContainer Global Emitter

static ManagedStatic< cl::opt< bool, true >, CreateDebug > Debug

This file implements a set that has insertion order iteration characteristics.

This file defines the SmallVector class.

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

Generic interface to target specific assembler backends.

MCCodeEmitter - Generic instruction encoding interface.

Context object for machine code objects.

Base class for the full range of assembler expressions which are needed for parsing.

Instances of this class represent a single low-level machine instruction.

void reset() override

state management

void emitFill(const MCExpr &NumBytes, uint64_t FillValue, SMLoc Loc=SMLoc()) override

Emit Size bytes worth of the value specified by FillValue.

FT * newSpecialFragment(Args &&...args)

Definition MCObjectStreamer.h:102

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 emitAssignment(MCSymbol *Symbol, const MCExpr *Value) override

Emit an assignment of Value to Symbol.

void emitCFISections(bool EH, bool Debug, bool SFrame) override

void emitULEB128Value(const MCExpr *Value) override

void emitSLEB128Value(const MCExpr *Value) override

void emitNops(int64_t NumBytes, int64_t ControlledNopLength, SMLoc Loc, const MCSubtargetInfo &STI) override

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 emitCVStringTableDirective() override

This implements the CodeView '.cv_stringtable' assembler directive.

MCAssembler & getAssembler()

Definition MCObjectStreamer.h:87

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 emitWeakReference(MCSymbol *Alias, const MCSymbol *Target) override

Emit an weak reference from Alias to Symbol.

void appendContents(ArrayRef< char > Contents)

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 emitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr, SMLoc Loc={}) override

Record a relocation described by the .reloc directive.

void emitBytes(StringRef Data) override

Emit the bytes in Data into the output.

void emitPendingAssignments(MCSymbol *Symbol)

Emits pending conditional assignments that depend on Symbol being emitted.

void addFixup(const MCExpr *Value, MCFixupKind Kind)

void emitFileDirective(StringRef Filename) override

Switch to a new logical file.

void emitSFrameCalculateFuncOffset(const MCSymbol *FunCabsel, const MCSymbol *FREBegin, MCFragment *FDEFrag, SMLoc Loc)

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.

MCSymbol * emitCFILabel() override

When emitting an object file, create and emit a real label.

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

This implements the CodeView '.cv_def_range' assembler directive.

MCAssembler * getAssemblerPtr() override

void emitAddrsigSym(const MCSymbol *Sym) override

bool isIntegratedAssemblerRequired() const override

Object streamers require the integrated assembler.

Definition MCObjectStreamer.h:78

void emitDwarfLineEndEntry(MCSection *Section, MCSymbol *LastLabel, MCSymbol *EndLabel=nullptr) override

Emit the debug line end entry.

void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override

Emit the given Instruction into the current section.

void visitUsedSymbol(const MCSymbol &Sym) override

void emitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &)

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

virtual void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCFragment &F, uint64_t Offset)

void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override

Emit a label for Symbol into the current section.

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

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 finishImpl() override

Streamer specific finalization.

void changeSection(MCSection *Section, uint32_t Subsection=0) override

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

void emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi, const MCSymbol *Lo) override

Emit the absolute difference between two symbols encoded with ULEB128.

MCFragment * allocFragSpace(size_t Headroom)

void emitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel, const MCSymbol *Label, SMLoc Loc)

bool mayHaveInstructions(MCSection &Sec) const override

void emitCodeAlignment(Align ByteAlignment, const MCSubtargetInfo *STI, unsigned MaxBytesToEmit=0) override

Emit nops until the byte alignment ByteAlignment is reached.

~MCObjectStreamer() override

void ensureHeadroom(size_t Headroom)

void emitCVFileChecksumOffsetDirective(unsigned FileNo) override

This implements the CodeView '.cv_filechecksumoffset' assembler directive.

void emitAddrsig() override

void emitConditionalAssignment(MCSymbol *Symbol, const MCExpr *Value) override

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

void emitCVFileChecksumsDirective() override

This implements the CodeView '.cv_filechecksums' assembler directive.

void emitCVLinetableDirective(unsigned FunctionId, const MCSymbol *Begin, const MCSymbol *End) override

This implements the CodeView '.cv_linetable' assembler directive.

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.

uint8_t * getCurFragEnd() const

Definition MCObjectStreamer.h:92

void emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) override

Emit the absolute difference between two symbols if possible.

Defines the object file and target independent interfaces used by the assembler backend to write nati...

Instances of this class represent a uniqued identifier for a section in the current translation unit.

MCStreamer(MCContext &Ctx)

void emitFill(uint64_t NumBytes, uint8_t FillValue)

Emit NumBytes bytes worth of the value specified by FillValue.

Generic base class for all target subtargets.

MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...

Represents a location in source code.

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

StringRef - Represent a constant reference to a string, i.e.

Target - Wrapper for Target specific information.

LLVM Value Representation.

This class implements an extremely fast bulk output stream that can only output to a stream.

An abstract base class for streams implementations that also support a pwrite operation.

This is an optimization pass for GlobalISel generic memory operations.

uint16_t MCFixupKind

Extensible enumeration to represent the type of a fixup.

FunctionAddr VTableAddr uintptr_t uintptr_t Data

ArrayRef(const T &OneElt) -> ArrayRef< T >

BumpPtrAllocatorImpl<> BumpPtrAllocator

The standard BumpPtrAllocator which just uses the default template parameters.

This struct is a compact representation of a valid (non-zero power of two) alignment.