class MCAsmLayout
Declaration
class MCAsmLayout { /* full declaration omitted */ };
Description
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.
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:28
Member Variables
- private llvm::MCAssembler& Assembler
- private llvm::SmallVector<MCSection*, 16> SectionOrder
- List of sections in layout order.
- private DenseMap<const llvm::MCSection*, llvm::MCFragment*> LastValidFragment
- The last fragment which was laid out, or 0 if nothing has been laid out. Fragments are always laid out in order, so all fragments with a lower ordinal will be valid.
Method Overview
- public MCAsmLayout(llvm::MCAssembler & Assembler)
- public bool canGetFragmentOffset(const llvm::MCFragment * F) const
- private void ensureValid(const llvm::MCFragment * F) const
- public llvm::MCAssembler & getAssembler() const
- public const llvm::MCSymbol * getBaseSymbol(const llvm::MCSymbol & Symbol) const
- public uint64_t getFragmentOffset(const llvm::MCFragment * F) const
- public uint64_t getSectionAddressSize(const llvm::MCSection * Sec) const
- public uint64_t getSectionFileSize(const llvm::MCSection * Sec) const
- public llvm::SmallVectorImpl<MCSection *> & getSectionOrder()
- public const llvm::SmallVectorImpl<MCSection *> & getSectionOrder() const
- public bool getSymbolOffset(const llvm::MCSymbol & S, uint64_t & Val) const
- public uint64_t getSymbolOffset(const llvm::MCSymbol & S) const
- public void invalidateFragmentsFrom(llvm::MCFragment * F)
- private bool isFragmentValid(const llvm::MCFragment * F) const
- public void layoutFragment(llvm::MCFragment * Fragment)
Methods
¶MCAsmLayout(llvm::MCAssembler& Assembler)
MCAsmLayout(llvm::MCAssembler& Assembler)
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:47
Parameters
- llvm::MCAssembler& Assembler
¶bool canGetFragmentOffset(
const llvm::MCFragment* F) const
bool canGetFragmentOffset(
const llvm::MCFragment* F) const
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:54
Parameters
- const llvm::MCFragment* F
Returns
whether the offset of fragment \p F can be obtained via getFragmentOffset.
¶void ensureValid(const llvm::MCFragment* F) const
void ensureValid(const llvm::MCFragment* F) const
Description
Make sure that the layout for the given fragment is valid, lazily computing it if necessary.
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:41
Parameters
- const llvm::MCFragment* F
¶llvm::MCAssembler& getAssembler() const
llvm::MCAssembler& getAssembler() const
Description
Get the assembler object this is a layout for.
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:50
¶const llvm::MCSymbol* getBaseSymbol(
const llvm::MCSymbol& Symbol) const
const llvm::MCSymbol* getBaseSymbol(
const llvm::MCSymbol& Symbol) const
Description
If this symbol is equivalent to A + Constant, return A.
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:103
Parameters
- const llvm::MCSymbol& Symbol
¶uint64_t getFragmentOffset(
const llvm::MCFragment* F) const
uint64_t getFragmentOffset(
const llvm::MCFragment* F) const
Description
Get the offset of the given fragment inside its containing section.
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:79
Parameters
- const llvm::MCFragment* F
¶uint64_t getSectionAddressSize(
const llvm::MCSection* Sec) const
uint64_t getSectionAddressSize(
const llvm::MCSection* Sec) const
Description
Get the address space size of the given section, as it effects layout. This may differ from the size reported by
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:88
Parameters
- const llvm::MCSection* Sec
¶uint64_t getSectionFileSize(
const llvm::MCSection* Sec) const
uint64_t getSectionFileSize(
const llvm::MCSection* Sec) const
Description
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.
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:92
Parameters
- const llvm::MCSection* Sec
¶llvm::SmallVectorImpl<MCSection*>&
getSectionOrder()
llvm::SmallVectorImpl<MCSection*>&
getSectionOrder()
Description
@ {
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:69
¶const llvm::SmallVectorImpl<MCSection*>&
getSectionOrder() const
const llvm::SmallVectorImpl<MCSection*>&
getSectionOrder() const
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:70
¶bool getSymbolOffset(const llvm::MCSymbol& S,
uint64_t& Val) const
bool getSymbolOffset(const llvm::MCSymbol& S,
uint64_t& Val) const
Description
Get the offset of the given symbol, as computed in the current layout.
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:97
Parameters
- const llvm::MCSymbol& S
- uint64_t& Val
Returns
True on success.
¶uint64_t getSymbolOffset(
const llvm::MCSymbol& S) const
uint64_t getSymbolOffset(
const llvm::MCSymbol& S) const
Description
Variant that reports a fatal error if the offset is not computable.
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:100
Parameters
- const llvm::MCSymbol& S
¶void invalidateFragmentsFrom(llvm::MCFragment* F)
void invalidateFragmentsFrom(llvm::MCFragment* F)
Description
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.
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:59
Parameters
¶bool isFragmentValid(
const llvm::MCFragment* F) const
bool isFragmentValid(
const llvm::MCFragment* F) const
Description
Is the layout for this fragment valid?
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:44
Parameters
- const llvm::MCFragment* F
¶void layoutFragment(llvm::MCFragment* Fragment)
void layoutFragment(llvm::MCFragment* Fragment)
Description
Perform layout for a single fragment, assuming that the previous fragment has already been laid out correctly, and the parent section has been initialized.
Declared at: llvm/include/llvm/MC/MCAsmLayout.h:64
Parameters
- llvm::MCFragment* Fragment