LLVM API Documentation
#include <MCAsmLayout.h>
Public Types | |
typedef llvm::SmallVectorImpl < MCSectionData * > ::const_iterator | const_iterator |
typedef llvm::SmallVectorImpl < MCSectionData * >::iterator | iterator |
Public Member Functions | |
MCAsmLayout (MCAssembler &_Assembler) | |
MCAssembler & | getAssembler () const |
Get the assembler object this is a layout for. | |
void | invalidateFragmentsFrom (MCFragment *F) |
Invalidate the fragments starting with F because it has been resized. The fragment's size should have already been updated, but its bundle padding will be recomputed. | |
void | layoutFragment (MCFragment *Fragment) |
Perform layout for a single fragment, assuming that the previous fragment has already been laid out correctly, and the parent section has been initialized. | |
uint64_t | getFragmentOffset (const MCFragment *F) const |
Get the offset of the given fragment inside its containing section. | |
uint64_t | getSectionAddressSize (const MCSectionData *SD) const |
Get the address space size of the given section, as it effects layout. This may differ from the size reported by. | |
uint64_t | getSectionFileSize (const MCSectionData *SD) const |
Get the data size of the given section, as emitted to the object file. This may include additional padding, or be 0 for virtual sections. | |
bool | getSymbolOffset (const MCSymbolData *SD, uint64_t &Val) const |
Get the offset of the given symbol, as computed in the current layout. | |
uint64_t | getSymbolOffset (const MCSymbolData *SD) const |
Variant that reports a fatal error if the offset is not computable. | |
const MCSymbol * | getBaseSymbol (const MCSymbol &Symbol) const |
If this symbol is equivalent to A + Constant, return A. | |
Section Access (in layout order) | |
llvm::SmallVectorImpl < MCSectionData * > & | getSectionOrder () |
const llvm::SmallVectorImpl < MCSectionData * > & | getSectionOrder () const |
Encapsulates the layout of an assembly file at a particular point in time.
Assembly may require computing multiple layouts for a particular assembly file as part of the relaxation process. This class encapsulates the layout at a single point in time in such a way that it is always possible to efficiently compute the exact address of any symbol in the assembly file, even during the relaxation process.
Definition at line 30 of file MCAsmLayout.h.
Definition at line 32 of file MCAsmLayout.h.
Definition at line 33 of file MCAsmLayout.h.
MCAsmLayout::MCAsmLayout | ( | MCAssembler & | _Assembler | ) |
Definition at line 66 of file MCAssembler.cpp.
References llvm::MCAssembler::begin(), llvm::MCAssembler::end(), and llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().
MCAssembler& llvm::MCAsmLayout::getAssembler | ( | ) | const [inline] |
Get the assembler object this is a layout for.
Definition at line 62 of file MCAsmLayout.h.
Referenced by llvm::MCExpr::EvaluateAsRelocatable(), llvm::PPCMCExpr::EvaluateAsRelocatableImpl(), llvm::MCExpr::EvaluateAsValue(), getSectionAddressSize(), llvm::MachObjectWriter::getSymbolAddress(), getSymbolOffsetImpl(), layoutFragment(), llvm::MachObjectWriter::WriteNlist(), and llvm::MachObjectWriter::WriteObject().
const MCSymbol * MCAsmLayout::getBaseSymbol | ( | const MCSymbol & | Symbol | ) | const |
If this symbol is equivalent to A + Constant, return A.
Definition at line 184 of file MCAssembler.cpp.
References llvm::ARM_PROC::A, llvm::MCExpr::EvaluateAsValue(), llvm::MCContext::FatalError(), llvm::MCAssembler::getContext(), llvm::MCSymbol::getName(), llvm::MCValue::getSymA(), llvm::MCValue::getSymB(), llvm::MCSymbolRefExpr::getSymbol(), llvm::MCSymbol::getVariableValue(), llvm::MCSymbol::isVariable(), and llvm_unreachable.
uint64_t MCAsmLayout::getFragmentOffset | ( | const MCFragment * | F | ) | const |
Get the offset of the given fragment inside its containing section.
Definition at line 115 of file MCAssembler.cpp.
Referenced by llvm::MCAssembler::computeFragmentSize(), getFixupOffset(), llvm::MachObjectWriter::getFragmentAddress(), getLabelOffset(), getSectionAddressSize(), and UpdateSymbols().
uint64_t MCAsmLayout::getSectionAddressSize | ( | const MCSectionData * | SD | ) | const |
Get the address space size of the given section, as it effects layout. This may differ from the size reported by.
Definition at line 206 of file MCAssembler.cpp.
References llvm::iplist< NodeTy, Traits >::back(), llvm::MCAssembler::computeFragmentSize(), getAssembler(), llvm::MCSectionData::getFragmentList(), and getFragmentOffset().
Referenced by llvm::MachObjectWriter::computeSectionAddresses(), llvm::MachObjectWriter::getPaddingSize(), getSectionFileSize(), llvm::MachObjectWriter::WriteObject(), llvm::MachObjectWriter::WriteSection(), and llvm::MCAssembler::writeSectionData().
uint64_t MCAsmLayout::getSectionFileSize | ( | const MCSectionData * | SD | ) | const |
Get the data size of the given section, as emitted to the object file. This may include additional padding, or be 0 for virtual sections.
Definition at line 212 of file MCAssembler.cpp.
References llvm::MCSectionData::getSection(), getSectionAddressSize(), and llvm::MCSection::isVirtualSection().
Referenced by llvm::MachObjectWriter::WriteObject(), llvm::MachObjectWriter::WriteSection(), and llvm::MCAssembler::writeSectionData().
llvm::SmallVectorImpl<MCSectionData*>& llvm::MCAsmLayout::getSectionOrder | ( | ) | [inline] |
Definition at line 77 of file MCAsmLayout.h.
Referenced by llvm::MachObjectWriter::computeSectionAddresses(), and llvm::MachObjectWriter::getPaddingSize().
const llvm::SmallVectorImpl<MCSectionData*>& llvm::MCAsmLayout::getSectionOrder | ( | ) | const [inline] |
Definition at line 80 of file MCAsmLayout.h.
bool MCAsmLayout::getSymbolOffset | ( | const MCSymbolData * | SD, |
uint64_t & | Val | ||
) | const |
Get the offset of the given symbol, as computed in the current layout.
Definition at line 174 of file MCAssembler.cpp.
References getSymbolOffsetImpl().
Referenced by llvm::MachObjectWriter::getSymbolAddress(), and getSymbolValue().
uint64_t MCAsmLayout::getSymbolOffset | ( | const MCSymbolData * | SD | ) | const |
Variant that reports a fatal error if the offset is not computable.
Definition at line 178 of file MCAssembler.cpp.
References getSymbolOffsetImpl().
void MCAsmLayout::invalidateFragmentsFrom | ( | MCFragment * | F | ) |
Invalidate the fragments starting with F because it has been resized. The fragment's size should have already been updated, but its bundle padding will be recomputed.
Definition at line 87 of file MCAssembler.cpp.
References llvm::MCFragment::getParent(), and llvm::ilist_node< NodeTy >::getPrevNode().
Referenced by CompressDebugSection().
void MCAsmLayout::layoutFragment | ( | MCFragment * | Fragment | ) |
Perform layout for a single fragment, assuming that the previous fragment has already been laid out correctly, and the parent section has been initialized.
Definition at line 580 of file MCAssembler.cpp.
References llvm::MCAssembler::computeFragmentSize(), F(), getAssembler(), llvm::MCAssembler::getBundleAlignSize(), llvm::MCFragment::getParent(), llvm::ilist_node< NodeTy >::getPrevNode(), llvm::MCFragment::hasInstructions(), llvm::MCAssembler::isBundlingEnabled(), llvm::report_fatal_error(), and llvm::MCFragment::setBundlePadding().