LLVM  5.0.0
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
llvm::MCAssembler Class Reference

#include "llvm/MC/MCAssembler.h"

Collaboration diagram for llvm::MCAssembler:
[legend]

Public Types

using SectionListType = std::vector< MCSection * >
 
using SymbolDataListType = std::vector< const MCSymbol * >
 
using const_iterator = pointee_iterator< SectionListType::const_iterator >
 
using iterator = pointee_iterator< SectionListType::iterator >
 
using const_symbol_iterator = pointee_iterator< SymbolDataListType::const_iterator >
 
using symbol_iterator = pointee_iterator< SymbolDataListType::iterator >
 
using symbol_range = iterator_range< symbol_iterator >
 
using const_symbol_range = iterator_range< const_symbol_iterator >
 
using const_indirect_symbol_iterator = std::vector< IndirectSymbolData >::const_iterator
 
using indirect_symbol_iterator = std::vector< IndirectSymbolData >::iterator
 
using const_data_region_iterator = std::vector< DataRegionData >::const_iterator
 
using data_region_iterator = std::vector< DataRegionData >::iterator
 
using VersionMinInfoType = struct{MCVersionMinType Kind
 MachO specific deployment target version info. More...
 

Public Member Functions

 MCAssembler (MCContext &Context, MCAsmBackend &Backend, MCCodeEmitter &Emitter, MCObjectWriter &Writer)
 Construct a new assembler instance. More...
 
 MCAssembler (const MCAssembler &)=delete
 
MCAssembler & operator= (const MCAssembler &)=delete
 
 ~MCAssembler ()
 
uint64_t computeFragmentSize (const MCAsmLayout &Layout, const MCFragment &F) const
 Compute the effective fragment size assuming it is laid out at the given SectionAddress and FragmentOffset. More...
 
const MCSymbol * getAtom (const MCSymbol &S) const
 Find the symbol which defines the atom containing the given symbol, or null if there is no such symbol. More...
 
bool isSymbolLinkerVisible (const MCSymbol &SD) const
 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. More...
 
void writeSectionData (const MCSection *Section, const MCAsmLayout &Layout) const
 Emit the section contents using the given object writer. More...
 
bool isThumbFunc (const MCSymbol *Func) const
 Check whether a given symbol has been flagged with .thumb_func. More...
 
void setIsThumbFunc (const MCSymbol *Func)
 Flag a function symbol as the target of a .thumb_func directive. More...
 
unsigned getELFHeaderEFlags () const
 ELF e_header flags. More...
 
void setELFHeaderEFlags (unsigned Flags)
 
const VersionMinInfoType & getVersionMinInfo () const
 MachO deployment target version information. More...
 
void setVersionMinInfo (MCVersionMinType Kind, unsigned Major, unsigned Minor, unsigned Update)
 
void reset ()
 Reuse an assembler instance. More...
 
MCContext & getContext () const
 
MCAsmBackend & getBackend () const
 
MCCodeEmitter & getEmitter () const
 
MCObjectWriter & getWriter () const
 
MCDwarfLineTableParams getDWARFLinetableParams () const
 
void setDWARFLinetableParams (MCDwarfLineTableParams P)
 
void Finish ()
 Finish - Do final processing and write the object to the output stream. More...
 
void layout (MCAsmLayout &Layout)
 
bool getSubsectionsViaSymbols () const
 
void setSubsectionsViaSymbols (bool Value)
 
bool isIncrementalLinkerCompatible () const
 
void setIncrementalLinkerCompatible (bool Value)
 
bool getRelaxAll () const
 
void setRelaxAll (bool Value)
 
bool isBundlingEnabled () const
 
unsigned getBundleAlignSize () const
 
void setBundleAlignSize (unsigned Size)
 
void dump () const
 
Section List Access
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
size_t size () const
 
Symbol List Access
symbol_iterator symbol_begin ()
 
const_symbol_iterator symbol_begin () const
 
symbol_iterator symbol_end ()
 
const_symbol_iterator symbol_end () const
 
symbol_range symbols ()
 
const_symbol_range symbols () const
 
size_t symbol_size () const
 
Indirect Symbol List Access
std::vector< IndirectSymbolData > & getIndirectSymbols ()
 
indirect_symbol_iterator indirect_symbol_begin ()
 
const_indirect_symbol_iterator indirect_symbol_begin () const
 
indirect_symbol_iterator indirect_symbol_end ()
 
const_indirect_symbol_iterator indirect_symbol_end () const
 
size_t indirect_symbol_size () const
 
Linker Option List Access
std::vector< std::vector
< std::string > > & 
getLinkerOptions ()
 
Data Region List Access
std::vector< DataRegionData > & getDataRegions ()
 
data_region_iterator data_region_begin ()
 
const_data_region_iterator data_region_begin () const
 
data_region_iterator data_region_end ()
 
const_data_region_iterator data_region_end () const
 
size_t data_region_size () const
 
MCLOHContainer & getLOHContainer ()
 
const MCLOHContainer & getLOHContainer () const
 
Backend Data Access
bool registerSection (MCSection &Section)
 
void registerSymbol (const MCSymbol &Symbol, bool *Created=nullptr)
 
ArrayRef< std::string > getFileNames ()
 
void addFileName (StringRef FileName)
 
void writeFragmentPadding (const MCFragment &F, uint64_t FSize, MCObjectWriter *OW) const
 Write the necessary bundle padding to the given object writer. More...
 

Public Attributes

unsigned Major
 
unsigned Minor
 
unsigned Update
 

Friends

class MCAsmLayout
 

Detailed Description

Definition at line 59 of file MCAssembler.h.

Member Typedef Documentation

Definition at line 81 of file MCAssembler.h.

Definition at line 77 of file MCAssembler.h.

using llvm::MCAssembler::const_iterator = pointee_iterator<SectionListType::const_iterator>

Definition at line 66 of file MCAssembler.h.

using llvm::MCAssembler::const_symbol_iterator = pointee_iterator<SymbolDataListType::const_iterator>

Definition at line 70 of file MCAssembler.h.

Definition at line 74 of file MCAssembler.h.

Definition at line 82 of file MCAssembler.h.

Definition at line 78 of file MCAssembler.h.

using llvm::MCAssembler::iterator = pointee_iterator<SectionListType::iterator>

Definition at line 67 of file MCAssembler.h.

Definition at line 63 of file MCAssembler.h.

using llvm::MCAssembler::symbol_iterator = pointee_iterator<SymbolDataListType::iterator>

Definition at line 71 of file MCAssembler.h.

Definition at line 73 of file MCAssembler.h.

Definition at line 64 of file MCAssembler.h.

MachO specific deployment target version info.

Definition at line 88 of file MCAssembler.h.

Constructor & Destructor Documentation

MCAssembler::MCAssembler ( MCContext &  Context,
MCAsmBackend &  Backend,
MCCodeEmitter &  Emitter,
MCObjectWriter &  Writer 
)

Construct a new assembler instance.

Definition at line 82 of file MCAssembler.cpp.

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

Member Function Documentation

void llvm::MCAssembler::addFileName ( StringRef  FileName)
inline

Definition at line 404 of file MCAssembler.h.

References llvm::is_contained().

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

iterator llvm::MCAssembler::begin ( )
inline

Definition at line 303 of file MCAssembler.h.

Referenced by llvm::MachObjectWriter::computeSymbolTable(), and dump().

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

Definition at line 304 of file MCAssembler.h.

uint64_t MCAssembler::computeFragmentSize ( const MCAsmLayout &  Layout,
const MCFragment &  F 
) const
data_region_iterator llvm::MCAssembler::data_region_begin ( )
inline

Definition at line 371 of file MCAssembler.h.

const_data_region_iterator llvm::MCAssembler::data_region_begin ( ) const
inline

Definition at line 372 of file MCAssembler.h.

data_region_iterator llvm::MCAssembler::data_region_end ( )
inline

Definition at line 376 of file MCAssembler.h.

const_data_region_iterator llvm::MCAssembler::data_region_end ( ) const
inline

Definition at line 377 of file MCAssembler.h.

size_t llvm::MCAssembler::data_region_size ( ) const
inline

Definition at line 381 of file MCAssembler.h.

LLVM_DUMP_METHOD void MCAssembler::dump ( ) const

Definition at line 450 of file MCFragment.cpp.

References begin(), end(), llvm::errs(), symbol_begin(), and symbol_end().

Referenced by layout().

iterator llvm::MCAssembler::end ( )
inline

Definition at line 306 of file MCAssembler.h.

Referenced by llvm::MachObjectWriter::computeSymbolTable(), and dump().

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

Definition at line 307 of file MCAssembler.h.

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

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

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

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

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

Definition at line 169 of file MCAssembler.cpp.

References llvm::MCContext::getAsmInfo(), llvm::MCFragment::getAtom(), getContext(), llvm::MCSymbol::getFragment(), llvm::MCFragment::getParent(), llvm::MCSymbol::isInSection(), llvm::MCAsmInfo::isSectionAtomizableBySymbols(), and isSymbolLinkerVisible().

MCAsmBackend& llvm::MCAssembler::getBackend ( ) const
inline
unsigned llvm::MCAssembler::getBundleAlignSize ( ) const
inline
MCContext& llvm::MCAssembler::getContext ( ) const
inline
std::vector<DataRegionData>& llvm::MCAssembler::getDataRegions ( )
inline

Definition at line 369 of file MCAssembler.h.

Referenced by llvm::MachObjectWriter::writeObject().

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

Definition at line 265 of file MCAssembler.h.

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

unsigned llvm::MCAssembler::getELFHeaderEFlags ( ) const
inline
MCCodeEmitter& llvm::MCAssembler::getEmitter ( ) const
inline
ArrayRef<std::string> llvm::MCAssembler::getFileNames ( )
inline

Definition at line 402 of file MCAssembler.h.

std::vector<IndirectSymbolData>& llvm::MCAssembler::getIndirectSymbols ( )
inline

Definition at line 334 of file MCAssembler.h.

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

std::vector<std::vector<std::string> >& llvm::MCAssembler::getLinkerOptions ( )
inline

Definition at line 358 of file MCAssembler.h.

Referenced by llvm::MachObjectWriter::writeObject().

MCLOHContainer& llvm::MCAssembler::getLOHContainer ( )
inline

Definition at line 390 of file MCAssembler.h.

Referenced by getLOHContainer(), reset(), and llvm::MachObjectWriter::writeObject().

const MCLOHContainer& llvm::MCAssembler::getLOHContainer ( ) const
inline

Definition at line 391 of file MCAssembler.h.

References getLOHContainer().

bool llvm::MCAssembler::getRelaxAll ( ) const
inline
bool llvm::MCAssembler::getSubsectionsViaSymbols ( ) const
inline
const VersionMinInfoType& llvm::MCAssembler::getVersionMinInfo ( ) const
inline

MachO deployment target version information.

Definition at line 244 of file MCAssembler.h.

Referenced by llvm::MachObjectWriter::writeObject().

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

Definition at line 338 of file MCAssembler.h.

Referenced by llvm::MachObjectWriter::bindIndirectSymbols().

const_indirect_symbol_iterator llvm::MCAssembler::indirect_symbol_begin ( ) const
inline

Definition at line 341 of file MCAssembler.h.

indirect_symbol_iterator llvm::MCAssembler::indirect_symbol_end ( )
inline

Definition at line 345 of file MCAssembler.h.

Referenced by llvm::MachObjectWriter::bindIndirectSymbols().

const_indirect_symbol_iterator llvm::MCAssembler::indirect_symbol_end ( ) const
inline

Definition at line 348 of file MCAssembler.h.

size_t llvm::MCAssembler::indirect_symbol_size ( ) const
inline

Definition at line 352 of file MCAssembler.h.

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

Definition at line 280 of file MCAssembler.h.

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

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.

Definition at line 154 of file MCAssembler.cpp.

References llvm::MCSymbol::isInSection(), llvm::MCSymbol::isTemporary(), and llvm::MCSymbol::isUsedInReloc().

Referenced by llvm::MachObjectWriter::computeSymbolTable(), and getAtom().

bool MCAssembler::isThumbFunc ( const MCSymbol *  Func) const
void MCAssembler::layout ( MCAsmLayout &  Layout)
MCAssembler& llvm::MCAssembler::operator= ( const MCAssembler &  )
delete
bool MCAssembler::registerSection ( MCSection &  Section)
void MCAssembler::registerSymbol ( const MCSymbol &  Symbol,
bool *  Created = nullptr 
)
void MCAssembler::reset ( )
void llvm::MCAssembler::setBundleAlignSize ( unsigned  Size)
inline
void llvm::MCAssembler::setDWARFLinetableParams ( MCDwarfLineTableParams  P)
inline

Definition at line 266 of file MCAssembler.h.

References P.

void llvm::MCAssembler::setELFHeaderEFlags ( unsigned  Flags)
inline
void llvm::MCAssembler::setIncrementalLinkerCompatible ( bool  Value)
inline

Definition at line 283 of file MCAssembler.h.

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

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

Definition at line 237 of file MCAssembler.h.

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

Definition at line 288 of file MCAssembler.h.

Referenced by llvm::createELFStreamer(), and llvm::createWasmStreamer().

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

Definition at line 278 of file MCAssembler.h.

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

void llvm::MCAssembler::setVersionMinInfo ( MCVersionMinType  Kind,
unsigned  Major,
unsigned  Minor,
unsigned  Update 
)
inline

Definition at line 245 of file MCAssembler.h.

References Kind, Major, Minor, and Update.

size_t llvm::MCAssembler::size ( ) const
inline

Definition at line 309 of file MCAssembler.h.

Referenced by llvm::MachObjectWriter::writeObject().

symbol_iterator llvm::MCAssembler::symbol_begin ( )
inline

Definition at line 314 of file MCAssembler.h.

Referenced by dump(), and symbols().

const_symbol_iterator llvm::MCAssembler::symbol_begin ( ) const
inline

Definition at line 315 of file MCAssembler.h.

symbol_iterator llvm::MCAssembler::symbol_end ( )
inline

Definition at line 317 of file MCAssembler.h.

Referenced by dump(), and symbols().

const_symbol_iterator llvm::MCAssembler::symbol_end ( ) const
inline

Definition at line 318 of file MCAssembler.h.

size_t llvm::MCAssembler::symbol_size ( ) const
inline

Definition at line 325 of file MCAssembler.h.

symbol_range llvm::MCAssembler::symbols ( )
inline
const_symbol_range llvm::MCAssembler::symbols ( ) const
inline

Definition at line 321 of file MCAssembler.h.

References llvm::make_range(), symbol_begin(), and symbol_end().

void MCAssembler::writeFragmentPadding ( const MCFragment &  F,
uint64_t  FSize,
MCObjectWriter *  OW 
) const

Write the necessary bundle padding to the given object writer.

Expects a fragment F containing instructions and its size FSize.

Definition at line 421 of file MCAssembler.cpp.

References llvm::MCFragment::alignToBundleEnd(), assert(), getBackend(), getBundleAlignSize(), llvm::MCFragment::getBundlePadding(), llvm::MCFragment::hasInstructions(), isBundlingEnabled(), and llvm::report_fatal_error().

Referenced by writeFragment().

void MCAssembler::writeSectionData ( const MCSection *  Section,
const MCAsmLayout &  Layout 
) const

Friends And Related Function Documentation

friend class MCAsmLayout
friend

Definition at line 60 of file MCAssembler.h.

Member Data Documentation

unsigned llvm::MCAssembler::Major

Definition at line 89 of file MCAssembler.h.

Referenced by setVersionMinInfo().

unsigned llvm::MCAssembler::Minor

Definition at line 90 of file MCAssembler.h.

Referenced by setVersionMinInfo().

unsigned llvm::MCAssembler::Update

Definition at line 91 of file MCAssembler.h.

Referenced by setVersionMinInfo().


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