Proteus
Programmable JIT compilation and optimization for C/C++ using LLVM
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
proteus::FuncBase Class Reference

#include <Func.hpp>

Inheritance diagram for proteus::FuncBase:
Inheritance graph
[legend]
Collaboration diagram for proteus::FuncBase:
Collaboration graph
[legend]

Classes

struct  Scope
 

Public Member Functions

 FuncBase (JitModule &J, FunctionCallee FC)
 
TargetModelType getTargetModel () const
 
FunctiongetFunction ()
 
AllocaInstemitAlloca (Type *Ty, StringRef Name, AddressSpace AS=AddressSpace::DEFAULT)
 
Value * emitArrayCreate (Type *Ty, AddressSpace AT, StringRef Name)
 
IRBuilderBasegetIRBuilder ()
 
template<typename T >
Var< TdeclVar (StringRef Name="var")
 
template<typename T >
Var< TdeclVar (size_t NElem, AddressSpace AS=AddressSpace::DEFAULT, StringRef Name="array_var")
 
template<typename T >
Var< TdefVar (const T &Val, StringRef Name="var")
 
template<typename T , typename U >
Var< TdefVar (const Var< U > &Var, StringRef Name="var")
 
template<typename T >
Var< TdefRuntimeConst (const T &Val, StringRef Name="run.const.var")
 
template<typename... ArgT>
auto defRuntimeConsts (ArgT &&...Args)
 
void beginFunction (const char *File=__builtin_FILE(), int Line=__builtin_LINE())
 
void endFunction ()
 
void beginIf (const Var< bool > &CondVar, const char *File=__builtin_FILE(), int Line=__builtin_LINE())
 
void endIf ()
 
template<typename T >
void beginFor (Var< T > &IterVar, const Var< T > &InitVar, const Var< T > &UpperBound, const Var< T > &IncVar, const char *File=__builtin_FILE(), int Line=__builtin_LINE())
 
void endFor ()
 
template<typename CondLambda >
void beginWhile (CondLambda &&Cond, const char *File=__builtin_FILE(), int Line=__builtin_LINE())
 
void endWhile ()
 
template<typename Sig >
std::enable_if_t<!std::is_void_v< typename FnSig< Sig >::RetT >, Var< typename FnSig< Sig >::RetT > > call (StringRef Name)
 
template<typename Sig >
std::enable_if_t< std::is_void_v< typename FnSig< Sig >::RetT >, voidcall (StringRef Name)
 
template<typename Sig , typename... ArgVars>
std::enable_if_t<!std::is_void_v< typename FnSig< Sig >::RetT >, Var< typename FnSig< Sig >::RetT > > call (StringRef Name, ArgVars &&...ArgsVars)
 
template<typename Sig , typename... ArgVars>
std::enable_if_t< std::is_void_v< typename FnSig< Sig >::RetT >, voidcall (StringRef Name, ArgVars &&...ArgsVars)
 
