LLVM 19.0.0git
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::Align Struct Reference

This struct is a compact representation of a valid (non-zero power of two) alignment. More...

#include "llvm/Support/Alignment.h"

Public Member Functions

constexpr Align ()=default
 Default is byte-aligned.
 
constexpr Align (const Align &Other)=default
 Do not perform checks in case of copy/move construct/assign, because the checks have been performed when building Other.
 
constexpr Align (Align &&Other)=default
 
Alignoperator= (const Align &Other)=default
 
Alignoperator= (Align &&Other)=default
 
 Align (uint64_t Value)
 
uint64_t value () const
 This is a hole in the type system and should not be abused.
 
Align previous () const
 
constexpr Align (LogValue CA)
 Constexpr constructor from LogValue type.
 

Static Public Member Functions

template<size_t kValue>
static constexpr Align Constant ()
 Allow constructions of constexpr Align.
 
template<typename T >
static constexpr Align Of ()
 Allow constructions of constexpr Align from types.
 

Friends

struct MaybeAlign
 The log2 of the required alignment.
 
unsigned Log2 (Align)
 Returns the log2 of the alignment.
 
bool operator== (Align Lhs, Align Rhs)
 Comparisons operators between Align.
 
bool operator!= (Align Lhs, Align Rhs)
 
bool operator<= (Align Lhs, Align Rhs)
 
bool operator>= (Align Lhs, Align Rhs)
 
bool operator< (Align Lhs, Align Rhs)
 
bool operator> (Align Lhs, Align Rhs)
 
unsigned encode (struct MaybeAlign A)
 Returns a representation of the alignment that encodes undefined as 0.
 
struct MaybeAlign decodeMaybeAlign (unsigned Value)
 Dual operation of the encode function above.
 

Detailed Description

This struct is a compact representation of a valid (non-zero power of two) alignment.

It is suitable for use as static global constants.

Definition at line 39 of file Alignment.h.

Constructor & Destructor Documentation

◆ Align() [1/5]

constexpr llvm::Align::Align ( )
constexprdefault

Default is byte-aligned.

◆ Align() [2/5]

constexpr llvm::Align::Align ( const Align Other)
constexprdefault

Do not perform checks in case of copy/move construct/assign, because the checks have been performed when building Other.

◆ Align() [3/5]

constexpr llvm::Align::Align ( Align &&  Other)
constexprdefault

◆ Align() [4/5]

llvm::Align::Align ( uint64_t  Value)
inlineexplicit

Definition at line 76 of file Alignment.h.

References assert(), llvm::isPowerOf2_64(), and llvm::Log2_64().

◆ Align() [5/5]

constexpr llvm::Align::Align ( LogValue  CA)
inlineconstexpr

Constexpr constructor from LogValue type.

Definition at line 107 of file Alignment.h.

Member Function Documentation

◆ Constant()

template<size_t kValue>
static constexpr Align llvm::Align::Constant ( )
inlinestaticconstexpr

Allow constructions of constexpr Align.

Definition at line 96 of file Alignment.h.

◆ Of()

template<typename T >
static constexpr Align llvm::Align::Of ( )
inlinestaticconstexpr

Allow constructions of constexpr Align from types.

Compile time equivalent to Align(alignof(T)).

Definition at line 102 of file Alignment.h.

◆ operator=() [1/2]

Align & llvm::Align::operator= ( Align &&  Other)
default

◆ operator=() [2/2]

Align & llvm::Align::operator= ( const Align Other)
default

◆ previous()

Align llvm::Align::previous ( ) const
inline

Definition at line 88 of file Alignment.h.

References assert().

Referenced by getMemcpyLoadsAndStores(), getMemmoveLoadsAndStores(), and getMemsetStores().

◆ value()

uint64_t llvm::Align::value ( ) const
inline

This is a hole in the type system and should not be abused.

Needed to interact with C for instance.

Definition at line 85 of file Alignment.h.

