Proteus
Programmable JIT compilation and optimization for C/C++ using LLVM
Loading...
Searching...
No Matches
Public Member Functions | List of all members
proteus::Func< RetT, ArgT > Class Template Referencefinal

#include <Func.hpp>

Inheritance diagram for proteus::Func< RetT, ArgT >:
Inheritance graph
[legend]
Collaboration diagram for proteus::Func< RetT, ArgT >:
Collaboration graph
[legend]

Public Member Functions

 Func (JitModule &J, LLVMContext &Ctx, const std::string &Name, Dispatcher &Dispatch)
 
RetT operator() (ArgT... Args)
 
void declArgs ()
 
auto getArgs ()
 
template<std::size_t Idx>
autogetArg ()
 
auto getCompiledFunc () const
 
void setCompiledFunc (RetT(*CompiledFuncIn)(ArgT...))
 
- Public Member Functions inherited from proteus::FuncBase
JitModulegetJitModule ()
 
LLVMContextgetContext ()
 
std::unique_ptr< ScalarStoragecreateScalarStorage (const std::string &Name, Type *AllocaTy)
 
std::unique_ptr< PointerStoragecreatePointerStorage (const std::string &Name, Type *AllocaTy, Type *ElemTy)
 
std::unique_ptr< ArrayStoragecreateArrayStorage (const std::string &Name, AddressSpace AS, Type *ArrTy)
 
void setInsertPoint (BasicBlock *BB)
 
void setInsertPointBegin (BasicBlock *BB)
 
void setInsertPointAtEntry ()
 
void clearInsertPoint ()
 
BasicBlockgetInsertBlock ()
 
std::tuple< BasicBlock *, BasicBlock * > splitCurrentBlock ()
 
BasicBlockcreateBasicBlock (const std::string &Name="", BasicBlock *InsertBefore=nullptr)
 
void eraseTerminator (BasicBlock *BB)
 
BasicBlockgetUniqueSuccessor (BasicBlock *BB)
 
Value * createAdd (Value *LHS, Value *RHS)
 
Value * createFAdd (Value *LHS, Value *RHS)
 
Value * createSub (Value *LHS, Value *RHS)
 
Value * createFSub (Value *LHS, Value *RHS)
 
Value * createMul (Value *LHS, Value *RHS)
 
Value * createFMul (Value *LHS, Value *RHS)
 
Value * createUDiv (Value *LHS, Value *RHS)
 
Value * createSDiv (Value *LHS, Value *RHS)
 
Value * createFDiv (Value *LHS, Value *RHS)
 
Value * createURem (Value *LHS, Value *RHS)
 
Value * createSRem (Value *LHS, Value *RHS)
 
Value * createFRem (Value *LHS, Value *RHS)
 
Value * createAnd (Value *LHS, Value *RHS)
 
Value * createOr (Value *LHS, Value *RHS)
 
Value * createXor (Value *LHS, Value *RHS)
 
Value * createNot (Value *Val)
 
Value * createICmpEQ (Value *LHS, Value *RHS)
 
Value * createICmpNE (Value *LHS, Value *RHS)
 
Value * createICmpSLT (Value *LHS, Value *RHS)
 
Value * createICmpSGT (Value *LHS, Value *RHS)
 
Value * createICmpSGE (Value *LHS, Value *RHS)
 
Value * createICmpSLE (Value *LHS, Value *RHS)
 
Value * createICmpUGT (Value *LHS, Value *RHS)
 
Value * createICmpUGE (Value *LHS, Value *RHS)
 
Value * createICmpULT (Value *LHS, Value *RHS)
 
Value * createICmpULE (Value *LHS, Value *RHS)
 
Value * createFCmpOEQ (Value *LHS, Value *RHS)
 
Value * createFCmpONE (Value *LHS, Value *RHS)
 
Value * createFCmpOLT (Value *LHS, Value *RHS)
 
Value * createFCmpOLE (Value *LHS, Value *RHS)
 
Value * createFCmpOGT (Value *LHS, Value *RHS)
 
Value * createFCmpOGE (Value *LHS, Value *RHS)
 
Value * createFCmpULT (Value *LHS, Value *RHS)
 
Value * createFCmpULE (Value *LHS, Value *RHS)
 
Value * createAtomicAdd (Value *Addr, Value *Val)
 
Value * createAtomicSub (Value *Addr, Value *Val)
 
Value * createAtomicMax (Value *Addr, Value *Val)
 
Value * createAtomicMin (Value *Addr, Value *Val)
 
Value * createLoad (Type *Ty, Value *Ptr, const std::string &Name="")
 
void createStore (Value *Val, Value *Ptr)
 
Value * createCall (const std::string &FName, Type *RetTy, const std::vector< Type * > &ArgTys, const std::vector< Value * > &Args)
 
Value * createCall (const std::string &FName, Type *RetTy)
 
Value * createInBoundsGEP (Type *Ty, Value *Ptr, const std::vector< Value * > IdxList, const std::string &Name="")
 
Value * createConstInBoundsGEP1_64 (Type *Ty, Value *Ptr, size_t Idx)
 
Value * createConstInBoundsGEP2_64 (Type *Ty, Value *Ptr, size_t Idx0, size_t Idx1)
 
unsigned getAddressSpace (Type *Ty)
 
Type * getPointerType (Type *ElemTy, unsigned AS)
 
Type * getPointerTypeUnqual (Type *ElemTy)
 
Type * getInt32Ty ()
 
Type * getInt16Ty ()
 
Type * getInt64Ty ()
 
Type * getFloatTy ()
 
bool isIntegerTy (Type *Ty)
 
bool isFloatingPointTy (Type *Ty)
 
template<typename From , typename To >
Value * convert (Value *V)
 
llvm::Value * createIntCast (llvm::Value *V, llvm::Type *DestTy, bool IsSigned)
 
llvm::Value * createFPCast (llvm::Value *V, llvm::Type *DestTy)
 
llvm::Value * createSIToFP (llvm::Value *V, llvm::Type *DestTy)
 
llvm::Value * createUIToFP (llvm::Value *V, llvm::Type *DestTy)
 
llvm::Value * createFPToSI (llvm::Value *V, llvm::Type *DestTy)
 
llvm::Value * createFPToUI (llvm::Value *V, llvm::Type *DestTy)
 
llvm::Value * createBitCast (llvm::Value *V, llvm::Type *DestTy)
 
llvm::Value * getConstantInt (llvm::Type *Ty, uint64_t Val)
 
llvm::Value * getConstantFP (llvm::Type *Ty, double Val)
 
Value * createZExt (Value *V, Type *DestTy)
 
 FuncBase (JitModule &J, const std::string &Name, Type *RetTy, const std::vector< Type * > &ArgTys)
 
 ~FuncBase ()
 
TargetModelType getTargetModel () const
 
FunctiongetFunction ()
 
Value * getArg (size_t Idx)
 
AllocaInstemitAlloca (Type *Ty, const std::string &Name, AddressSpace AS=AddressSpace::DEFAULT)
 
Value * emitArrayCreate (Type *Ty, AddressSpace AT, const std::string &Name)
 
template<typename T >
Var< TdeclVar (const std::string &Name="var")
 
template<typename T >
Var< TdeclVar (size_t NElem, AddressSpace AS=AddressSpace::DEFAULT, const std::string &Name="array_var")
 
template<typename T >
Var< TdefVar (const T &Val, const std::string &Name="var")
 
template<typename T , typename U >
Var< TdefVar (const Var< U > &Val, const std::string &Name="var")
 
template<typename T >
Var< const TdefRuntimeConst (const T &Val, const std::string &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 IterT , typename InitT , typename UpperT , typename IncT >
void beginFor (Var< IterT > &IterVar, const Var< InitT > &InitVar, const Var< UpperT > &UpperBound, const Var< IncT > &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 (const std::string &Name)
 
template<typename Sig >
std::enable_if_t< std::is_void_v< typename FnSig< Sig >::RetT >, voidcall (const std::string &Name)
 
template<typename Sig , typename... ArgVars>
std::enable_if_t<!std::is_void_v< typename FnSig< Sig >::RetT >, Var< typename FnSig< Sig >::RetT > > call (const std::string &Name, ArgVars &&...ArgsVars)
 
template<typename Sig , typename... ArgVars>
std::enable_if_t< std::is_void_v< typename FnSig< Sig >::RetT >, voidcall (const std::string &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 IterT , typename InitT , typename UpperT , typename IncT , typename BodyLambda = EmptyLambda>
auto forLoop (Var< IterT > &Iter, const Var< InitT > &Init, const Var< UpperT > &Upper, const Var< IncT > &Inc, BodyLambda &&Body={})
 
template<typename... LoopBuilders>
auto buildLoopNest (LoopBuilders &&...Loops)
 
template<typename T >
void ret (const Var< T > &RetVal)
 
void ret ()
 
const std::string & getName () const
 
void setName (const std::string &NewName)
 
template<typename U , typename T >
std::enable_if_t< std::is_convertible_v< T, U >, Var< U > > convert (const Var< T > &V)
 

Additional Inherited Members

- Protected Types inherited from proteus::FuncBase
enum class  ScopeKind { FUNCTION , IF , FOR , WHILE }
 
- Protected Member Functions inherited from proteus::FuncBase
std::string toString (ScopeKind Kind)
 
void createBr (llvm::BasicBlock *Dest)
 
void createCondBr (llvm::Value *Cond, llvm::BasicBlock *True, llvm::BasicBlock *False)
 
void createRetVoid ()
 
void createRet (llvm::Value *V)
 
void pushScope (const char *File, const int Line, ScopeKind Kind, BasicBlock *NextBlock)
 
- Protected Attributes inherited from proteus::FuncBase
JitModuleJ
 
std::string Name
 
std::unique_ptr< ImplPImpl
 

Constructor & Destructor Documentation

◆ Func()

template<typename RetT , typename... ArgT>
proteus::Func< RetT, ArgT >::Func ( JitModule J,
LLVMContext Ctx,
const std::string &  Name,
Dispatcher Dispatch 
)
inline

Member Function Documentation

◆ declArgs()

template<typename RetT , typename... ArgT>
void proteus::Func< RetT, ArgT >::declArgs ( )
inline

◆ getArg()

template<typename RetT , typename... ArgT>
template<std::size_t Idx>
auto & proteus::Func< RetT, ArgT >::getArg ( )
inline

◆ getArgs()

template<typename RetT , typename... ArgT>
auto proteus::Func< RetT, ArgT >::getArgs ( )
inline

◆ getCompiledFunc()

template<typename RetT , typename... ArgT>
auto proteus::Func< RetT, ArgT >::getCompiledFunc ( ) const
inline

◆ operator()()

template<typename RetT , typename... ArgT>
RetT proteus::Func< RetT, ArgT >::operator() ( ArgT...  Args)

◆ setCompiledFunc()

template<typename RetT , typename... ArgT>
void proteus::Func< RetT, ArgT >::setCompiledFunc ( RetT(*)(ArgT...)  CompiledFuncIn)
inline

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