LLVM  16.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...
Align previous () const
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...


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 ( )

Default is byte-aligned.

◆ Align() [2/5]

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

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)

◆ Align() [4/5]

llvm::Align::Align ( uint64_t  Value)

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)

Constexpr constructor from LogValue type.

Definition at line 107 of file Alignment.h.

Member Function Documentation

◆ Constant()

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

Allow constructions of constexpr Align.

Definition at line 96 of file Alignment.h.

◆ Of()

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

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)

◆ operator=() [2/2]

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

◆ previous()

Align llvm::Align::previous ( ) const

Definition at line 88 of file Alignment.h.

References assert().

Referenced by getMemcpyLoadsAndStores().

◆ value()

uint64_t llvm::Align::value ( ) const

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(), adjustByValArgAlignment(), llvm::alignAddr(), llvm::BumpPtrAllocatorImpl< MallocAllocator, 65536 >::Allocate(), llvm::HexagonFrameLowering::assignCalleeSavedSpillSlots(), llvm::MachineIRBuilder::buildAssertAlign(), llvm::MachineIRBuilder::buildDynStackAlloc(), buildFrameDebugInfo(), llvm::SPIRVGlobalRegistry::buildGlobalVariable(), CC_AIX(), CC_ARM_AAPCS_Custom_Aggregate(), llvm::FunctionComparator::cmpAligns(), combineStore(), llvm::MCAssembler::computeFragmentSize(), llvm::MIRPrinter::convert(), llvm::IRBuilderBase::CreateMaskedGather(), llvm::IRBuilderBase::CreateMaskedLoad(), llvm::IRBuilderBase::CreateMaskedScatter(), llvm::IRBuilderBase::CreateMaskedStore(), llvm::createMemCpyLoopKnownSize(), llvm::ARMFrameLowering::determineCalleeSaves(), emitAligningInstructions(), llvm::AsmPrinter::emitAlignment(), llvm::AMDGPUTargetAsmStreamer::emitAMDGPULDS(), llvm::AMDGPUTargetELFStreamer::emitAMDGPULDS(), llvm::SIFrameLowering::emitEpilogue(), llvm::HexagonDAGToDAGISel::emitFunctionEntryCode(), llvm::AsmPrinter::emitGlobalVariable(), llvm::SIFrameLowering::emitPrologue(), llvm::MipsSEFrameLowering::emitPrologue(), llvm::SparcFrameLowering::emitPrologue(), llvm::XCoreFrameLowering::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::MCSection::getAlignment(), llvm::MemSDNode::getAlignment(), llvm::X86TargetLowering::getByValTypeAlignment(), llvm::PPCTargetLowering::getByValTypeAlignment(), getELFSectionNameForGlobal(), llvm::MachineJumpTableInfo::getEntryAlignment(), llvm::RISCVFrameLowering::getFirstSPAdjustAmount(), llvm::M68kFrameLowering::getFrameIndexReference(), llvm::VNCoercion::getLoadLoadClobberFullWidthSize(), llvm::HexagonTTIImpl::getMemoryOpCost(), llvm::ARMBaseInstrInfo::getOutliningType(), llvm::SITargetLowering::getPrefLoopAlignment(), llvm::DataLayout::getPrefTypeAlignment(), llvm::NVPTXTargetLowering::getPrototype(), llvm::TargetFrameLowering::getStackAlignment(), llvm::PPCTTIImpl::getVPMemoryOpCost(), hasTocDataAttr(), insertSpills(), llvm::ARMTTIImpl::instCombineIntrinsic(), isAgainstBoundary(), isAligned(), llvm::isAligned(), llvm::isDereferenceableAndAlignedInLoop(), isDereferenceableAndAlignedPointer(), llvm::MemOp::isDstAligned(), isGPRShadowAligned(), llvm::MemOp::isSrcAligned(), llvm::AMDGPULegalizerInfo::legalizeLoad(), LowerAsSplatVectorLoad(), llvm::NVPTXTargetLowering::LowerCall(), llvm::LegalizerHelper::lowerDynStackAlloc(), llvm::ARMTargetLowering::lowerInterleavedLoad(), lowerLoadF128(), lowerLoadI1(), llvm::MipsTargetLowering::lowerSTORE(), lowerStoreF128(), lowerStoreI1(), llvm::HexagonTargetLowering::LowerUnalignedLoad(), 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(), replaceFrameSizeAndAlignment(), llvm::TargetLoweringObjectFileXCOFF::SelectSectionForGlobal(), setAlignFlagsForFI(), llvm::RISCVAsmBackend::shouldInsertExtraNopBytesForCodeAlign(), solveDIType(), llvm::AMDGPU::splitMUBUFOffset(), TryCombineBaseUpdate(), tryToShorten(), and llvm::UnknownPadding().

Friends And Related Function Documentation

◆ decodeMaybeAlign

struct MaybeAlign decodeMaybeAlign ( unsigned  Value)

Dual operation of the encode function above.

Definition at line 221 of file Alignment.h.

◆ encode

unsigned encode ( struct MaybeAlign  A)

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

Definition at line 218 of file Alignment.h.

◆ Log2

unsigned Log2 ( Align  A)

Returns the log2 of the alignment.

Definition at line 209 of file Alignment.h.

◆ MaybeAlign

friend struct MaybeAlign

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 

Definition at line 263 of file Alignment.h.

◆ operator<

bool operator< ( Align  Lhs,
Align  Rhs 

Definition at line 272 of file Alignment.h.

◆ operator<=

bool operator<= ( Align  Lhs,
Align  Rhs 

Definition at line 266 of file Alignment.h.

◆ operator==

bool operator== ( Align  Lhs,
Align  Rhs 

Comparisons operators between Align.

Definition at line 260 of file Alignment.h.

◆ operator>

bool operator> ( Align  Lhs,
Align  Rhs 

Definition at line 275 of file Alignment.h.

◆ operator>=

bool operator>= ( Align  Lhs,
Align  Rhs 

Definition at line 269 of file Alignment.h.

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