class RecordStreamer

Declaration

class RecordStreamer : public MCStreamer { /* full declaration omitted */ };

Description

Streaming machine code generation interface. This interface is intended to provide a programmatic interface that is very similar to the level that an assembler .s file provides. It has callbacks to emit bytes, handle directives, etc. The implementation of this interface retains state to know what the current section is etc. There are multiple implementations of this interface: one for writing out a .s file, and implementations that write out .o files of various formats.

Declared at: llvm/lib/Object/RecordStreamer.h:24

Inherits from: MCStreamer

Member Variables

private const llvm::Module& M
private StringMap<llvm::RecordStreamer::State> Symbols
private DenseMap<const llvm::MCSymbol*, std::vector<StringRef>> SymverAliasMap

Method Overview

  • public RecordStreamer(llvm::MCContext & Context, const llvm::Module & M)
  • public llvm::RecordStreamer::const_iterator begin()
  • public void beginCOFFSymbolDef(const llvm::MCSymbol * Symbol)
  • public void emitAssignment(llvm::MCSymbol * Symbol, const llvm::MCExpr * Value)
  • public void emitCOFFSymbolStorageClass(int StorageClass)
  • public void emitCOFFSymbolType(int Type)
  • public void emitCommonSymbol(llvm::MCSymbol * Symbol, uint64_t Size, unsigned int ByteAlignment)
  • public void emitELFSymverDirective(const llvm::MCSymbol * OriginalSym, llvm::StringRef Name, bool KeepOriginalSym)
  • public void emitInstruction(const llvm::MCInst & Inst, const llvm::MCSubtargetInfo & STI)
  • public void emitLabel(llvm::MCSymbol * Symbol, llvm::SMLoc Loc = llvm::SMLoc())
  • public bool emitSymbolAttribute(llvm::MCSymbol * Symbol, llvm::MCSymbolAttr Attribute)
  • public void emitZerofill(llvm::MCSection * Section, llvm::MCSymbol * Symbol, uint64_t Size, unsigned int ByteAlignment, llvm::SMLoc Loc = llvm::SMLoc())
  • public llvm::RecordStreamer::const_iterator end()
  • public void endCOFFSymbolDef()
  • public void flushSymverDirectives()
  • private llvm::RecordStreamer::State getSymbolState(const llvm::MCSymbol * Sym)
  • private void markDefined(const llvm::MCSymbol & Symbol)
  • private void markGlobal(const llvm::MCSymbol & Symbol, llvm::MCSymbolAttr Attribute)
  • private void markUsed(const llvm::MCSymbol & Symbol)
  • public iterator_range<llvm::RecordStreamer::const_symver_iterator> symverAliases()
  • private void visitUsedSymbol(const llvm::MCSymbol & Sym)

Inherited from MCStreamer:

Methods

RecordStreamer(llvm::MCContext& Context,
               const llvm::Module& M)

Declared at: llvm/lib/Object/RecordStreamer.h:46

Parameters

llvm::MCContext& Context
const llvm::Module& M

llvm::RecordStreamer::const_iterator begin()

Declared at: llvm/lib/Object/RecordStreamer.h:75

void beginCOFFSymbolDef(
    const llvm::MCSymbol* Symbol)

Description

Start emitting COFF symbol definition

Declared at: llvm/lib/Object/RecordStreamer.h:60

Parameters

const llvm::MCSymbol* Symbol
- The symbol to have its External & Type fields set.

void emitAssignment(llvm::MCSymbol* Symbol,
                    const llvm::MCExpr* Value)

Description

Emit an assignment of \p Value to \p 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.

Declared at: llvm/lib/Object/RecordStreamer.h:50

Parameters

llvm::MCSymbol* Symbol
- The symbol being assigned to.
const llvm::MCExpr* Value
- The value for the symbol.

void emitCOFFSymbolStorageClass(int StorageClass)

Description

Emit the storage class of the symbol.

Declared at: llvm/lib/Object/RecordStreamer.h:61

Parameters

int StorageClass
- The storage class the symbol should have.

void emitCOFFSymbolType(int Type)

Description

Emit the type of the symbol.

Declared at: llvm/lib/Object/RecordStreamer.h:62

Parameters

int Type
- A COFF type identifier (see COFF::SymbolType in X86COFF.h)

