class MCAssembler

Declaration

class MCAssembler { /* full declaration omitted */ };

Declared at: llvm/include/llvm/MC/MCAssembler.h:73

Member Variables

private llvm::MCContext& Context
private std::unique_ptr<MCAsmBackend> Backend
private std::unique_ptr<MCCodeEmitter> Emitter
private std::unique_ptr<MCObjectWriter> Writer
private llvm::MCAssembler::SectionListType Sections
private llvm::MCAssembler::SymbolDataListType Symbols
private std::vector<IndirectSymbolData> IndirectSymbols
private std::vector<DataRegionData> DataRegions
private std::vector<std::vector<std::string>> LinkerOptions
The list of linker options to propagate into the object file.
private std::vector<std::pair<std::string, size_t>> FileNames
List of declared file names
private llvm::MCDwarfLineTableParams LTParams
private SmallPtrSet<const llvm::MCSymbol*, 32> ThumbFuncs
The set of function symbols for which a .thumb_func directive has been seen.
private unsigned int BundleAlignSize
By default it's 0, which means bundling is disabled.
private bool RelaxAll
private bool SubsectionsViaSymbols
private bool IncrementalLinkerCompatible
private unsigned int ELFHeaderEFlags
ELF specific e_header flags
private llvm::MCLOHContainer LOHContainer
Used to communicate Linker Optimization Hint information between the Streamer and the .o writer
private llvm::MCAssembler::VersionInfoType VersionInfo
private llvm::MCAssembler::VersionInfoType DarwinTargetVariantVersionInfo
public std::vector<Symver> Symvers
public std::vector<CGProfileEntry> CGProfile

Method Overview

Methods

void Finish()

Description

Finish - Do final processing and write the object to the output stream.\p Writer is used for custom object writer (as the MCJIT does), if not specified it is automatically created from backend.

Declared at: llvm/include/llvm/MC/MCAssembler.h:341

MCAssembler(const llvm::MCAssembler&)

Declared at: llvm/include/llvm/MC/MCAssembler.h:246

Parameters

const llvm::MCAssembler&

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

Description

Construct a new assembler instance.

Declared at: llvm/include/llvm/MC/MCAssembler.h:243

Parameters

llvm::MCContext& Context
std::unique_ptr<MCAsmBackend> Backend
std::unique_ptr<MCCodeEmitter> Emitter
std::unique_ptr<MCObjectWriter> Writer

void addFileName(llvm::StringRef FileName)

Declared at: llvm/include/llvm/MC/MCAssembler.h:483

Parameters

llvm::StringRef FileName

llvm::MCAssembler::const_iterator begin() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:374

llvm::MCAssembler::iterator begin()

Description

@ {

Declared at: llvm/include/llvm/MC/MCAssembler.h:373

uint64_t computeFragmentSize(
    const llvm::MCAsmLayout& Layout,
    const llvm::MCFragment& F) const

Description

Compute the effective fragment size assuming it is laid out at the given\p SectionAddress and \p FragmentOffset.

Declared at: llvm/include/llvm/MC/MCAssembler.h:252

Parameters

const llvm::MCAsmLayout& Layout
const llvm::MCFragment& F

llvm::MCAssembler::const_data_region_iterator
data_region_begin() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:442

llvm::MCAssembler::data_region_iterator
data_region_begin()

Declared at: llvm/include/llvm/MC/MCAssembler.h:441

llvm::MCAssembler::const_data_region_iterator
data_region_end() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:447

llvm::MCAssembler::data_region_iterator
data_region_end()

Declared at: llvm/include/llvm/MC/MCAssembler.h:446

size_t data_region_size() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:451

void dump() const

Description

@ }

Declared at: llvm/include/llvm/MC/MCAssembler.h:494

llvm::MCAssembler::const_iterator end() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:377

llvm::MCAssembler::iterator end()

Declared at: llvm/include/llvm/MC/MCAssembler.h:376

bool evaluateFixup(
    const llvm::MCAsmLayout& Layout,
    const llvm::MCFixup& Fixup,
    const llvm::MCFragment* DF,
    llvm::MCValue& Target,
    uint64_t& Value,
    bool& WasForced) const

Description

Evaluate a fixup to a relocatable expression and the value which should be placed into the fixup.

Declared at: llvm/include/llvm/MC/MCAssembler.h:186

Parameters

const llvm::MCAsmLayout& Layout
The layout to use for evaluation.
const llvm::MCFixup& Fixup
The fixup to evaluate.
const llvm::MCFragment* DF
The fragment the fixup is inside.
llvm::MCValue& Target
[out] On return, the relocatable expression the fixup evaluates to.
uint64_t& Value
[out] On return, the value of the fixup as currently laid out.
bool& WasForced
[out] On return, the value in the fixup is set to the correct value if WasForced is true, even if evaluateFixup returns false.

