LLVM  10.0.0svn
llvm::MCAsmLayout Class Reference

Encapsulates the layout of an assembly file at a particular point in time. More...

#include "llvm/MC/MCAsmLayout.h"

## Public Member Functions

MCAsmLayout (MCAssembler &Assembler)

MCAssemblergetAssembler () const
Get the assembler object this is a layout for. More...

void invalidateFragmentsFrom (MCFragment *F)
Invalidate the fragments starting with F because it has been resized. More...

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. More...

Section Access (in layout order)
llvm::SmallVectorImpl< MCSection * > & getSectionOrder ()

const llvm::SmallVectorImpl< MCSection * > & getSectionOrder () const

Fragment Layout Data
uint64_t getFragmentOffset (const MCFragment *F) const
Get the offset of the given fragment inside its containing section. More...

Utility Functions
uint64_t getSectionAddressSize (const MCSection *Sec) const
Get the address space size of the given section, as it effects layout. More...

uint64_t getSectionFileSize (const MCSection *Sec) const
Get the data size of the given section, as emitted to the object file. More...

bool getSymbolOffset (const MCSymbol &S, uint64_t &Val) const
Get the offset of the given symbol, as computed in the current layout. More...

uint64_t getSymbolOffset (const MCSymbol &S) const
Variant that reports a fatal error if the offset is not computable. More...

const MCSymbolgetBaseSymbol (const MCSymbol &Symbol) const
If this symbol is equivalent to A + Constant, return A. More...

## Detailed 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.

Definition at line 28 of file MCAsmLayout.h.

## ◆ MCAsmLayout()

 MCAsmLayout::MCAsmLayout ( MCAssembler & Assembler )

Definition at line 32 of file MCFragment.cpp.

## ◆ getAssembler()

 MCAssembler& llvm::MCAsmLayout::getAssembler ( ) const
inline

Get the assembler object this is a layout for.

Definition at line 50 of file MCAsmLayout.h.

References invalidateFragmentsFrom(), and layoutFragment().

## ◆ getBaseSymbol()

 const MCSymbol * MCAsmLayout::getBaseSymbol ( const MCSymbol & Symbol ) const

If this symbol is equivalent to A + Constant, return A.

Definition at line 139 of file MCFragment.cpp.

Referenced by getSectionOrder(), getSymbolValue(), isIFunc(), and isWeak().

## ◆ getFragmentOffset()

 uint64_t MCAsmLayout::getFragmentOffset ( const MCFragment * F ) const

Get the offset of the given fragment inside its containing section.

Definition at line 77 of file MCFragment.cpp.

References assert().

 uint64_t MCAsmLayout::getSectionAddressSize ( const MCSection * Sec ) const

Get the address space size of the given section, as it effects layout.

This may differ from the size reported by

getSectionSize() by not including section tail padding.

Definition at line 175 of file MCFragment.cpp.

## ◆ getSectionFileSize()

 uint64_t MCAsmLayout::getSectionFileSize ( const MCSection * Sec ) const

Get the data size of the given section, as emitted to the object file.

Definition at line 181 of file MCFragment.cpp.

## ◆ getSectionOrder() [1/2]

 llvm::SmallVectorImpl& llvm::MCAsmLayout::getSectionOrder ( )
inline

Definition at line 65 of file MCAsmLayout.h.

## ◆ getSectionOrder() [2/2]

 const llvm::SmallVectorImpl& llvm::MCAsmLayout::getSectionOrder ( ) const
inline

Definition at line 66 of file MCAsmLayout.h.

## ◆ getSymbolOffset() [1/2]

 bool MCAsmLayout::getSymbolOffset ( const MCSymbol & S, uint64_t & Val ) const

Get the offset of the given symbol, as computed in the current layout.

Returns
True on success.

Definition at line 129 of file MCFragment.cpp.

References getSymbolOffsetImpl().

## ◆ getSymbolOffset() [2/2]

 uint64_t MCAsmLayout::getSymbolOffset ( const MCSymbol & S ) const

Variant that reports a fatal error if the offset is not computable.

Definition at line 133 of file MCFragment.cpp.

References getSymbolOffsetImpl().

## ◆ invalidateFragmentsFrom()

 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 51 of file MCFragment.cpp.

Referenced by llvm::MCAssembler::Finish(), getAssembler(), and llvm::MCCodePadder::relaxFragment().

## ◆ layoutFragment()

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

Referenced by getAssembler(), and invalidateFragmentsFrom().

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