LLVM  6.0.0svn
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:
Collaboration graph

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
MCAssembleroperator= (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 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)
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 () 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
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...

Public Attributes

unsigned Major
unsigned Minor
unsigned Update


class MCAsmLayout

Detailed Description

Definition at line 59 of file MCAssembler.h.

Member Typedef Documentation

◆ const_data_region_iterator

Definition at line 81 of file MCAssembler.h.

◆ const_indirect_symbol_iterator

Definition at line 77 of file MCAssembler.h.

◆ const_iterator

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

Definition at line 66 of file MCAssembler.h.

◆ const_symbol_iterator

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

Definition at line 70 of file MCAssembler.h.

◆ const_symbol_range

Definition at line 74 of file MCAssembler.h.

◆ data_region_iterator

Definition at line 82 of file MCAssembler.h.

◆ indirect_symbol_iterator

Definition at line 78 of file MCAssembler.h.

◆ iterator

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

Definition at line 67 of file MCAssembler.h.

◆ SectionListType

Definition at line 63 of file MCAssembler.h.

◆ symbol_iterator

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

Definition at line 71 of file MCAssembler.h.

◆ symbol_range

Definition at line 73 of file MCAssembler.h.

◆ SymbolDataListType

Definition at line 64 of file MCAssembler.h.

◆ VersionMinInfoType

MachO specific deployment target version info.

Definition at line 88 of file MCAssembler.h.

Constructor & Destructor Documentation

◆ MCAssembler() [1/2]

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

Construct a new assembler instance.

Definition at line 86 of file MCAssembler.cpp.

References ~MCAssembler().

◆ MCAssembler() [2/2]

llvm::MCAssembler::MCAssembler ( const MCAssembler )

◆ ~MCAssembler()

MCAssembler::~MCAssembler ( )

Referenced by MCAssembler().

Member Function Documentation

◆ addFileName()

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

◆ begin() [1/2]

iterator llvm::MCAssembler::begin ( )

◆ begin() [2/2]

const_iterator llvm::MCAssembler::begin ( ) const

Definition at line 306 of file MCAssembler.h.

◆ computeFragmentSize()

uint64_t MCAssembler::computeFragmentSize ( const MCAsmLayout Layout,
const MCFragment F 
) const

◆ data_region_begin() [1/2]

data_region_iterator llvm::MCAssembler::data_region_begin ( )

Definition at line 373 of file MCAssembler.h.

◆ data_region_begin() [2/2]

const_data_region_iterator llvm::MCAssembler::data_region_begin ( ) const

Definition at line 374 of file MCAssembler.h.

◆ data_region_end() [1/2]

data_region_iterator llvm::MCAssembler::data_region_end ( )

Definition at line 378 of file MCAssembler.h.

◆ data_region_end() [2/2]

const_data_region_iterator llvm::MCAssembler::data_region_end ( ) const

Definition at line 379 of file MCAssembler.h.

◆ data_region_size()

size_t llvm::MCAssembler::data_region_size ( ) const

Definition at line 383 of file MCAssembler.h.

◆ dump()

LLVM_DUMP_METHOD void MCAssembler::dump ( ) const

Definition at line 467 of file MCFragment.cpp.

References llvm::sys::path::begin(), llvm::sys::path::end(), and llvm::errs().

Referenced by layout().

◆ end() [1/2]

iterator llvm::MCAssembler::end ( )

◆ end() [2/2]

const_iterator llvm::MCAssembler::end ( ) const

Definition at line 309 of file MCAssembler.h.

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