Returns

Whether the fixup value was fully resolved. This is true if the\p Value result is fixed, otherwise the value may change due to relocation.

void finishLayout(llvm::MCAsmLayout& Layout)

Description

finishLayout - Finalize a layout, including fragment lowering.

Declared at: llvm/include/llvm/MC/MCAssembler.h:222

Parameters

llvm::MCAsmLayout& Layout

bool fixupNeedsRelaxation(
    const llvm::MCFixup& Fixup,
    const llvm::MCRelaxableFragment* DF,
    const llvm::MCAsmLayout& Layout) const

Description

Check whether a fixup can be satisfied, or whether it needs to be relaxed (increased in size, in order to hold its value correctly).

Declared at: llvm/include/llvm/MC/MCAssembler.h:192

Parameters

const llvm::MCFixup& Fixup
const llvm::MCRelaxableFragment* DF
const llvm::MCAsmLayout& Layout

bool fragmentNeedsRelaxation(
    const llvm::MCRelaxableFragment* IF,
    const llvm::MCAsmLayout& Layout) const

Description

Check whether the given fragment needs relaxation.

Declared at: llvm/include/llvm/MC/MCAssembler.h:196

Parameters

const llvm::MCRelaxableFragment* IF
const llvm::MCAsmLayout& Layout

const llvm::MCSymbol* getAtom(
    const llvm::MCSymbol& S) const

Description

Find the symbol which defines the atom containing the given symbol, or null if there is no such symbol.

Declared at: llvm/include/llvm/MC/MCAssembler.h:257

Parameters

const llvm::MCSymbol& S

llvm::MCAsmBackend& getBackend() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:329

llvm::MCAsmBackend* getBackendPtr() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:323

unsigned int getBundleAlignSize() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:362

llvm::MCContext& getContext() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:321

llvm::MCDwarfLineTableParams
getDWARFLinetableParams() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:335

const llvm::MCAssembler::VersionInfoType&
getDarwinTargetVariantVersionInfo() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:302

std::vector<DataRegionData>& getDataRegions()

Description