template<typename BuiltinFuncT >
decltype(autocallBuiltin (BuiltinFuncT &&BuiltinFunc)
 
template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, Var< T > > atomicAdd (const Var< T * > &Addr, const Var< T > &Val)
 
template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, Var< T > > atomicSub (const Var< T * > &Addr, const Var< T > &Val)
 
template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, Var< T > > atomicMax (const Var< T * > &Addr, const Var< T > &Val)
 
template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, Var< T > > atomicMin (const Var< T * > &Addr, const Var< T > &Val)
 
template<typename T , typename BodyLambda = EmptyLambda>
auto forLoop (std::initializer_list< Var< T > > Bounds, BodyLambda &&Body={})
 
template<typename... LoopBuilders>
auto buildLoopNest (LoopBuilders &&...Loops)
 
template<typename T >
void ret (const Var< T > &RetVal)
 
void ret ()
 
StringRef getName () const
 
void setName (StringRef NewName)
 
template<typename U , typename T >
std::enable_if_t< std::is_convertible_v< T, U >, Var< U > > convert (const Var< T > &V)
 

Protected Types

enum class  ScopeKind { FUNCTION , IF , FOR , WHILE }
 

Protected Member Functions

std::string toString (ScopeKind Kind)
 
template<typename T >
Var< TemitAtomic (AtomicRMWInst::BinOp Op, const Var< T * > &Addr, const Var< T > &Val)
 

Protected Attributes

JitModuleJ
 
FunctionCallee FC
 
IRBuilder IRB
 
IRBuilderBase::InsertPoint IP
 
std::string Name
 
std::vector< ScopeScopes
 

Member Enumeration Documentation

◆ ScopeKind

Enumerator
FUNCTION 
IF 
FOR 
WHILE 

Constructor & Destructor Documentation

◆ FuncBase()

proteus::FuncBase::FuncBase ( JitModule J,
FunctionCallee  FC 
)

Member Function Documentation

◆ atomicAdd()

template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, Var< T > > proteus::FuncBase::atomicAdd ( const Var< T * > &  Addr,
const Var< T > &  Val 
)

◆ atomicMax()

template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, Var< T > > proteus::FuncBase::atomicMax ( const Var< T * > &  Addr,
const Var< T > &  Val 
)

◆ atomicMin()

template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, Var< T > > proteus::FuncBase::atomicMin ( const Var< T * > &  Addr,
const Var< T > &  Val 
)

◆ atomicSub()

template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, Var< T > > proteus::FuncBase::atomicSub ( const Var< T * > &  Addr,
const Var< T > &  Val 
)

◆ beginFor()

template<typename T >
void proteus::FuncBase::beginFor ( Var< T > &  IterVar,
const Var< T > &  InitVar,
const Var< T > &  UpperBound,
const Var< T > &  IncVar,
const char File = __builtin_FILE(),
int  Line = __builtin_LINE() 
)

◆ beginFunction()

void proteus::FuncBase::beginFunction ( const char File = __builtin_FILE(),
int  Line = __builtin_LINE() 
)

◆ beginIf()

void proteus::FuncBase::beginIf ( const Var< bool > &  CondVar,
const char File = __builtin_FILE(),
int  Line = __builtin_LINE() 
)

◆ beginWhile()

template<typename CondLambda >
void proteus::FuncBase::beginWhile ( CondLambda &&  Cond,
const char File = __builtin_FILE(),
int  Line = __builtin_LINE() 
)

◆ buildLoopNest()

template<typename... LoopBuilders>
auto proteus::FuncBase::buildLoopNest ( LoopBuilders &&...  Loops)
inline

◆ call() [1/4]

template<typename Sig >
std::enable_if_t<!std::is_void_v< typename FnSig< Sig >::RetT >, Var< typename FnSig< Sig >::RetT > > proteus::FuncBase::call ( StringRef  Name)

◆ call() [2/4]

template<typename Sig >
std::enable_if_t< std::is_void_v< typename FnSig< Sig >::RetT >, void > proteus::FuncBase::call ( StringRef  Name)

◆ call() [3/4]

template<typename Sig , typename... ArgVars>
std::enable_if_t<!std::is_void_v< typename FnSig< Sig >::RetT >, Var< typename FnSig< Sig >::RetT > > proteus::FuncBase::call ( StringRef  Name,
ArgVars &&...  ArgsVars 
)

◆ call() [4/4]

template<typename Sig , typename... ArgVars>
std::enable_if_t< std::is_void_v< typename FnSig< Sig >::RetT >, void > proteus::FuncBase::call ( StringRef  Name,
ArgVars &&...  ArgsVars 
)

◆ callBuiltin()

template<typename BuiltinFuncT >
decltype(auto) proteus::FuncBase::callBuiltin ( BuiltinFuncT &&  BuiltinFunc)
inline

◆ convert()

template<typename U , typename T >
std::enable_if_t< std::is_convertible_v< T, U >, Var< U > > proteus::FuncBase::convert ( const Var< T > &  V)
inline

◆ declVar() [1/2]

template<typename T >
Var< T > proteus::FuncBase::declVar ( size_t  NElem,
AddressSpace  AS = AddressSpace::DEFAULT,
StringRef  Name = "array_var" 
)
inline

◆ declVar() [2/2]

template<typename T >
Var< T > proteus::FuncBase::declVar ( StringRef  Name = "var")
inline

◆ defRuntimeConst()

template<typename T >
Var< T > proteus::FuncBase::defRuntimeConst ( const T Val,
StringRef  Name = "run.const.var" 
)
inline

◆ defRuntimeConsts()

template<typename... ArgT>
auto proteus::FuncBase::defRuntimeConsts ( ArgT &&...  Args)
inline

◆ defVar() [1/2]

template<typename T >
Var< T > proteus::FuncBase::defVar ( const T Val,
StringRef  Name = "var" 
)
inline

◆ defVar() [2/2]

template<typename T , typename U >
Var< T > proteus::FuncBase::defVar ( const Var< U > &  Var,
StringRef  Name = "var" 
)
inline

◆ emitAlloca()

AllocaInst * proteus::FuncBase::emitAlloca ( Type *  Ty,
StringRef  Name,
AddressSpace  AS = AddressSpace::DEFAULT 
)

◆ emitArrayCreate()

Value * proteus::FuncBase::emitArrayCreate ( Type *  Ty,
AddressSpace  AT,
StringRef  Name 
)

◆ emitAtomic()

template<typename T >
Var< T > proteus::FuncBase::emitAtomic ( AtomicRMWInst::BinOp  Op,
const Var< T * > &  Addr,
const Var< T > &  Val 
)
protected

◆ endFor()

void proteus::FuncBase::endFor ( )

◆ endFunction()

void proteus::FuncBase::endFunction ( )

◆ endIf()

void proteus::FuncBase::endIf ( )

◆ endWhile()

void proteus::FuncBase::endWhile ( )

◆ forLoop()

template<typename T , typename BodyLambda = EmptyLambda>
auto proteus::FuncBase::forLoop ( std::initializer_list< Var< T > >  Bounds,
BodyLambda &&  Body = {} 
)
inline

◆ getFunction()

Function * proteus::FuncBase::getFunction ( )

◆ getIRBuilder()

IRBuilderBase & proteus::FuncBase::getIRBuilder ( )

◆ getName()

StringRef proteus::FuncBase::getName ( ) const
inline

◆ getTargetModel()

TargetModelType proteus::FuncBase::getTargetModel ( ) const

◆ ret() [1/2]

void proteus::FuncBase::ret ( )
inline

◆ ret() [2/2]

template<typename T >
void proteus::FuncBase::ret ( const Var< T > &  RetVal)

◆ setName()

void proteus::FuncBase::setName ( StringRef  NewName)
inline

◆ toString()

std::string proteus::FuncBase::toString ( ScopeKind  Kind)
inlineprotected

Member Data Documentation

◆ FC

FunctionCallee proteus::FuncBase::FC
protected

◆ IP

IRBuilderBase::InsertPoint proteus::FuncBase::IP
protected

◆ IRB

IRBuilder proteus::FuncBase::IRB
protected

◆ J

JitModule& proteus::FuncBase::J
protected

◆ Name

std::string proteus::FuncBase::Name
protected

◆ Scopes

std::vector<Scope> proteus::FuncBase::Scopes
protected

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