LLVM 20.0.0git
Classes | Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
llvm::MCSection Class Referenceabstract

Instances of this class represent a uniqued identifier for a section in the current translation unit. More...

#include "llvm/MC/MCSection.h"

Inheritance diagram for llvm::MCSection:
Inheritance graph
[legend]

Classes

struct  FragList
 
struct  iterator
 

Public Types

enum  SectionVariant {
  SV_COFF = 0 , SV_ELF , SV_GOFF , SV_MachO ,
  SV_Wasm , SV_XCOFF , SV_SPIRV , SV_DXContainer
}
 
enum  BundleLockStateType { NotBundleLocked , BundleLocked , BundleLockedAlignToEnd }
 Express the state of bundle locked groups while emitting code. More...
 

Public Member Functions

 MCSection (const MCSection &)=delete
 
MCSectionoperator= (const MCSection &)=delete
 
StringRef getName () const
 
bool isText () const
 
SectionVariant getVariant () const
 
MCSymbolgetBeginSymbol ()
 
const MCSymbolgetBeginSymbol () const
 
void setBeginSymbol (MCSymbol *Sym)
 
MCSymbolgetEndSymbol (MCContext &Ctx)
 
bool hasEnded () const
 
Align getAlign () const
 
void setAlignment (Align Value)
 
void ensureMinAlignment (Align MinAlignment)
 Makes sure that Alignment is at least MinAlignment.
 
unsigned getOrdinal () const
 
void setOrdinal (unsigned Value)
 
BundleLockStateType getBundleLockState () const
 
void setBundleLockState (BundleLockStateType NewState)
 
bool isBundleLocked () const
 
bool isBundleGroupBeforeFirstInst () const
 
void setBundleGroupBeforeFirstInst (bool IsFirst)
 
bool hasInstructions () const
 
void setHasInstructions (bool Value)
 
bool hasLayout () const
 
void setHasLayout (bool Value)
 
bool isRegistered () const
 
void setIsRegistered (bool Value)
 
const MCDummyFragmentgetDummyFragment () const
 
MCDummyFragmentgetDummyFragment ()
 
FragListcurFragList () const
 
iterator begin () const
 
iterator end () const
 
bool empty () const
 
void dump () const
 
virtual void printSwitchToSection (const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, uint32_t Subsection) const =0
 
virtual bool useCodeAlign () const =0
 Return true if a .align directive should use "optimized nops" to fill instead of 0s.
 
bool isVirtualSection () const
 Check whether this section is "virtual", that is has no actual object file contents.
 
virtual StringRef getVirtualSectionKind () const
 

Public Attributes

friend MCAssembler
 
friend MCObjectStreamer
 

Static Public Attributes

static constexpr unsigned NonUniqueID = ~0U
 

Protected Member Functions

 MCSection (SectionVariant V, StringRef Name, bool IsText, bool IsVirtual, MCSymbol *Begin)
 
 ~MCSection ()
 

Protected Attributes

StringRef Name
 
SectionVariant Variant
 

Detailed Description

Instances of this class represent a uniqued identifier for a section in the current translation unit.

The MCContext class uniques and creates these.

Definition at line 36 of file MCSection.h.

Member Enumeration Documentation

◆ BundleLockStateType

Express the state of bundle locked groups while emitting code.

Enumerator
NotBundleLocked 
BundleLocked 
BundleLockedAlignToEnd 

Definition at line 54 of file MCSection.h.

◆ SectionVariant

Enumerator
SV_COFF 
SV_ELF 
SV_GOFF 
SV_MachO 
SV_Wasm 
SV_XCOFF 
SV_SPIRV 
SV_DXContainer 

Definition at line 42 of file MCSection.h.

Constructor & Destructor Documentation

◆ MCSection() [1/2]

MCSection::MCSection ( SectionVariant  V,
StringRef  Name,
bool  IsText,
bool  IsVirtual,
MCSymbol Begin 
)
protected

Definition at line 22 of file MCSection.cpp.

References llvm::MCFragment::setParent().

◆ ~MCSection()

MCSection::~MCSection ( )
protected

Definition at line 40 of file MCSection.cpp.

References _, X, and Y.

◆ MCSection() [2/2]

llvm::MCSection::MCSection ( const MCSection )
delete

Member Function Documentation

◆ begin()

iterator llvm::MCSection::begin ( ) const
inline

Definition at line 182 of file MCSection.h.

References llvm::MCSection::FragList::Head.

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

◆ curFragList()

FragList * llvm::MCSection::curFragList ( ) const
inline

◆ dump()

LLVM_DUMP_METHOD void MCSection::dump ( ) const

Definition at line 71 of file MCSection.cpp.

References llvm::errs(), F, llvm::First, getName(), and OS.

Referenced by llvm::MCAssembler::dump().

◆ empty()

bool llvm::MCSection::empty ( ) const
inline

◆ end()

iterator llvm::MCSection::end ( ) const
inline

Definition at line 183 of file MCSection.h.

◆ ensureMinAlignment()

void llvm::MCSection::ensureMinAlignment ( Align  MinAlignment)
inline

◆ getAlign()

Align llvm::MCSection::getAlign ( ) const
inline

Definition at line 146 of file MCSection.h.

Referenced by addData(), getAlignment(), and llvm::MachObjectWriter::getPaddingSize().

◆ getBeginSymbol() [1/2]

MCSymbol * llvm::MCSection::getBeginSymbol ( )
inline

