LLVM 20.0.0git
Public Types | Public Member Functions | Friends | List of all members
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

 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
uint64_t computeFragmentSize (const MCFragment &F) const
 Compute the effective fragment size.
void layoutBundle (MCFragment *Prev, MCFragment *F) const
uint64_t getFragmentOffset (const MCFragment &F) const
uint64_t getSectionAddressSize (const MCSection &Sec) const
uint64_t getSectionFileSize (const MCSection &Sec) const
bool getSymbolOffset (const MCSymbol &S, uint64_t &Val) const
uint64_t getSymbolOffset (const MCSymbol &S) const
const MCSymbolgetBaseSymbol (const MCSymbol &Symbol) const
void writeSectionData (raw_ostream &OS, const MCSection *Section) const
 Emit the section contents to OS.
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.
void reset ()
 Reuse an assembler instance.
MCContextgetContext () const
MCAsmBackendgetBackendPtr () const
MCCodeEmittergetEmitterPtr () const
MCAsmBackendgetBackend () const
MCCodeEmittergetEmitter () const
MCObjectWritergetWriter () const
MCDwarfLineTableParams getDWARFLinetableParams () const
void Finish ()
 Finish - Do final processing and write the object to the output stream.
void layout ()
bool hasLayout () const
bool getRelaxAll () const
void setRelaxAll (bool Value)
bool isBundlingEnabled () const
unsigned getBundleAlignSize () const
void setBundleAlignSize (unsigned Size)
const_iterator begin () const
const_iterator end () const
iterator_range< pointee_iterator< typename SmallVector< const MCSymbol *, 0 >::const_iterator > > symbols () const
bool registerSection (MCSection &Section)
bool registerSymbol (const MCSymbol &Symbol)
void writeFragmentPadding (raw_ostream &OS, const MCEncodedFragment &F, uint64_t FSize) const
 Write the necessary bundle padding to OS.
void dump () const


class MCObjectWriter

Detailed Description

Definition at line 53 of file MCAssembler.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 57 of file MCAssembler.h.

◆ SectionListType

Definition at line 56 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 82 of file MCAssembler.cpp.

◆ MCAssembler() [2/2]

llvm::MCAssembler::MCAssembler ( const MCAssembler )

Member Function Documentation

◆ begin()

const_iterator llvm::MCAssembler::begin ( ) const

◆ computeFragmentSize()

uint64_t MCAssembler::computeFragmentSize ( const MCFragment F) const

◆ dump()

LLVM_DUMP_METHOD void MCAssembler::dump ( ) const

Definition at line 1324 of file MCAssembler.cpp.

References llvm::MCSection::dump(), llvm::errs(), llvm::First, OS, Sym, and symbols().

Referenced by layout().

◆ end()

const_iterator llvm::MCAssembler::end ( ) const

◆ 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 1021 of file MCAssembler.cpp.

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

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

◆ getBackend()

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

◆ getBackendPtr()

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

◆ getBaseSymbol()

const MCSymbol * MCAssembler::getBaseSymbol ( const MCSymbol Symbol) const

◆ getBundleAlignSize()

unsigned llvm::MCAssembler::getBundleAlignSize ( ) const

◆ getContext()

MCContext & llvm::MCAssembler::getContext ( ) const

◆ getDWARFLinetableParams()

MCDwarfLineTableParams llvm::MCAssembler::getDWARFLinetableParams ( ) const

Definition at line 194 of file MCAssembler.h.

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

◆ getEmitter()

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

◆ getEmitterPtr()

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

◆ getFragmentOffset()

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

Definition at line 153 of file MCAssembler.h.

References F.

Referenced by computeFragmentSize(), and getSectionAddressSize().

◆ getRelaxAll()

bool llvm::MCAssembler::getRelaxAll ( ) const

Definition at line 205 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 539 of file MCAssembler.cpp.

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

Referenced by writeSectionData().

◆ getSymbolOffset() [1/2]

uint64_t MCAssembler::getSymbolOffset ( const MCSymbol S) const

Definition at line 489 of file MCAssembler.cpp.

References getSymbolOffsetImpl().

◆ getSymbolOffset() [2/2]

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

Definition at line 485 of file MCAssembler.cpp.

References getSymbolOffsetImpl().

Referenced by computeFragmentSize().

◆ getWriter()

MCObjectWriter & llvm::MCAssembler::getWriter ( ) const

◆ hasLayout()

bool llvm::MCAssembler::hasLayout ( ) const

Definition at line 204 of file MCAssembler.h.

◆ isBundlingEnabled()

bool llvm::MCAssembler::isBundlingEnabled ( ) const

◆ isThumbFunc()

bool MCAssembler::isThumbFunc ( const MCSymbol Func) const

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

Definition at line 114 of file MCAssembler.cpp.

References llvm::MCExpr::evaluateAsRelocatable(), isThumbFunc(), llvm::Ref, Sym, and llvm::MCSymbolRefExpr::VK_None.

Referenced by isThumbFunc().

◆ layout()

void MCAssembler::layout ( )

◆ layoutBundle()

void MCAssembler::layoutBundle ( MCFragment Prev,
MCFragment F 
) const

◆ operator=()

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

◆ registerSection()

bool MCAssembler::registerSection ( MCSection Section)

◆ registerSymbol()

bool MCAssembler::registerSymbol ( const MCSymbol Symbol)

◆ reset()

void MCAssembler::reset ( )

◆ setBundleAlignSize()

void llvm::MCAssembler::setBundleAlignSize ( unsigned  Size)

Definition at line 212 of file MCAssembler.h.

References assert(), and Size.

Referenced by llvm::MCELFStreamer::emitBundleAlignMode().

◆ setIsThumbFunc()

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

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

Definition at line 176 of file MCAssembler.h.

References llvm::SmallPtrSetImpl< PtrType >::insert().

◆ setRelaxAll()

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

Definition at line 206 of file MCAssembler.h.

◆ symbols()

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

Definition at line 223 of file MCAssembler.h.

References llvm::make_pointee_range().

Referenced by dump().

◆ writeFragmentPadding()

void MCAssembler::writeFragmentPadding ( raw_ostream OS,
const MCEncodedFragment F,
uint64_t  FSize 
) const

◆ writeSectionData()

void MCAssembler::writeSectionData ( raw_ostream OS,
const MCSection Section 
) const

Friends And Related Function Documentation

◆ MCObjectWriter

friend class MCObjectWriter

Definition at line 55 of file MCAssembler.h.

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