LLVM  14.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. More...
 
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. More...
 
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. More...
 
constexpr Align (LogValue CA)
 Constexpr constructor from LogValue type. More...
 

Static Public Member Functions

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

Friends

struct MaybeAlign
 The log2 of the required alignment. More...
 
unsigned Log2 (Align)
 Returns the log2 of the alignment. More...
 
bool operator== (Align Lhs, Align Rhs)
 Comparisons operators between Align. More...
 
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. More...
 
struct MaybeAlign decodeMaybeAlign (unsigned Value)
 Dual operation of the encode function above. More...
 

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 99 of file Alignment.h.

Member Function Documentation

◆ Constant()

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

Allow constructions of constexpr Align.

Definition at line 88 of file Alignment.h.

◆ Of()

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

Allow constructions of constexpr Align from types.

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

Definition at line 94 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

◆ 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::AttrBuilder::addAlignmentAttr(), llvm::AttrBuilder::addStackAlignmentAttr(), llvm::alignAddr(), llvm::BumpPtrAllocatorImpl< MallocAllocator, 65536 >::Allocate(), llvm::HexagonFrameLowering::assignCalleeSavedSpillSlots(), llvm::MachineIRBuilder::buildDynStackAlloc(), buildFrameDebugInfo(), CC_AIX(), CC_ARM_AAPCS_Custom_Aggregate(), llvm::MIRPrinter::convert(), llvm::IRBuilderBase::CreateMaskedGather(), llvm::IRBuilderBase::CreateMaskedLoad(), llvm::IRBuilderBase::CreateMaskedScatter(), llvm::IRBuilderBase::CreateMaskedStore(), llvm::createMemCpyLoopKnownSize(), llvm::createMemCpyLoopUnknownSize(), llvm::IRBuilderBase::CreateMemSet(), llvm::ARMFrameLowering::determineCalleeSaves(), emitAligningInstructions(), llvm::AsmPrinter::emitAlignment(), llvm::AMDGPUTargetAsmStreamer::emitAMDGPULDS(), llvm::AMDGPUTargetELFStreamer::emitAMDGPULDS(), llvm::SIFrameLowering::emitEpilogue(), llvm::HexagonDAGToDAGISel::emitFunctionEntryCode(), llvm::AsmPrinter::emitGlobalVariable(), llvm::MipsSEFrameLowering::emitPrologue(), llvm::SparcFrameLowering::emitPrologue(), llvm::XCoreFrameLowering::emitPrologue(), llvm::SIFrameLowering::emitPrologue(), llvm::ARMFrameLowering::emitPrologue(), llvm::WebAssemblyFrameLowering::emitPrologue(), llvm::BPFSelectionDAGInfo::EmitTargetCodeForMemcpy(), llvm::X86SelectionDAGInfo::EmitTargetCodeForMemcpy(), llvm::ARMSelectionDAGInfo::EmitTargetCodeForMemcpy(), llvm::ARMSelectionDAGInfo::EmitTargetCodeForMemmove(), llvm::SystemZSelectionDAGInfo::EmitTargetCodeForMemset(), llvm::ARMSelectionDAGInfo::EmitTargetCodeForMemset(), llvm::HexagonEvaluator::evaluate(), llvm::DataLayout::getABITypeAlignment(), llvm::GlobalObject::getAlignment(), llvm::AllocaInst::getAlignment(), llvm::MCSection::getAlignment(), llvm::LoadInst::getAlignment(), llvm::StoreInst::getAlignment(), llvm::MemSDNode::getAlignment(), llvm::PPCTargetLowering::getByValTypeAlignment(), llvm::X86TargetLowering::getByValTypeAlignment(), getELFSectionNameForGlobal(), llvm::MachineJumpTableInfo::getEntryAlignment(), llvm::SelectionDAG::getEVTAlignment(), llvm::RISCVFrameLowering::getFirstSPAdjustAmount(), getFnStackAlignment(), llvm::M68kFrameLowering::getFrameIndexReference(), llvm::AMDGPUMachineFunction::getMaxKernArgAlign(), llvm::HexagonTTIImpl::getMemoryOpCost(), llvm::ARMBaseInstrInfo::getOutliningType(), llvm::SITargetLowering::getPrefLoopAlignment(), llvm::DataLayout::getPrefTypeAlignment(), llvm::TargetFrameLowering::getStackAlignment(), hasTocDataAttr(), AAAlignImpl::initialize(), llvm::ARMTTIImpl::instCombineIntrinsic(), isAgainstBoundary(), isAligned(), llvm::isAligned(), llvm::isDereferenceableAndAlignedInLoop(), isDereferenceableAndAlignedPointer(), llvm::MemOp::isDstAligned(), isGPRShadowAligned(), llvm::MemOp::isSrcAligned(), llvm::AMDGPULegalizerInfo::legalizeLoad(), LowerAsSplatVectorLoad(), llvm::NVPTXTargetLowering::LowerCall(), lowerLoadF128(), lowerStoreF128(), llvm::HexagonTargetLowering::LowerUnalignedLoad(), llvm::operator!=(), llvm::operator*(), llvm::operator/(), llvm::operator<(), llvm::operator<=(), llvm::operator==(), llvm::operator>(), llvm::operator>=(), llvm::yaml::ScalarTraits< Align >::output(), PerformExtractFpToIntStores(), PerformSplittingMVETruncToNarrowingStores(), PerformSplittingToNarrowingStores(), llvm::PPCRegisterInfo::prepareDynamicAlloca(), llvm::MachineMemOperand::print(), llvm::MachineBasicBlock::printName(), llvm::TargetLoweringObjectFileXCOFF::SelectSectionForGlobal(), setAlignFlagsForFI(), llvm::AMDGPU::splitMUBUFOffset(), tryToShorten(), llvm::UnknownPadding(), and AAAlignFloating::updateImpl().

Friends And Related Function Documentation

◆ decodeMaybeAlign

struct MaybeAlign decodeMaybeAlign ( unsigned  Value)
friend

Dual operation of the encode function above.

Definition at line 235 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 232 of file Alignment.h.

◆ Log2

unsigned Log2 ( Align  A)
friend

Returns the log2 of the alignment.

Definition at line 207 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 285 of file Alignment.h.

◆ operator<

bool operator< ( Align  Lhs,
Align  Rhs 
)
friend

Definition at line 294 of file Alignment.h.

◆ operator<=

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

Definition at line 288 of file Alignment.h.

◆ operator==

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

Comparisons operators between Align.

Definition at line 282 of file Alignment.h.

◆ operator>

bool operator> ( Align  Lhs,
Align  Rhs 
)
friend

Definition at line 297 of file Alignment.h.

◆ operator>=

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

Definition at line 291 of file Alignment.h.


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