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
 

Friends

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 )
delete

Member Function Documentation

◆ begin()

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

◆ 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
inline

◆ 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
inline

◆ getBackendPtr()

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

◆ getBaseSymbol()

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

◆ getBundleAlignSize()

unsigned llvm::MCAssembler::getBundleAlignSize ( ) const
inline

◆ getContext()

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

◆ getDWARFLinetableParams()

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

Definition at line 194 of file MCAssembler.h.

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

◆ getEmitter()

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

◆ getEmitterPtr()

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

◆ getFragmentOffset()

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

Definition at line 153 of file MCAssembler.h.

References F.

Referenced by computeFragmentSize(), and getSectionAddressSize().

◆ getRelaxAll()

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

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
inline

◆ hasLayout()

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

Definition at line 204 of file MCAssembler.h.

◆ isBundlingEnabled()

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

◆ 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 )
delete

◆ registerSection()

bool MCAssembler::registerSection ( MCSection Section)

◆ registerSymbol()

bool MCAssembler::registerSymbol ( const MCSymbol Symbol)

◆ reset()

void MCAssembler::reset ( )

◆ setBundleAlignSize()

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

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)
inline

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)
inline

Definition at line 206 of file MCAssembler.h.

◆ symbols()

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

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
friend

Definition at line 55 of file MCAssembler.h.


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