LLVM 22.0.0git
llvm::MCTargetStreamer Class Reference

Target specific streamer interface. More...

#include "llvm/MC/MCStreamer.h"

Inheritance diagram for llvm::MCTargetStreamer:
[legend]

Public Member Functions

 MCTargetStreamer (MCStreamer &S)
virtual ~MCTargetStreamer ()
MCStreamergetStreamer ()
MCContextgetContext ()
virtual void emitLabel (MCSymbol *Symbol)
virtual void emitAssignment (MCSymbol *Symbol, const MCExpr *Value)
virtual void prettyPrintAsm (MCInstPrinter &InstPrinter, uint64_t Address, const MCInst &Inst, const MCSubtargetInfo &STI, raw_ostream &OS)
virtual void emitDwarfFileDirective (StringRef Directive)
virtual void changeSection (const MCSection *CurSection, MCSection *Section, uint32_t SubSection, raw_ostream &OS)
 Update streamer for a new active section.
virtual void emitValue (const MCExpr *Value)
virtual void emitRawBytes (StringRef Data)
 Emit the bytes in Data into the output.
virtual void emitConstantPools ()
virtual void finish ()

Protected Attributes

MCStreamerStreamer

Detailed Description

Target specific streamer interface.

This is used so that targets can implement support for target specific assembly directives.

If target foo wants to use this, it should implement 3 classes:

  • FooTargetStreamer : public MCTargetStreamer
  • FooTargetAsmStreamer : public FooTargetStreamer
  • FooTargetELFStreamer : public FooTargetStreamer

FooTargetStreamer should have a pure virtual method for each directive. For example, for a ".bar symbol_name" directive, it should have virtual emitBar(const MCSymbol &Symbol) = 0;

The FooTargetAsmStreamer and FooTargetELFStreamer classes implement the method. The assembly streamer just prints ".bar symbol_name". The object streamer does whatever is needed to implement .bar in the object file.

In the assembly printer and parser the target streamer can be used by calling getTargetStreamer and casting it to FooTargetStreamer:

MCTargetStreamer &TS = OutStreamer.getTargetStreamer(); FooTargetStreamer &ATS = static_cast<FooTargetStreamer &>(TS);

The base classes FooTargetAsmStreamer and FooTargetELFStreamer should never be treated differently. Callers should always talk to a FooTargetStreamer.

Definition at line 93 of file MCStreamer.h.

Constructor & Destructor Documentation

◆ MCTargetStreamer()

◆ ~MCTargetStreamer()

MCTargetStreamer::~MCTargetStreamer ( )
virtualdefault

Member Function Documentation

◆ changeSection()

void MCTargetStreamer::changeSection ( const MCSection * CurSection,
MCSection * Section,
uint32_t SubSection,
raw_ostream & OS )
virtual

Update streamer for a new active section.

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

Reimplemented in llvm::NVPTXTargetStreamer, and llvm::SPIRVTargetStreamer.

Definition at line 59 of file MCStreamer.cpp.

References Streamer.

◆ emitAssignment()

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

Reimplemented in llvm::MipsTargetELFStreamer.

Definition at line 90 of file MCStreamer.cpp.

Referenced by llvm::MCStreamer::emitAssignment().

◆ emitConstantPools()

void MCTargetStreamer::emitConstantPools ( )
virtual

◆ emitDwarfFileDirective()

void MCTargetStreamer::emitDwarfFileDirective ( StringRef Directive)
virtual

Reimplemented in llvm::NVPTXTargetStreamer.

Definition at line 66 of file MCStreamer.cpp.

References Streamer.

◆ emitLabel()

void MCTargetStreamer::emitLabel ( MCSymbol * Symbol)
virtual

Reimplemented in llvm::MipsTargetELFStreamer.

Definition at line 53 of file MCStreamer.cpp.

Referenced by llvm::MCStreamer::emitLabel().

◆ emitRawBytes()

void MCTargetStreamer::emitRawBytes ( StringRef Data)
virtual

Emit the bytes in Data into the output.

This is used to emit bytes in Data as sequence of .byte directives.

Reimplemented in llvm::NVPTXTargetStreamer.

Definition at line 78 of file MCStreamer.cpp.

References llvm::CallingConv::C, llvm::Data, llvm::MCAsmInfo::getData8bitsDirective(), llvm::raw_svector_ostream::str(), and Streamer.

Referenced by llvm::NVPTXTargetStreamer::emitRawBytes().

◆ emitValue()

void MCTargetStreamer::emitValue ( const MCExpr * Value)
virtual

Reimplemented in llvm::NVPTXTargetStreamer.

Definition at line 70 of file MCStreamer.cpp.

References llvm::raw_svector_ostream::str(), and Streamer.

Referenced by llvm::NVPTXTargetStreamer::emitValue().

◆ finish()

◆ getContext()

MCContext & llvm::MCTargetStreamer::getContext ( )
inline

◆ getStreamer()

◆ prettyPrintAsm()

void MCTargetStreamer::prettyPrintAsm ( MCInstPrinter & InstPrinter,
uint64_t Address,
const MCInst & Inst,
const MCSubtargetInfo & STI,
raw_ostream & OS )
virtual

Definition at line 1155 of file MCStreamer.cpp.

References llvm::Address, and llvm::MCInstPrinter::printInst().

Member Data Documentation

◆ Streamer


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