void emitCommonSymbol(llvm::MCSymbol* Symbol,
                      uint64_t Size,
                      unsigned int ByteAlignment)

Description

Emit a common symbol.

Declared at: llvm/lib/Object/RecordStreamer.h:54

Parameters

llvm::MCSymbol* Symbol
- The common symbol to emit.
uint64_t Size
- The size of the common symbol.
unsigned int ByteAlignment
- The alignment of the symbol if non-zero. This must be a power of 2.

void emitELFSymverDirective(
    const llvm::MCSymbol* OriginalSym,
    llvm::StringRef Name,
    bool KeepOriginalSym)

Description

Record .symver aliases for later processing.

Declared at: llvm/lib/Object/RecordStreamer.h:66

Parameters

const llvm::MCSymbol* OriginalSym
llvm::StringRef Name
bool KeepOriginalSym

void emitInstruction(
    const llvm::MCInst& Inst,
    const llvm::MCSubtargetInfo& STI)

Description

Emit the given \p Instruction into the current section.

Declared at: llvm/lib/Object/RecordStreamer.h:48

Parameters

const llvm::MCInst& Inst
const llvm::MCSubtargetInfo& STI

void emitLabel(llvm::MCSymbol* Symbol,
               llvm::SMLoc Loc = llvm::SMLoc())

Description

Emit a label for \p Symbol into the current section. This corresponds to an assembler statement such as: foo:

Declared at: llvm/lib/Object/RecordStreamer.h:49

Parameters

llvm::MCSymbol* 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.
llvm::SMLoc Loc = llvm::SMLoc()

bool emitSymbolAttribute(
    llvm::MCSymbol* Symbol,
    llvm::MCSymbolAttr Attribute)

Description

Add the given \p Attribute to \p Symbol.

Declared at: llvm/lib/Object/RecordStreamer.h:51

Parameters

llvm::MCSymbol* Symbol
llvm::MCSymbolAttr Attribute

void emitZerofill(llvm::MCSection* Section,
                  llvm::MCSymbol* Symbol,
                  uint64_t Size,
                  unsigned int ByteAlignment,
                  llvm::SMLoc Loc = llvm::SMLoc())

Description

Emit the zerofill section and an optional symbol.

Declared at: llvm/lib/Object/RecordStreamer.h:52

Parameters

llvm::MCSection* Section
- The zerofill section to create and or to put the symbol
llvm::MCSymbol* Symbol
- The zerofill symbol to emit, if non-NULL.
uint64_t Size
- The size of the zerofill symbol.
unsigned int ByteAlignment
- The alignment of the zerofill symbol if non-zero. This must be a power of 2 on some targets.
llvm::SMLoc Loc = llvm::SMLoc()

llvm::RecordStreamer::const_iterator end()

Declared at: llvm/lib/Object/RecordStreamer.h:76

void endCOFFSymbolDef()

Description

Marks the end of the symbol definition.

Declared at: llvm/lib/Object/RecordStreamer.h:63

void flushSymverDirectives()

Declared at: llvm/lib/Object/RecordStreamer.h:71

llvm::RecordStreamer::State getSymbolState(
    const llvm::MCSymbol* Sym)

Description

Get the state recorded for the given symbol.

Declared at: llvm/lib/Object/RecordStreamer.h:38

Parameters

const llvm::MCSymbol* Sym

void markDefined(const llvm::MCSymbol& Symbol)

Declared at: llvm/lib/Object/RecordStreamer.h:40

Parameters

const llvm::MCSymbol& Symbol

void markGlobal(const llvm::MCSymbol& Symbol,
                llvm::MCSymbolAttr Attribute)

Declared at: llvm/lib/Object/RecordStreamer.h:41

Parameters

const llvm::MCSymbol& Symbol
llvm::MCSymbolAttr Attribute

void markUsed(const llvm::MCSymbol& Symbol)

Declared at: llvm/lib/Object/RecordStreamer.h:42

Parameters

const llvm::MCSymbol& Symbol

iterator_range<
    llvm::RecordStreamer::const_symver_iterator>
symverAliases()

Declared at: llvm/lib/Object/RecordStreamer.h:80

void visitUsedSymbol(const llvm::MCSymbol& Sym)

Declared at: llvm/lib/Object/RecordStreamer.h:43

Parameters

const llvm::MCSymbol& Sym