LLVM  14.0.0git
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
llvm::detail::UniqueFunctionBase< ReturnT, ParamTs > Class Template Reference

#include "llvm/ADT/FunctionExtras.h"

Inheritance diagram for llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >:
Inheritance graph
[legend]
Collaboration diagram for llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >:
Collaboration graph
[legend]

Classes

struct  CallbacksHolder
 
struct  CallbacksHolder< CallableT, CalledAs, EnableIfTrivial< CallableT > >
 
struct  CalledAs
 
struct  IsSizeLessThanThresholdT
 

Public Member Functions

 operator bool () const
 

Protected Member Functions

NonTrivialCallbacks * getNonTrivialCallbacks () const
 
CallPtrT getCallPtr () const
 
void * getCalleePtr () const
 
void * getInlineStorage () const
 
void * getOutOfLineStorage () const
 
size_t getOutOfLineStorageSize () const
 
size_t getOutOfLineStorageAlignment () const
 
void setOutOfLineStorage (void *Ptr, size_t Size, size_t Alignment)
 
template<typename CallableT , typename CalledAsT >
 UniqueFunctionBase (CallableT Callable, CalledAs< CalledAsT >)
 
 ~UniqueFunctionBase ()
 
 UniqueFunctionBase (UniqueFunctionBase &&RHS) noexcept
 
UniqueFunctionBaseoperator= (UniqueFunctionBase &&RHS) noexcept
 
 UniqueFunctionBase ()=default
 

Static Protected Member Functions

template<typename CalledAsT >
static ReturnT CallImpl (void *CallableAddr, AdjustedParamT< ParamTs >... Params)
 
template<typename CallableT >
static void MoveImpl (void *LHSCallableAddr, void *RHSCallableAddr) noexcept
 
template<typename CallableT >
static void DestroyImpl (void *CallableAddr) noexcept
 

Protected Attributes