◆ getBeginSymbol() [2/2]

const MCSymbol * llvm::MCSection::getBeginSymbol ( ) const
inline

Definition at line 136 of file MCSection.h.

References getBeginSymbol().

◆ getBundleLockState()

BundleLockStateType llvm::MCSection::getBundleLockState ( ) const
inline

Definition at line 158 of file MCSection.h.

◆ getDummyFragment() [1/2]

MCDummyFragment & llvm::MCSection::getDummyFragment ( )
inline

Definition at line 179 of file MCSection.h.

◆ getDummyFragment() [2/2]

const MCDummyFragment & llvm::MCSection::getDummyFragment ( ) const
inline

Definition at line 178 of file MCSection.h.

◆ getEndSymbol()

MCSymbol * MCSection::getEndSymbol ( MCContext Ctx)

Definition at line 32 of file MCSection.cpp.

References llvm::MCContext::createTempSymbol().

◆ getName()

StringRef llvm::MCSection::getName ( ) const
inline

◆ getOrdinal()

unsigned llvm::MCSection::getOrdinal ( ) const
inline

Definition at line 155 of file MCSection.h.

◆ getVariant()

SectionVariant llvm::MCSection::getVariant ( ) const
inline

◆ getVirtualSectionKind()

StringRef MCSection::getVirtualSectionKind ( ) const
virtual

Reimplemented in llvm::MCSectionCOFF, and llvm::MCSectionELF.

Definition at line 68 of file MCSection.cpp.

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

◆ hasEnded()

bool MCSection::hasEnded ( ) const

Definition at line 38 of file MCSection.cpp.

References llvm::MCSymbol::isInSection().

◆ hasInstructions()

bool llvm::MCSection::hasInstructions ( ) const
inline

◆ hasLayout()

bool llvm::MCSection::hasLayout ( ) const
inline

Definition at line 172 of file MCSection.h.

Referenced by llvm::MCAssembler::ensureValid().

◆ isBundleGroupBeforeFirstInst()

bool llvm::MCSection::isBundleGroupBeforeFirstInst ( ) const
inline

Definition at line 162 of file MCSection.h.

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

◆ isBundleLocked()

bool llvm::MCSection::isBundleLocked ( ) const
inline

Definition at line 160 of file MCSection.h.

References NotBundleLocked.

◆ isRegistered()

bool llvm::MCSection::isRegistered ( ) const
inline

Definition at line 175 of file MCSection.h.

Referenced by llvm::AArch64TargetStreamer::emitNoteSection().

◆ isText()

bool llvm::MCSection::isText ( ) const
inline

◆ isVirtualSection()

bool llvm::MCSection::isVirtualSection ( ) const
inline

◆ operator=()

MCSection & llvm::MCSection::operator= ( const MCSection )
delete

◆ printSwitchToSection()

virtual void llvm::MCSection::printSwitchToSection ( const MCAsmInfo MAI,
const Triple T,
raw_ostream OS,
uint32_t  Subsection 
) const
pure virtual

◆ setAlignment()

void llvm::MCSection::setAlignment ( Align  Value)
inline

◆ setBeginSymbol()

void llvm::MCSection::setBeginSymbol ( MCSymbol Sym)
inline

Definition at line 139 of file MCSection.h.

References assert(), and Sym.

◆ setBundleGroupBeforeFirstInst()

void llvm::MCSection::setBundleGroupBeforeFirstInst ( bool  IsFirst)
inline

Definition at line 165 of file MCSection.h.

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

◆ setBundleLockState()

void MCSection::setBundleLockState ( BundleLockStateType  NewState)

◆ setHasInstructions()

void llvm::MCSection::setHasInstructions ( bool  Value)
inline

Definition at line 170 of file MCSection.h.

◆ setHasLayout()

void llvm::MCSection::setHasLayout ( bool  Value)
inline

Definition at line 173 of file MCSection.h.

Referenced by llvm::MCAssembler::ensureValid(), and llvm::MCAssembler::layout().

◆ setIsRegistered()

void llvm::MCSection::setIsRegistered ( bool  Value)
inline

Definition at line 176 of file MCSection.h.

◆ setOrdinal()

void llvm::MCSection::setOrdinal ( unsigned  Value)
inline

Definition at line 156 of file MCSection.h.

Referenced by llvm::MCAssembler::layout().

◆ useCodeAlign()

virtual bool llvm::MCSection::useCodeAlign ( ) const
pure virtual

Return true if a .align directive should use "optimized nops" to fill instead of 0s.

Implemented in llvm::MCSectionCOFF, llvm::MCSectionDXContainer, llvm::MCSectionELF, llvm::MCSectionGOFF, llvm::MCSectionMachO, llvm::MCSectionSPIRV, llvm::MCSectionWasm, and llvm::MCSectionXCOFF.

Referenced by llvm::MCAssembler::computeFragmentSize().

Member Data Documentation

◆ MCAssembler

friend llvm::MCSection::MCAssembler

Definition at line 38 of file MCSection.h.

◆ MCObjectStreamer

friend llvm::MCSection::MCObjectStreamer

Definition at line 39 of file MCSection.h.

◆ Name

StringRef llvm::MCSection::Name
protected

◆ NonUniqueID

constexpr unsigned llvm::MCSection::NonUniqueID = ~0U
staticconstexpr

◆ Variant

SectionVariant llvm::MCSection::Variant
protected

Definition at line 120 of file MCSection.h.

Referenced by getVariant().


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