@ } @ {

Declared at: llvm/include/llvm/MC/MCAssembler.h:439

unsigned int getELFHeaderEFlags() const

Description

ELF e_header flags

Declared at: llvm/include/llvm/MC/MCAssembler.h:276

llvm::MCCodeEmitter& getEmitter() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:331

llvm::MCCodeEmitter* getEmitterPtr() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:325

MutableArrayRef<std::pair<std::string, size_t>>
getFileNames()

Declared at: llvm/include/llvm/MC/MCAssembler.h:479

std::vector<IndirectSymbolData>&
getIndirectSymbols()

Description

@ } @ {

Declared at: llvm/include/llvm/MC/MCAssembler.h:404

const llvm::MCLOHContainer& getLOHContainer()
    const

Declared at: llvm/include/llvm/MC/MCAssembler.h:461

llvm::MCLOHContainer& getLOHContainer()

Description

@ } @ {

Declared at: llvm/include/llvm/MC/MCAssembler.h:460

std::vector<std::vector<std::string>>&
getLinkerOptions()

Description

@ } @ {

Declared at: llvm/include/llvm/MC/MCAssembler.h:428

bool getRelaxAll() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:357

bool getSubsectionsViaSymbols() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:347

const llvm::MCAssembler::VersionInfoType&
getVersionInfo() const

Description

MachO deployment target version information.

Declared at: llvm/include/llvm/MC/MCAssembler.h:280

llvm::MCObjectWriter& getWriter() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:333

llvm::MCObjectWriter* getWriterPtr() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:327

std::tuple<MCValue, uint64_t, bool> handleFixup(
    const llvm::MCAsmLayout& Layout,
    llvm::MCFragment& F,
    const llvm::MCFixup& Fixup)

Declared at: llvm/include/llvm/MC/MCAssembler.h:225

Parameters

const llvm::MCAsmLayout& Layout
llvm::MCFragment& F
const llvm::MCFixup& Fixup

llvm::MCAssembler::indirect_symbol_iterator
indirect_symbol_begin()

Declared at: llvm/include/llvm/MC/MCAssembler.h:408

llvm::MCAssembler::const_indirect_symbol_iterator
indirect_symbol_begin() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:411

llvm::MCAssembler::indirect_symbol_iterator
indirect_symbol_end()

Declared at: llvm/include/llvm/MC/MCAssembler.h:415

llvm::MCAssembler::const_indirect_symbol_iterator
indirect_symbol_end() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:418

size_t indirect_symbol_size() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:422

bool isBundlingEnabled() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:360

bool isIncrementalLinkerCompatible() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:350

bool isSymbolLinkerVisible(
    const llvm::MCSymbol& SD) const

Description

Check whether a particular symbol is visible to the linker and is required in the symbol table, or whether it can be discarded by the assembler. This also effects whether the assembler treats the label as potentially defining a separate atom.

Declared at: llvm/include/llvm/MC/MCAssembler.h:263

Parameters

const llvm::MCSymbol& SD

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

Description

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

Declared at: llvm/include/llvm/MC/MCAssembler.h:270

Parameters

const llvm::MCSymbol* Func

void layout(llvm::MCAsmLayout& Layout)

Declared at: llvm/include/llvm/MC/MCAssembler.h:344

Parameters

llvm::MCAsmLayout& Layout

bool layoutOnce(llvm::MCAsmLayout& Layout)

Description

Perform one layout iteration and return true if any offsets were adjusted.

Declared at: llvm/include/llvm/MC/MCAssembler.h:201

Parameters

llvm::MCAsmLayout& Layout

bool layoutSectionOnce(llvm::MCAsmLayout& Layout,
                       llvm::MCSection& Sec)

Description

Perform one layout iteration of the given section and return true if any offsets were adjusted.

Declared at: llvm/include/llvm/MC/MCAssembler.h:205

Parameters

llvm::MCAsmLayout& Layout
llvm::MCSection& Sec

bool registerSection(llvm::MCSection& Section)

Description

@ } @ {

Declared at: llvm/include/llvm/MC/MCAssembler.h:475

Parameters

llvm::MCSection& Section

void registerSymbol(const llvm::MCSymbol& Symbol,
                    bool* Created = nullptr)

Declared at: llvm/include/llvm/MC/MCAssembler.h:477

Parameters

const llvm::MCSymbol& Symbol
bool* Created = nullptr

bool relaxBoundaryAlign(
    llvm::MCAsmLayout& Layout,
    llvm::MCBoundaryAlignFragment& BF)

Declared at: llvm/include/llvm/MC/MCAssembler.h:212

Parameters

llvm::MCAsmLayout& Layout
llvm::MCBoundaryAlignFragment& BF

bool relaxCVDefRange(
    llvm::MCAsmLayout& Layout,
    llvm::MCCVDefRangeFragment& DF)

Declared at: llvm/include/llvm/MC/MCAssembler.h:218

Parameters

llvm::MCAsmLayout& Layout
llvm::MCCVDefRangeFragment& DF

bool relaxCVInlineLineTable(
    llvm::MCAsmLayout& Layout,
    llvm::MCCVInlineLineTableFragment& DF)

Declared at: llvm/include/llvm/MC/MCAssembler.h:216

Parameters

llvm::MCAsmLayout& Layout
llvm::MCCVInlineLineTableFragment& DF

bool relaxDwarfCallFrameFragment(
    llvm::MCAsmLayout& Layout,
    llvm::MCDwarfCallFrameFragment& DF)

Declared at: llvm/include/llvm/MC/MCAssembler.h:214

Parameters

llvm::MCAsmLayout& Layout
llvm::MCDwarfCallFrameFragment& DF

bool relaxDwarfLineAddr(
    llvm::MCAsmLayout& Layout,
    llvm::MCDwarfLineAddrFragment& DF)

Declared at: llvm/include/llvm/MC/MCAssembler.h:213

Parameters

llvm::MCAsmLayout& Layout
llvm::MCDwarfLineAddrFragment& DF

bool relaxFragment(llvm::MCAsmLayout& Layout,
                   llvm::MCFragment& F)

Description

Perform relaxation on a single fragment - returns true if the fragment changes as a result of relaxation.

Declared at: llvm/include/llvm/MC/MCAssembler.h:209

Parameters

llvm::MCAsmLayout& Layout
llvm::MCFragment& F

bool relaxInstruction(
    llvm::MCAsmLayout& Layout,
    llvm::MCRelaxableFragment& IF)

Declared at: llvm/include/llvm/MC/MCAssembler.h:210

Parameters

llvm::MCAsmLayout& Layout
llvm::MCRelaxableFragment& IF

bool relaxLEB(llvm::MCAsmLayout& Layout,
              llvm::MCLEBFragment& IF)

Declared at: llvm/include/llvm/MC/MCAssembler.h:211

Parameters

llvm::MCAsmLayout& Layout
llvm::MCLEBFragment& IF

bool relaxPseudoProbeAddr(
    llvm::MCAsmLayout& Layout,
    llvm::MCPseudoProbeAddrFragment& DF)

Declared at: llvm/include/llvm/MC/MCAssembler.h:219

Parameters

llvm::MCAsmLayout& Layout
llvm::MCPseudoProbeAddrFragment& DF

void reset()

Description

Reuse an assembler instance

Declared at: llvm/include/llvm/MC/MCAssembler.h:319

void setBuildVersion(
    MachO::PlatformType Platform,
    unsigned int Major,
    unsigned int Minor,
    unsigned int Update,
    llvm::VersionTuple SDKVersion =
        llvm::VersionTuple())

Declared at: llvm/include/llvm/MC/MCAssembler.h:291

Parameters

MachO::PlatformType Platform
unsigned int Major
unsigned int Minor
unsigned int Update
llvm::VersionTuple SDKVersion = llvm::VersionTuple()

void setBundleAlignSize(unsigned int Size)

Declared at: llvm/include/llvm/MC/MCAssembler.h:364

Parameters

unsigned int Size

void setDWARFLinetableParams(
    llvm::MCDwarfLineTableParams P)

Declared at: llvm/include/llvm/MC/MCAssembler.h:336

Parameters

llvm::MCDwarfLineTableParams P

void setDarwinTargetVariantBuildVersion(
    MachO::PlatformType Platform,
    unsigned int Major,
    unsigned int Minor,
    unsigned int Update,
    llvm::VersionTuple SDKVersion)

Declared at: llvm/include/llvm/MC/MCAssembler.h:305

Parameters

MachO::PlatformType Platform
unsigned int Major
unsigned int Minor
unsigned int Update
llvm::VersionTuple SDKVersion

void setELFHeaderEFlags(unsigned int Flags)

Declared at: llvm/include/llvm/MC/MCAssembler.h:277

Parameters

unsigned int Flags

void setIncrementalLinkerCompatible(bool Value)

Declared at: llvm/include/llvm/MC/MCAssembler.h:353

Parameters

bool Value

void setIsThumbFunc(const llvm::MCSymbol* Func)

Description

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

Declared at: llvm/include/llvm/MC/MCAssembler.h:273

Parameters

const llvm::MCSymbol* Func

void setRelaxAll(bool Value)

Declared at: llvm/include/llvm/MC/MCAssembler.h:358

Parameters

bool Value

void setSubsectionsViaSymbols(bool Value)

Declared at: llvm/include/llvm/MC/MCAssembler.h:348

Parameters

bool Value

void setVersionMin(llvm::MCVersionMinType Type,
                   unsigned int Major,
                   unsigned int Minor,
                   unsigned int Update,
                   llvm::VersionTuple SDKVersion =
                       llvm::VersionTuple())

Declared at: llvm/include/llvm/MC/MCAssembler.h:281

Parameters

llvm::MCVersionMinType Type
unsigned int Major
unsigned int Minor
unsigned int Update
llvm::VersionTuple SDKVersion = llvm::VersionTuple()

size_t size() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:379

llvm::MCAssembler::symbol_iterator symbol_begin()

Description

@ } @ {

Declared at: llvm/include/llvm/MC/MCAssembler.h:384

llvm::MCAssembler::const_symbol_iterator
symbol_begin() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:385

llvm::MCAssembler::symbol_iterator symbol_end()

Declared at: llvm/include/llvm/MC/MCAssembler.h:387

llvm::MCAssembler::const_symbol_iterator
symbol_end() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:388

size_t symbol_size() const

Declared at: llvm/include/llvm/MC/MCAssembler.h:395

llvm::MCAssembler::const_symbol_range symbols()
    const

Declared at: llvm/include/llvm/MC/MCAssembler.h:391

llvm::MCAssembler::symbol_range symbols()

Declared at: llvm/include/llvm/MC/MCAssembler.h:390

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

Description

Write the necessary bundle padding to \p OS. Expects a fragment \p F containing instructions and its size \p FSize.

Declared at: llvm/include/llvm/MC/MCAssembler.h:489

Parameters

llvm::raw_ostream& OS
const llvm::MCEncodedFragment& F
uint64_t FSize

void writeSectionData(
    llvm::raw_ostream& OS,
    const llvm::MCSection* Section,
    const llvm::MCAsmLayout& Layout) const

Description

Emit the section contents to \p OS.

Declared at: llvm/include/llvm/MC/MCAssembler.h:266

Parameters

llvm::raw_ostream& OS
const llvm::MCSection* Section
const llvm::MCAsmLayout& Layout

~MCAssembler()

Declared at: llvm/include/llvm/MC/MCAssembler.h:248