LLVM 22.0.0git
Classes | 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

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

Definition at line 53 of file MCAssembler.h.

◆ 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 Context.

◆ MCAssembler() [2/2]

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

Member Function Documentation

◆ addRelocDirective()

void MCAssembler::addRelocDirective ( RelocDirective  RD)

◆ 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

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

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

◆ getContext()

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

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

References Emitter.

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

◆ getEmitterPtr()

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

◆ getFragmentOffset()

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

◆ getRelaxAll()

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

Definition at line 193 of file MCAssembler.h.

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

◆ getSectionAddressSize()

uint64_t MCAssembler::getSectionAddressSize ( const MCSection Sec) const

◆ getSectionFileSize()

uint64_t MCAssembler::getSectionFileSize ( const MCSection Sec) const

◆ 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

◆ getSymbols()

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

Definition at line 199 of file MCAssembler.h.

◆ getWriter()

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

◆ 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(), isThumbFunc(), and Sym.

Referenced by llvm::ARMAsmBackend::adjustFixupValue(), and isThumbFunc().

◆ layout()

void MCAssembler::layout ( )

◆ operator=()

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

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

◆ registerSymbol()

bool MCAssembler::registerSymbol ( const MCSymbol Symbol)

◆ reportError()

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

◆ reset()

void MCAssembler::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.

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

◆ 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 llvm::MachObjectWriter::computeSymbolTable(), and dump().

◆ writeSectionData()

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

Friends And Related Function Documentation

◆ MCObjectWriter

friend class MCObjectWriter
friend

Definition at line 51 of file MCAssembler.h.


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