LLVM  10.0.0svn
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

static constexpr const Align None ()
 Returns a default constructed Align which corresponds to no alignment. More...
 
template<size_t kValue>
static constexpr LogValue Constant ()
 Allow constructions of constexpr Align. More...
 
template<typename T >
static constexpr 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 40 of file Alignment.h.

Constructor & Destructor Documentation

◆ Align() [1/5]

constexpr llvm::Align::Align ( )
default

◆ Align() [2/5]

constexpr llvm::Align::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.

◆ Align() [3/5]

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

◆ Align() [4/5]

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

Definition at line 77 of file Alignment.h.

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

◆ Align() [5/5]

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

Constexpr constructor from LogValue type.

Definition at line 107 of file Alignment.h.

Member Function Documentation

◆ Constant()

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

Allow constructions of constexpr Align.

Definition at line 96 of file Alignment.h.

◆ None()

static constexpr const Align llvm::Align::None ( )
inlinestatic

◆ Of()

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

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= ( const Align Other)
default

◆ operator=() [2/2]

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

◆ value()

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

Friends And Related Function Documentation

◆ decodeMaybeAlign

struct MaybeAlign decodeMaybeAlign ( unsigned  Value)
friend

Dual operation of the encode function above.

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

Referenced by llvm::encode().

◆ Log2

unsigned Log2 ( Align  A)
friend

Returns the log2 of the alignment.

Definition at line 204 of file Alignment.h.

Referenced by llvm::Log2().

◆ MaybeAlign

friend struct MaybeAlign
friend

The log2 of the required alignment.

ShiftValue is less than 64 by construction.

Definition at line 45 of file Alignment.h.

Referenced by llvm::commonAlignment(), llvm::decodeMaybeAlign(), llvm::encode(), and llvm::operator/().

◆ operator!=

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

Definition at line 309 of file Alignment.h.

◆ operator<

bool operator< ( Align  Lhs,
Align  Rhs 
)
friend

Definition at line 318 of file Alignment.h.

◆ operator<=

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

Definition at line 312 of file Alignment.h.

◆ operator==

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

Comparisons operators between Align.

Definition at line 306 of file Alignment.h.

◆ operator>

bool operator> ( Align  Lhs,
Align  Rhs 
)
friend

Definition at line 321 of file Alignment.h.

◆ operator>=

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

Definition at line 315 of file Alignment.h.


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