Referenced by llvm::AArch64FunctionInfo::AArch64FunctionInfo(), llvm::AttrBuilder::addAlignmentAttr(), addEmuTlsVar(), llvm::AttrBuilder::addStackAlignmentAttr(), adjustByValArgAlignment(), llvm::RISCVRegisterInfo::adjustReg(), llvm::alignAddr(), llvm::BumpPtrAllocatorImpl< AllocatorT, SlabSize, SizeThreshold, GrowthDelay >::Allocate(), llvm::HexagonFrameLowering::assignCalleeSavedSpillSlots(), llvm::MachineIRBuilder::buildAssertAlign(), llvm::MachineIRBuilder::buildDynStackAlloc(), buildFrameDebugInfo(), llvm::SPIRVGlobalRegistry::buildGlobalVariable(), CC_AIX(), CC_ARM_AAPCS_Custom_Aggregate(), combineStore(), llvm::MCAssembler::computeFragmentSize(), llvm::RuntimeDyldImpl::computeSectionStubBufSize(), llvm::MIRPrinter::convert(), llvm::IRBuilderBase::CreateMaskedGather(), llvm::IRBuilderBase::CreateMaskedLoad(), llvm::IRBuilderBase::CreateMaskedScatter(), llvm::IRBuilderBase::CreateMaskedStore(), llvm::createMemCpyLoopKnownSize(), llvm::ARMFrameLowering::determineCalleeSaves(), emitAligningInstructions(), llvm::AMDGPUTargetAsmStreamer::emitAMDGPULDS(), llvm::MCELFStreamer::emitBundleAlignMode(), emitConstantSizeRepmov(), llvm::SIFrameLowering::emitEpilogue(), llvm::HexagonDAGToDAGISel::emitFunctionEntryCode(), llvm::AArch64FrameLowering::emitPrologue(), llvm::SIFrameLowering::emitPrologue(), llvm::ARMFrameLowering::emitPrologue(), llvm::CSKYFrameLowering::emitPrologue(), llvm::MipsSEFrameLowering::emitPrologue(), llvm::RISCVFrameLowering::emitPrologue(), llvm::SparcFrameLowering::emitPrologue(), llvm::WebAssemblyFrameLowering::emitPrologue(), llvm::XCoreFrameLowering::emitPrologue(), llvm::RuntimeDyldImpl::emitSection(), llvm::ARMSelectionDAGInfo::EmitTargetCodeForMemcpy(), llvm::BPFSelectionDAGInfo::EmitTargetCodeForMemcpy(), llvm::ARMSelectionDAGInfo::EmitTargetCodeForMemmove(), llvm::ARMSelectionDAGInfo::EmitTargetCodeForMemset(), llvm::MCObjectStreamer::emitValueToAlignment(), llvm::HexagonEvaluator::evaluate(), llvm::MipsTargetELFStreamer::finish(), llvm::GlobalObject::getAlignment(), getAlignment(), llvm::PPCTargetLowering::getByValTypeAlignment(), llvm::X86TargetLowering::getByValTypeAlignment(), llvm::LegalizerHelper::getDynStackAllocTargetPtr(), getELFSectionNameForGlobal(), llvm::MCSymbolMachO::getEncodedFlags(), llvm::MachineJumpTableInfo::getEntryAlignment(), llvm::RISCVFrameLowering::getFirstSPAdjustAmount(), llvm::LoongArchFrameLowering::getFirstSPAdjustAmount(), llvm::M68kFrameLowering::getFrameIndexReference(), llvm::HexagonTTIImpl::getMemoryOpCost(), llvm::WritableMemoryBuffer::getNewUninitMemBuffer(), llvm::RISCVTargetLowering::getOptimalMemOpType(), getOptimalRepmovsType(), llvm::ARMBaseInstrInfo::getOutliningTypeImpl(), llvm::SITargetLowering::getPrefLoopAlignment(), llvm::DataLayout::getPrefTypeAlignment(), llvm::NVPTXTargetLowering::getPrototype(), llvm::TargetFrameLowering::getStackAlignment(), llvm::PPCTTIImpl::getVPMemoryOpCost(), insertSpills(), llvm::ARMTTIImpl::instCombineIntrinsic(), isAgainstBoundary(), llvm::isAligned(), isBitAligned(), llvm::isDereferenceableAndAlignedInLoop(), isDereferenceableAndAlignedPointer(), llvm::MemOp::isDstAligned(), isGPRShadowAligned(), llvm::MemOp::isSrcAligned(), llvm::AMDGPULegalizerInfo::legalizeLoad(), LowerAsSplatVectorLoad(), llvm::NVPTXTargetLowering::LowerCall(), llvm::ARMTargetLowering::lowerInterleavedLoad(), llvm::MipsTargetLowering::lowerSTORE(), llvm::HexagonTargetLowering::LowerUnalignedLoad(), llvm::operator!=(), llvm::operator<(), llvm::operator<=(), llvm::operator==(), llvm::operator>(), llvm::operator>=(), llvm::yaml::ScalarTraits< Align >::output(), llvm::PPCRegisterInfo::prepareDynamicAlloca(), llvm::MachineMemOperand::print(), llvm::MachineBasicBlock::printName(), replaceFrameSizeAndAlignment(), setAlignFlagsForFI(), llvm::LoongArchAsmBackend::shouldInsertExtraNopBytesForCodeAlign(), llvm::RISCVAsmBackend::shouldInsertExtraNopBytesForCodeAlign(), solveDIType(), llvm::SIInstrInfo::splitMUBUFOffset(), tocDataChecks(), TryCombineBaseUpdate(), tryToShorten(), and llvm::UnknownPadding().

Friends And Related Function Documentation

◆ decodeMaybeAlign

struct MaybeAlign decodeMaybeAlign ( unsigned  Value)
friend

Dual operation of the encode function above.

Definition at line 220 of file Alignment.h.

◆ encode

unsigned encode ( struct MaybeAlign  A)
friend

Returns a representation of the alignment that encodes undefined as 0.

Definition at line 217 of file Alignment.h.

◆ Log2

unsigned Log2 ( Align  A)
friend

Returns the log2 of the alignment.

Definition at line 208 of file Alignment.h.

◆ MaybeAlign

friend struct MaybeAlign
friend

The log2 of the required alignment.

ShiftValue is less than 64 by construction.

Definition at line 44 of file Alignment.h.

◆ operator!=

bool operator!= ( Align  Lhs,
Align  Rhs 
)
friend

Definition at line 262 of file Alignment.h.

◆ operator<

bool operator< ( Align  Lhs,
Align  Rhs 
)
friend

Definition at line 271 of file Alignment.h.

◆ operator<=

bool operator<= ( Align  Lhs,
Align  Rhs 
)
friend

Definition at line 265 of file Alignment.h.

◆ operator==

bool operator== ( Align  Lhs,
Align  Rhs 
)
friend

Comparisons operators between Align.

Definition at line 259 of file Alignment.h.

◆ operator>

bool operator> ( Align  Lhs,
Align  Rhs 
)
friend

Definition at line 274 of file Alignment.h.

◆ operator>=

bool operator>= ( Align  Lhs,
Align  Rhs 
)
friend

Definition at line 268 of file Alignment.h.


The documentation for this struct was generated from the following file: