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)
 
FunctiongetFunction ()
 
AllocaInstemitAlloca (Type *Ty, StringRef Name, AddressSpace AS=AddressSpace::DEFAULT)
 
Value * emitArrayCreate (Type *Ty, AddressSpace AT, StringRef Name)
 
IRBuilderBasegetIRBuilder ()
 
VardeclVarInternal (StringRef Name, Type *Ty, Type *PointerElemType=nullptr)
 
template<typename T >
VardeclVar (StringRef Name="var")
 
template<typename T >
VardeclVar (size_t NElem, AddressSpace AS=AddressSpace::DEFAULT, StringRef Name="array_var")
 
template<typename T >
VardefVar (T Val, StringRef Name="var")
 
VardefVar (const Var &Val, StringRef Name="var")
 
template<typename T >
VardefRuntimeConst (T Val, StringRef Name="run.const.var")
 
template<typename... ArgT>
auto defRuntimeConsts (ArgT &&...Args)
 
template<typename... Ts>
void declArgs ()
 
VargetArg (unsigned int ArgNo)
 
void beginFunction (const char *File=__builtin_FILE(), int Line=__builtin_LINE())
 
void endFunction ()
 
void beginIf (Var &CondVar, const char *File=__builtin_FILE(), int Line=__builtin_LINE())
 
void endIf ()
 
void beginFor (Var &IterVar, Var &InitVar, Var &UpperBound, Var &IncVar, const char *File=__builtin_FILE(), int Line=__builtin_LINE())
 
void endFor ()
 
template<typename Sig >
std::enable_if_t<!std::is_void_v< typename FnSig< Sig >::RetT >, Var & > 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 & > 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)
 
VaratomicAdd (Var &Addr, Var &Val)
 
VaratomicSub (Var &Addr, Var &Val)
 
VaratomicMax (Var &Addr, Var &Val)
 
VaratomicMin (Var &Addr, Var &Val)
 
template<typename BodyLambda = EmptyLambda>
auto forLoop (const LoopBoundInfo &Bounds, BodyLambda &&Body={})
 
template<typename... LoopBuilders>
auto buildLoopNest (LoopBuilders &&...Loops)
 
void ret (std::optional< std::reference_wrapper< Var > > OptRet=std::nullopt)
 
StringRef getName () const
 
void setName (StringRef NewName)
 
template<typename T >
std::enable_if_t< std::is_arithmetic_v< T >, Var & > convert (Var &V)
 

Protected Types

enum class  ScopeKind { FUNCTION , IF , FOR }
 

Protected Member Functions

std::string toString (ScopeKind Kind)
 
VaremitAtomic (AtomicRMWInst::BinOp Op, Var &Addr, Var &Val)
 

Protected Attributes

JitModuleJ
 
FunctionCallee FC
 
IRBuilder IRB
 
IRBuilderBase::InsertPoint IP
 
std::deque< std::unique_ptr< Var > > Arguments
 
std::deque< std::unique_ptr< Var > > Variables
 
std::deque< std::unique_ptr< Var > > RuntimeConstants
 
std::string Name
 
std::vector< ScopeScopes
 

Member Enumeration Documentation

◆ ScopeKind

Enumerator
FUNCTION 
IF 
FOR 

Constructor & Destructor Documentation

◆ FuncBase()

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

Member Function Documentation

◆ atomicAdd()

Var & proteus::FuncBase::atomicAdd ( Var Addr,
Var Val 
)

◆ atomicMax()

Var & proteus::FuncBase::atomicMax ( Var Addr,
Var Val 
)

◆ atomicMin()

Var & proteus::FuncBase::atomicMin ( Var Addr,
Var Val 
)

◆ atomicSub()

Var & proteus::FuncBase::atomicSub ( Var Addr,
Var Val 
)

◆ beginFor()

void proteus::FuncBase::beginFor ( Var IterVar,
Var InitVar,
Var UpperBound,
Var 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 ( Var CondVar,
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 & > 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 & > 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 T >
std::enable_if_t< std::is_arithmetic_v< T >, Var & > proteus::FuncBase::convert ( Var V)
inline

◆ declArgs()

template<typename... Ts>
void proteus::FuncBase::declArgs ( )
inline

◆ declVar() [1/2]

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

◆ declVar() [2/2]

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

◆ declVarInternal()

Var & proteus::FuncBase::declVarInternal ( StringRef  Name,
Type *  Ty,
Type *  PointerElemType = nullptr 
)

◆ defRuntimeConst()

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

◆ defRuntimeConsts()

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

◆ defVar() [1/2]

Var & proteus::FuncBase::defVar ( const Var Val,
StringRef  Name = "var" 
)
inline

◆ defVar() [2/2]

template<typename T >
Var & proteus::FuncBase::defVar ( T  Val,
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()

Var & proteus::FuncBase::emitAtomic ( AtomicRMWInst::BinOp  Op,
Var Addr,
Var Val 
)
protected

◆ endFor()

void proteus::FuncBase::endFor ( )

◆ endFunction()

void proteus::FuncBase::endFunction ( )

◆ endIf()

void proteus::FuncBase::endIf ( )

◆ forLoop()

template<typename BodyLambda = EmptyLambda>
auto proteus::FuncBase::forLoop ( const LoopBoundInfo Bounds,
BodyLambda &&  Body = {} 
)
inline

◆ getArg()

Var & proteus::FuncBase::getArg ( unsigned int  ArgNo)

◆ getFunction()

Function * proteus::FuncBase::getFunction ( )

◆ getIRBuilder()

IRBuilderBase & proteus::FuncBase::getIRBuilder ( )

◆ getName()

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

◆ ret()

void proteus::FuncBase::ret ( std::optional< std::reference_wrapper< Var > >  OptRet = std::nullopt)

◆ setName()

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

◆ toString()

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

Member Data Documentation

◆ Arguments

std::deque<std::unique_ptr<Var> > proteus::FuncBase::Arguments
protected

◆ 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

◆ RuntimeConstants

std::deque<std::unique_ptr<Var> > proteus::FuncBase::RuntimeConstants
protected

◆ Scopes

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

◆ Variables

std::deque<std::unique_ptr<Var> > proteus::FuncBase::Variables
protected

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