LLVM 22.0.0git
llvm::MCAssembler Class Reference

#include "llvm/MC/MCAssembler.h"

Public Types

using SectionListType = SmallVector<MCSection *, 0>
using const_iterator = pointee_iterator<SectionListType::const_iterator>

Public Member Functions

LLVM_ABI MCAssembler (MCContext &Context, std::unique_ptr< MCAsmBackend > Backend, std::unique_ptr< MCCodeEmitter > Emitter, std::unique_ptr< MCObjectWriter > Writer)
 Construct a new assembler instance.
 MCAssembler (const MCAssembler &)=delete
MCAssembleroperator= (const MCAssembler &)=delete
LLVM_ABI uint64_t computeFragmentSize (const MCFragment &F) const
 Compute the effective fragment size.
uint64_t getFragmentOffset (const MCFragment &F) const
LLVM_ABI uint64_t getSectionAddressSize (const MCSection &Sec) const
LLVM_ABI uint64_t getSectionFileSize (const MCSection &Sec) const
LLVM_ABI bool getSymbolOffset (const MCSymbol &S, uint64_t &Val) const
LLVM_ABI uint64_t getSymbolOffset (const MCSymbol &S) const
LLVM_ABI const MCSymbolgetBaseSymbol (const MCSymbol &Symbol) const
LLVM_ABI void writeSectionData (raw_ostream &OS, const MCSection *Section) const
 Emit the section contents to OS.
LLVM_ABI bool isThumbFunc (const MCSymbol *Func) const
 Check whether a given symbol has been flagged with .thumb_func.
void setIsThumbFunc (const MCSymbol *Func)
 Flag a function symbol as the target of a .thumb_func directive.
LLVM_ABI void reset ()
 Reuse an assembler instance.
MCContextgetContext () const
MCAsmBackendgetBackendPtr () const
MCCodeEmittergetEmitterPtr () const
MCAsmBackendgetBackend () const
MCCodeEmittergetEmitter () const
MCObjectWritergetWriter () const
MCDwarfLineTableParams getDWARFLinetableParams () const
LLVM_ABI void Finish ()
 Finish - Do final processing and write the object to the output stream.
LLVM_ABI void layout ()
bool hasLayout () const
bool hasFinalLayout () const
bool getRelaxAll () const
void setRelaxAll (bool Value)
const_iterator begin () const
const_iterator end () const
SmallVectorImpl< const MCSymbol * > & getSymbols ()
iterator_range< pointee_iterator< typename SmallVector< const MCSymbol *, 0 >::const_iterator > > symbols () const
LLVM_ABI bool registerSection (MCSection &Section)
LLVM_ABI bool registerSymbol (const MCSymbol &Symbol)
LLVM_ABI void addRelocDirective (RelocDirective RD)
LLVM_ABI void reportError (SMLoc L, const Twine &Msg) const
LLVM_ABI void recordError (SMLoc L, const Twine &Msg) const
LLVM_ABI void flushPendingErrors () const
LLVM_ABI void dump () const

Friends

class MCObjectWriter

Detailed Description

Definition at line 49 of file MCAssembler.h.

Member Typedef Documentation

◆ const_iterator

◆ SectionListType

Definition at line 52 of file MCAssembler.h.

Constructor & Destructor Documentation

◆ MCAssembler() [1/2]

MCAssembler::MCAssembler ( MCContext & Context,
std::unique_ptr< MCAsmBackend > Backend,
std::unique_ptr< MCCodeEmitter > Emitter,
std::unique_ptr< MCObjectWriter > Writer )

Construct a new assembler instance.

Definition at line 78 of file MCAssembler.cpp.

References if(), and llvm::move().

Referenced by MCAssembler(), and operator=().

◆ MCAssembler() [2/2]

llvm::MCAssembler::MCAssembler ( const MCAssembler & )
delete

References MCAssembler().

Member Function Documentation

◆ addRelocDirective()

void MCAssembler::addRelocDirective ( RelocDirective RD)

Definition at line 377 of file MCAssembler.cpp.

Referenced by llvm::MCObjectStreamer::emitRelocDirective().

◆ begin()

const_iterator llvm::MCAssembler::begin ( ) const
inline

Definition at line 196 of file MCAssembler.h.

◆ computeFragmentSize()

◆ dump()

◆ end()

const_iterator llvm::MCAssembler::end ( ) const
inline

Definition at line 197 of file MCAssembler.h.

◆ Finish()

void MCAssembler::Finish ( )

Finish - Do final processing and write the object to the output stream.

Writer is used for custom object writer (as the MCJIT does), if not specified it is automatically created from backend.

Definition at line 730 of file MCAssembler.cpp.

References assert(), getWriter(), layout(), and llvm::MCObjectWriter::writeObject().

Referenced by llvm::MCObjectStreamer::finishImpl().

◆ flushPendingErrors()

void MCAssembler::flushPendingErrors ( ) const

Definition at line 1026 of file MCAssembler.cpp.

References reportError().

Referenced by layout(), and writeSectionData().

◆ getBackend()

