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

#include <MCAssembler.h>

Classes

struct  VersionMinInfoType
 MachO specific deployment target version info. More...
 

Public Types

typedef std::vector< MCSection * > SectionListType
 
typedef std::vector< const
MCSymbol * > 
SymbolDataListType
 
typedef pointee_iterator
< SectionListType::const_iterator > 
const_iterator
 
typedef pointee_iterator
< SectionListType::iterator > 
iterator
 
typedef pointee_iterator
< SymbolDataListType::const_iterator > 
const_symbol_iterator
 
typedef pointee_iterator
< SymbolDataListType::iterator > 
symbol_iterator
 
typedef iterator_range
< symbol_iterator
symbol_range
 
typedef iterator_range
< const_symbol_iterator
const_symbol_range
 
typedef std::vector
< IndirectSymbolData >
::const_iterator 
const_indirect_symbol_iterator
 
typedef std::vector
< IndirectSymbolData >
::iterator 
indirect_symbol_iterator
 
typedef std::vector
< DataRegionData >
::const_iterator 
const_data_region_iterator
 
typedef std::vector
< DataRegionData >::iterator 
data_region_iterator
 

Public Member Functions

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 MCSymbolgetAtom (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 VersionMinInfoTypegetVersionMinInfo () const
 MachO deployment target version information. More...
 
void setVersionMinInfo (MCVersionMinType Kind, unsigned Major, unsigned Minor, unsigned Update)
 
 MCAssembler (MCContext &Context, MCAsmBackend &Backend, MCCodeEmitter &Emitter, MCObjectWriter &Writer)
 Construct a new assembler instance. More...
 
 ~MCAssembler ()
 
void reset ()
 Reuse an assembler instance. More...
 
MCContextgetContext () const
 
MCAsmBackendgetBackend () const
 
MCCodeEmittergetEmitter () const
 
MCObjectWritergetWriter () 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 ()
 
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
 
MCLOHContainergetLOHContainer ()
 
const MCLOHContainergetLOHContainer () 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...
 

Friends

class MCAsmLayout
 

Detailed Description

Definition at line 57 of file MCAssembler.h.

Member Typedef Documentation

Definition at line 79 of file MCAssembler.h.

Definition at line 75 of file MCAssembler.h.

typedef pointee_iterator<SectionListType::const_iterator> llvm::MCAssembler::const_iterator

Definition at line 64 of file MCAssembler.h.

typedef pointee_iterator<SymbolDataListType::const_iterator> llvm::MCAssembler::const_symbol_iterator

Definition at line 68 of file MCAssembler.h.

Definition at line 72 of file MCAssembler.h.

Definition at line 80 of file MCAssembler.h.

Definition at line 76 of file MCAssembler.h.

typedef pointee_iterator<SectionListType::iterator> llvm::MCAssembler::iterator

Definition at line 65 of file MCAssembler.h.

Definition at line 61 of file MCAssembler.h.

typedef pointee_iterator<SymbolDataListType::iterator> llvm::MCAssembler::symbol_iterator

Definition at line 69 of file MCAssembler.h.

Definition at line 71 of file MCAssembler.h.

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

References llvm::MCAssembler::VersionMinInfoType::Major.

MCAssembler::~MCAssembler ( )

Definition at line 76 of file MCAssembler.cpp.

Member Function Documentation

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

Definition at line 304 of file MCAssembler.h.

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

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

Definition at line 305 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 372 of file MCAssembler.h.

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

Definition at line 373 of file MCAssembler.h.

data_region_iterator llvm::MCAssembler::data_region_end ( )
inline

Definition at line 377 of file MCAssembler.h.

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

Definition at line 378 of file MCAssembler.h.

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

Definition at line 382 of file MCAssembler.h.

LLVM_DUMP_METHOD void MCAssembler::dump ( )

Definition at line 451 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 307 of file MCAssembler.h.

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

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

Definition at line 308 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 724 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 150 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 370 of file MCAssembler.h.

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

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

Definition at line 266 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 403 of file MCAssembler.h.

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

Definition at line 335 of file MCAssembler.h.

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

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

Definition at line 359 of file MCAssembler.h.

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

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

Definition at line 391 of file MCAssembler.h.

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

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

Definition at line 392 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 234 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 339 of file MCAssembler.h.

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

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

Definition at line 342 of file MCAssembler.h.

indirect_symbol_iterator llvm::MCAssembler::indirect_symbol_end ( )
inline

Definition at line 346 of file MCAssembler.h.

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

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

Definition at line 349 of file MCAssembler.h.

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

Definition at line 353 of file MCAssembler.h.

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

Definition at line 281 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 135 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)
bool MCAssembler::registerSection ( MCSection Section)
void MCAssembler::registerSymbol ( const MCSymbol Symbol,
bool Created = nullptr 
)
void MCAssembler::reset ( )
void llvm::MCAssembler::setBundleAlignSize ( unsigned  Size)
inline

Definition at line 295 of file MCAssembler.h.

References assert().

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

void llvm::MCAssembler::setDWARFLinetableParams ( MCDwarfLineTableParams  P)
inline

Definition at line 267 of file MCAssembler.h.

References P.

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

Definition at line 284 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 227 of file MCAssembler.h.

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

Definition at line 289 of file MCAssembler.h.

Referenced by llvm::createELFStreamer().

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

Definition at line 279 of file MCAssembler.h.

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

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

Definition at line 310 of file MCAssembler.h.

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

symbol_iterator llvm::MCAssembler::symbol_begin ( )
inline

Definition at line 315 of file MCAssembler.h.

Referenced by dump(), and symbols().

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

Definition at line 316 of file MCAssembler.h.

symbol_iterator llvm::MCAssembler::symbol_end ( )
inline

Definition at line 318 of file MCAssembler.h.

Referenced by dump(), and symbols().

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

Definition at line 319 of file MCAssembler.h.

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

Definition at line 326 of file MCAssembler.h.

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

Definition at line 322 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 395 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 58 of file MCAssembler.h.


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