References assert(), llvm::MCSection::begin(), begin(), llvm::SmallVectorImpl< T >::clear(), computeFragmentSize(), llvm::Data, llvm::MCDwarfLineAddr::Encode(), llvm::MCDwarfFrameEmitter::EncodeAdvanceLoc(), llvm::CodeViewContext::encodeDefRange(), llvm::CodeViewContext::encodeInlineLineTable(), llvm::MCCodeEmitter::encodeInstruction(), llvm::encodeSLEB128(), llvm::encodeULEB128(), llvm::MCSection::end(), end(), llvm::MCExpr::evaluateKnownAbsolute(), llvm::MCAsmBackend::finishLayout(), llvm::MCAsmBackend::fixupNeedsRelaxationAdvanced(), llvm::FK_Data_1, llvm::MCFragment::FT_CVDefRange, llvm::MCFragment::FT_CVInlineLines, llvm::MCFragment::FT_Dwarf, llvm::MCFragment::FT_DwarfFrame, llvm::MCFragment::FT_LEB, llvm::MCFragment::FT_Padding, llvm::MCFragment::FT_Relaxable, llvm::MCDwarfLineAddrFragment::getAddrDelta(), llvm::MCDwarfCallFrameFragment::getAddrDelta(), llvm::MCAsmLayout::getAssembler(), getBackend(), llvm::MCEncodedFragmentWithContents< ContentsSize >::getContents(), llvm::MCLEBFragment::getContents(), llvm::MCDwarfLineAddrFragment::getContents(), llvm::MCDwarfCallFrameFragment::getContents(), llvm::MCCVInlineLineTableFragment::getContents(), getContext(), llvm::MCContext::getCVContext(), getDWARFLinetableParams(), getEmitter(), llvm::MCEncodedFragmentWithFixups< ContentsSize, FixupsSize >::getFixups(), llvm::MCAsmLayout::getFragmentOffset(), llvm::MCRelaxableFragment::getInst(), llvm::MCFixup::getKind(), llvm::MCSymbolRefExpr::getKind(), llvm::MCDwarfLineAddrFragment::getLineDelta(), getRelaxAll(), llvm::MCAsmLayout::getSectionOrder(), llvm::MCPaddingFragment::getSize(), llvm::MCObjectWriter::getStream(), llvm::MCRelaxableFragment::getSubtargetInfo(), llvm::MCValue::getSymA(), llvm::MCLEBFragment::getValue(), getWriter(), I, llvm::ARM_PROC::IE, llvm::MCAsmLayout::invalidateFragmentsFrom(), llvm::MCLEBFragment::isSigned(), layout(), llvm::MCSection::rbegin(), llvm::MCAsmBackend::relaxInstruction(), llvm::report_fatal_error(), llvm::ARMBuildAttrs::Section, llvm::MCRelaxableFragment::setInst(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::raw_ostream::tell(), llvm::MCSymbolRefExpr::VK_X86_ABS8, and llvm::MCObjectWriter::writeObject().

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

◆ getAtom()

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

◆ getBackend()

MCAsmBackend& llvm::MCAssembler::getBackend ( ) const

◆ getBundleAlignSize()

unsigned llvm::MCAssembler::getBundleAlignSize ( ) const

◆ getContext()

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

◆ getDataRegions()

std::vector<DataRegionData>& llvm::MCAssembler::getDataRegions ( )

Definition at line 371 of file MCAssembler.h.

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

◆ getDWARFLinetableParams()

MCDwarfLineTableParams llvm::MCAssembler::getDWARFLinetableParams ( ) const

Definition at line 267 of file MCAssembler.h.

Referenced by Finish().

◆ getELFHeaderEFlags()

unsigned llvm::MCAssembler::getELFHeaderEFlags ( ) const

◆ getEmitter()

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

◆ getFileNames()

ArrayRef<std::string> llvm::MCAssembler::getFileNames ( )

Definition at line 404 of file MCAssembler.h.

Referenced by getTime(), and isWeak().

◆ getIndirectSymbols()

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

Definition at line 336 of file MCAssembler.h.

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

◆ getLinkerOptions()

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

Definition at line 360 of file MCAssembler.h.

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

◆ getLOHContainer() [1/2]

MCLOHContainer& llvm::MCAssembler::getLOHContainer ( )

Definition at line 392 of file MCAssembler.h.

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

◆ getLOHContainer() [2/2]

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

◆ getRelaxAll()

bool llvm::MCAssembler::getRelaxAll ( ) const

◆ getSubsectionsViaSymbols()

bool llvm::MCAssembler::getSubsectionsViaSymbols ( ) const

◆ getVersionMinInfo()

const VersionMinInfoType& llvm::MCAssembler::getVersionMinInfo ( ) const

MachO deployment target version information.

Definition at line 246 of file MCAssembler.h.

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

◆ getWriter()

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

Definition at line 265 of file MCAssembler.h.

Referenced by Finish(), getAtom(), layout(), reset(), writeFragment(), and writeSectionData().

◆ indirect_symbol_begin() [1/2]

indirect_symbol_iterator llvm::MCAssembler::indirect_symbol_begin ( )

Definition at line 340 of file MCAssembler.h.

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

◆ indirect_symbol_begin() [2/2]

const_indirect_symbol_iterator llvm::MCAssembler::indirect_symbol_begin ( ) const

Definition at line 343 of file MCAssembler.h.

◆ indirect_symbol_end() [1/2]

indirect_symbol_iterator llvm::MCAssembler::indirect_symbol_end ( )

Definition at line 347 of file MCAssembler.h.

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

◆ indirect_symbol_end() [2/2]

const_indirect_symbol_iterator llvm::MCAssembler::indirect_symbol_end ( ) const

Definition at line 350 of file MCAssembler.h.

◆ indirect_symbol_size()

size_t llvm::MCAssembler::indirect_symbol_size ( ) const

Definition at line 354 of file MCAssembler.h.

◆ isBundlingEnabled()

bool llvm::MCAssembler::isBundlingEnabled ( ) const

◆ isIncrementalLinkerCompatible()

bool llvm::MCAssembler::isIncrementalLinkerCompatible ( ) const

Definition at line 282 of file MCAssembler.h.

Referenced by encodeBase64StringEntry(), and isAssociative().

◆ isSymbolLinkerVisible()

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

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

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

◆ isThumbFunc()

bool MCAssembler::isThumbFunc ( const MCSymbol Func) const

◆ layout()

void MCAssembler::layout ( MCAsmLayout Layout)

◆ operator=()

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

◆ registerSection()

bool MCAssembler::registerSection ( MCSection Section)

◆ registerSymbol()

void MCAssembler::registerSymbol ( const MCSymbol Symbol,
bool Created = nullptr 

◆ reset()

void MCAssembler::reset ( )

◆ setBundleAlignSize()

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

◆ setDWARFLinetableParams()

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

Definition at line 268 of file MCAssembler.h.

References P.

◆ setELFHeaderEFlags()

void llvm::MCAssembler::setELFHeaderEFlags ( unsigned  Flags)

◆ setIncrementalLinkerCompatible()

void llvm::MCAssembler::setIncrementalLinkerCompatible ( bool  Value)

Definition at line 285 of file MCAssembler.h.

◆ setIsThumbFunc()

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

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

Definition at line 239 of file MCAssembler.h.

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

◆ setRelaxAll()

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

Definition at line 290 of file MCAssembler.h.

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

◆ setSubsectionsViaSymbols()

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

Definition at line 280 of file MCAssembler.h.

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

◆ setVersionMinInfo()

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

Definition at line 247 of file MCAssembler.h.

References Kind.

◆ size()

size_t llvm::MCAssembler::size ( ) const

Definition at line 311 of file MCAssembler.h.

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

◆ symbol_begin() [1/2]

symbol_iterator llvm::MCAssembler::symbol_begin ( )

Definition at line 316 of file MCAssembler.h.

◆ symbol_begin() [2/2]

const_symbol_iterator llvm::MCAssembler::symbol_begin ( ) const

Definition at line 317 of file MCAssembler.h.

◆ symbol_end() [1/2]

symbol_iterator llvm::MCAssembler::symbol_end ( )

Definition at line 319 of file MCAssembler.h.

◆ symbol_end() [2/2]

const_symbol_iterator llvm::MCAssembler::symbol_end ( ) const

Definition at line 320 of file MCAssembler.h.

◆ symbol_size()

size_t llvm::MCAssembler::symbol_size ( ) const

Definition at line 327 of file MCAssembler.h.

◆ symbols() [1/2]

symbol_range llvm::MCAssembler::symbols ( )

Definition at line 322 of file MCAssembler.h.

References llvm::make_range().

Referenced by addData(), llvm::MachObjectWriter::computeSymbolTable(), and isWeak().

◆ symbols() [2/2]

const_symbol_range llvm::MCAssembler::symbols ( ) const

Definition at line 323 of file MCAssembler.h.

References llvm::make_range().

◆ writeFragmentPadding()

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 428 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 llvm::MCELFStreamer::MCELFStreamer(), and writeFragment().

◆ writeSectionData()

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

Friends And Related Function Documentation

◆ MCAsmLayout

friend class MCAsmLayout

Definition at line 60 of file MCAssembler.h.

Member Data Documentation

◆ Major

unsigned llvm::MCAssembler::Major

Definition at line 89 of file MCAssembler.h.

◆ Minor

unsigned llvm::MCAssembler::Minor

Definition at line 90 of file MCAssembler.h.

◆ Update

unsigned llvm::MCAssembler::Update

Definition at line 91 of file MCAssembler.h.

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