template<typename T >
struct IsSizeLessThanThresholdT< T, std::enable_if_t< sizeof(T)<=2 *sizeof(void *)> > :std::true_type {};template< typename T > struct AdjustedParamTBase { static_assert(!std::is_reference< T >::value, "references should be handled by template specialization");using type=typename std::conditional< llvm::is_trivially_copy_constructible< T >::value &&llvm::is_trivially_move_constructible< T >::value &&IsSizeLessThanThresholdT< T >::value, T, T & >::type;};template< typename T > struct AdjustedParamTBase< T & > { using type=T &;};template< typename T > struct AdjustedParamTBase< T && > { using type=T &;};template< typename T > using AdjustedParamT=typename AdjustedParamTBase< T >::type;using CallPtrT=ReturnT(*)(void *CallableAddr, AdjustedParamT< ParamTs >... Params);using MovePtrT=void(*)(void *LHSCallableAddr, void *RHSCallableAddr);using DestroyPtrT=void(*)(void *CallableAddr);struct alignas(8) TrivialCallback { CallPtrT CallPtr;};struct alignas(8) NonTrivialCallbacks { CallPtrT CallPtr;MovePtrT MovePtr;DestroyPtrT DestroyPtr;};using CallbackPointerUnionT=PointerUnion< TrivialCallback *, NonTrivialCallbacks * >;union StorageUnionT { struct OutOfLineStorageT { void *StoragePtr;size_t Size;size_t Alignment;} OutOfLineStorage;static_assert(sizeof(OutOfLineStorageT)<=InlineStorageSize, "Should always use all of the out-of-line storage for inline storage!");mutable typename std::aligned_storage< InlineStorageSize, alignof(void *)>::type InlineStorage;} StorageUnion;PointerIntPair< CallbackPointerUnionT, 1, bool > CallbackAndInlineFlag;bool isInlineStorage() const { return CallbackAndInlineFlag.getInt();} bool isTrivialCallback() const { return CallbackAndInlineFlag.getPointer().template is< TrivialCallback * >();} CallPtrT getTrivialCallback() const { return CallbackAndInlineFlag.getPointer().template get< TrivialCallback * >() -> CallPtr
 

Static Protected Attributes

static constexpr size_t InlineStorageSize = sizeof(void *) * 3
 

Detailed Description

template<typename ReturnT, typename... ParamTs>
class llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >

Definition at line 79 of file FunctionExtras.h.

Constructor & Destructor Documentation

◆ UniqueFunctionBase() [1/3]

template<typename ReturnT , typename... ParamTs>
template<typename CallableT , typename CalledAsT >
llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::UniqueFunctionBase ( CallableT  Callable,
CalledAs< CalledAsT >   
)
inlineprotected

Definition at line 263 of file FunctionExtras.h.

◆ ~UniqueFunctionBase()

template<typename ReturnT , typename... ParamTs>
llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::~UniqueFunctionBase ( )
inlineprotected

◆ UniqueFunctionBase() [2/3]

template<typename ReturnT , typename... ParamTs>
llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::UniqueFunctionBase ( UniqueFunctionBase< ReturnT, ParamTs > &&  RHS)
inlineprotectednoexcept

Definition at line 299 of file FunctionExtras.h.

◆ UniqueFunctionBase() [3/3]

template<typename ReturnT , typename... ParamTs>
llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::UniqueFunctionBase ( )
protecteddefault

Member Function Documentation

◆ CallImpl()

template<typename ReturnT , typename... ParamTs>
template<typename CalledAsT >
static ReturnT llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::CallImpl ( void *  CallableAddr,
AdjustedParamT< ParamTs >...  Params 
)
inlinestaticprotected

Definition at line 219 of file FunctionExtras.h.

◆ DestroyImpl()

template<typename ReturnT , typename... ParamTs>
template<typename CallableT >
static void llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::DestroyImpl ( void *  CallableAddr)
inlinestaticprotectednoexcept

Definition at line 232 of file FunctionExtras.h.

◆ getCalleePtr()

template<typename ReturnT , typename... ParamTs>
void* llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::getCalleePtr ( ) const
inlineprotected

Definition at line 199 of file FunctionExtras.h.

◆ getCallPtr()

template<typename ReturnT , typename... ParamTs>
CallPtrT llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::getCallPtr ( ) const
inlineprotected

Definition at line 188 of file FunctionExtras.h.

◆ getInlineStorage()

template<typename ReturnT , typename... ParamTs>
void* llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::getInlineStorage ( ) const
inlineprotected

◆ getNonTrivialCallbacks()

template<typename ReturnT , typename... ParamTs>
NonTrivialCallbacks* llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::getNonTrivialCallbacks ( ) const
inlineprotected

◆ getOutOfLineStorage()

template<typename ReturnT , typename... ParamTs>
void* llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::getOutOfLineStorage ( ) const
inlineprotected

◆ getOutOfLineStorageAlignment()

template<typename ReturnT , typename... ParamTs>
size_t llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::getOutOfLineStorageAlignment ( ) const
inlineprotected

◆ getOutOfLineStorageSize()

template<typename ReturnT , typename... ParamTs>
size_t llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::getOutOfLineStorageSize ( ) const
inlineprotected

◆ MoveImpl()

template<typename ReturnT , typename... ParamTs>
template<typename CallableT >
static void llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::MoveImpl ( void *  LHSCallableAddr,
void *  RHSCallableAddr 
)
inlinestaticprotectednoexcept

Definition at line 226 of file FunctionExtras.h.

◆ operator bool()

template<typename ReturnT , typename... ParamTs>
llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::operator bool ( ) const
inlineexplicit

Definition at line 343 of file FunctionExtras.h.

◆ operator=()

template<typename ReturnT , typename... ParamTs>
UniqueFunctionBase& llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::operator= ( UniqueFunctionBase< ReturnT, ParamTs > &&  RHS)
inlineprotectednoexcept

Definition at line 328 of file FunctionExtras.h.

◆ setOutOfLineStorage()

template<typename ReturnT , typename... ParamTs>
void llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::setOutOfLineStorage ( void *  Ptr,
size_t  Size,
size_t  Alignment 
)
inlineprotected

Member Data Documentation

◆ CallPtr

template<typename ReturnT , typename... ParamTs>
template<typename T >
struct IsSizeLessThanThresholdT< T, std::enable_if_t< sizeof(T)<=2 *sizeof(void *)> > :std::true_type {}; template< typename T > struct AdjustedParamTBase { static_assert(!std::is_reference< T >::value, "references should be handled by template specialization"); using type=typename std::conditional< llvm::is_trivially_copy_constructible< T >::value && llvm::is_trivially_move_constructible< T >::value && IsSizeLessThanThresholdT< T >::value, T, T & >::type; }; template< typename T > struct AdjustedParamTBase< T & > { using type=T &;}; template< typename T > struct AdjustedParamTBase< T && > { using type=T &;}; template< typename T > using AdjustedParamT=typename AdjustedParamTBase< T >::type; using CallPtrT=ReturnT(*)(void *CallableAddr, AdjustedParamT< ParamTs >... Params); using MovePtrT=void(*)(void *LHSCallableAddr, void *RHSCallableAddr); using DestroyPtrT=void(*)(void *CallableAddr); struct alignas(8) TrivialCallback { CallPtrT CallPtr; }; struct alignas(8) NonTrivialCallbacks { CallPtrT CallPtr; MovePtrT MovePtr; DestroyPtrT DestroyPtr; }; using CallbackPointerUnionT= PointerUnion< TrivialCallback *, NonTrivialCallbacks * >; union StorageUnionT { struct OutOfLineStorageT { void *StoragePtr; size_t Size; size_t Alignment; } OutOfLineStorage; static_assert( sizeof(OutOfLineStorageT)<=InlineStorageSize, "Should always use all of the out-of-line storage for inline storage!"); mutable typename std::aligned_storage< InlineStorageSize, alignof(void *)>::type InlineStorage; } StorageUnion; PointerIntPair< CallbackPointerUnionT, 1, bool > CallbackAndInlineFlag; bool isInlineStorage() const { return CallbackAndInlineFlag.getInt();} bool isTrivialCallback() const { return CallbackAndInlineFlag.getPointer().template is< TrivialCallback * >(); } CallPtrT getTrivialCallback() const { return CallbackAndInlineFlag.getPointer().template get< TrivialCallback * >() -> llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::CallPtr
protected

Definition at line 87 of file FunctionExtras.h.

◆ InlineStorageSize

template<typename ReturnT , typename... ParamTs>
constexpr size_t llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::InlineStorageSize = sizeof(void *) * 3
staticconstexprprotected

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