MCAsmBackend & llvm::MCAssembler::getBackend ( ) const
inline

◆ getBackendPtr()

MCAsmBackend * llvm::MCAssembler::getBackendPtr ( ) const
inline

Definition at line 171 of file MCAssembler.h.

Referenced by computeFragmentSize(), layout(), reset(), and writeSectionData().

◆ getBaseSymbol()

◆ getContext()

◆ getDWARFLinetableParams()

MCDwarfLineTableParams llvm::MCAssembler::getDWARFLinetableParams ( ) const
inline

Definition at line 181 of file MCAssembler.h.

◆ getEmitter()

MCCodeEmitter & llvm::MCAssembler::getEmitter ( ) const
inline

Definition at line 177 of file MCAssembler.h.

Referenced by llvm::MCObjectStreamer::emitInstToFragment().

◆ getEmitterPtr()

MCCodeEmitter * llvm::MCAssembler::getEmitterPtr ( ) const
inline

◆ getFragmentOffset()

uint64_t llvm::MCAssembler::getFragmentOffset ( const MCFragment & F) const
inline

Definition at line 139 of file MCAssembler.h.

References F.

Referenced by computeFragmentSize(), and getSectionAddressSize().

◆ getRelaxAll()

bool llvm::MCAssembler::getRelaxAll ( ) const
inline

Definition at line 193 of file MCAssembler.h.

◆ getSectionAddressSize()

uint64_t MCAssembler::getSectionAddressSize ( const MCSection & Sec) const

◆ getSectionFileSize()

uint64_t MCAssembler::getSectionFileSize ( const MCSection & Sec) const

Definition at line 361 of file MCAssembler.cpp.

References getSectionAddressSize(), and llvm::MCSection::isBssSection().

Referenced by writeSectionData().

◆ getSymbolOffset() [1/2]

uint64_t MCAssembler::getSymbolOffset ( const MCSymbol & S) const

Definition at line 315 of file MCAssembler.cpp.

References getSymbolOffsetImpl().

◆ getSymbolOffset() [2/2]

bool MCAssembler::getSymbolOffset ( const MCSymbol & S,
uint64_t & Val ) const

Definition at line 311 of file MCAssembler.cpp.

References getSymbolOffsetImpl().

Referenced by computeFragmentSize().

◆ getSymbols()

SmallVectorImpl< const MCSymbol * > & llvm::MCAssembler::getSymbols ( )
inline

Definition at line 199 of file MCAssembler.h.

◆ getWriter()

◆ hasFinalLayout()

bool llvm::MCAssembler::hasFinalLayout ( ) const
inline

Definition at line 192 of file MCAssembler.h.

◆ hasLayout()

bool llvm::MCAssembler::hasLayout ( ) const
inline

Definition at line 191 of file MCAssembler.h.

◆ isThumbFunc()

bool MCAssembler::isThumbFunc ( const MCSymbol * Func) const

Check whether a given symbol has been flagged with .thumb_func.

Definition at line 115 of file MCAssembler.cpp.

References llvm::MCExpr::evaluateAsRelocatable(), llvm::MCValue::getAddSym(), and isThumbFunc().

Referenced by isThumbFunc().

◆ layout()

◆ operator=()

MCAssembler & llvm::MCAssembler::operator= ( const MCAssembler & )
delete

References F, LLVM_ABI, and MCAssembler().

◆ recordError()

void MCAssembler::recordError ( SMLoc L,
const Twine & Msg ) const

Definition at line 1022 of file MCAssembler.cpp.

References llvm::Twine::str().

Referenced by computeFragmentSize().

◆ registerSection()

bool MCAssembler::registerSection ( MCSection & Section)

Definition at line 107 of file MCAssembler.cpp.

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

◆ registerSymbol()

◆ reportError()

void MCAssembler::reportError ( SMLoc L,
const Twine & Msg ) const

◆ reset()

void MCAssembler::reset ( )

Reuse an assembler instance.

Definition at line 90 of file MCAssembler.cpp.

References getBackendPtr(), getEmitterPtr(), llvm::MCAsmBackend::reset(), and llvm::MCCodeEmitter::reset().

◆ setIsThumbFunc()

void llvm::MCAssembler::setIsThumbFunc ( const MCSymbol * Func)
inline

Flag a function symbol as the target of a .thumb_func directive.

Definition at line 163 of file MCAssembler.h.

◆ setRelaxAll()

void llvm::MCAssembler::setRelaxAll ( bool Value)
inline

Definition at line 194 of file MCAssembler.h.

◆ symbols()

iterator_range< pointee_iterator< typename SmallVector< const MCSymbol *, 0 >::const_iterator > > llvm::MCAssembler::symbols ( ) const
inline

Definition at line 202 of file MCAssembler.h.

References llvm::make_pointee_range().

Referenced by dump().

◆ writeSectionData()

◆ MCObjectWriter

friend class MCObjectWriter
friend

Definition at line 51 of file MCAssembler.h.

References MCObjectWriter.

Referenced by getWriter(), and MCObjectWriter.


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