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)
 
Function * getFunction ()
 
AllocaInst * emitAlloca (Type *Ty, StringRef Name)
 
IRBuilderBase & getIRBuilder ()
 
VardeclVarInternal (StringRef Name, Type *Ty, Type *PointerElemType=nullptr)
 
template<typename T >
VardeclVar (StringRef Name="var")
 
template<typename T >
VardefVar (T 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 RetT , typename... ArgT>
std::enable_if_t<!std::is_void_v< RetT >, Var & > call (StringRef Name)
 
template<typename RetT , typename... ArgT>
std::enable_if_t< std::is_void_v< RetT >, void > call (StringRef Name)
 
VarcallBuiltin (function_ref< Var &(FuncBase &)> Lower)
 
void ret (std::optional< std::reference_wrapper< Var > > OptRet=std::nullopt)
 
StringRef getName () const
 
void setName (StringRef NewName)
 

Protected Types

enum class  ScopeKind { FUNCTION , IF , FOR }
 

Protected Member Functions

std::string toString (ScopeKind Kind)
 

Protected Attributes

JitModuleJ
 
FunctionCallee FC
 
IRBuilder IRB
 
IRBuilderBase::InsertPoint IP
 
std::deque< VarArguments
 
std::deque< VarVariables
 
std::deque< VarRuntimeConstants
 
std::string Name
 
std::vector< ScopeScopes
 

Member Enumeration Documentation

◆ ScopeKind

enum class proteus::FuncBase::ScopeKind
strongprotected
Enumerator
FUNCTION 
IF 
FOR 

Constructor & Destructor Documentation

◆ FuncBase()

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

Member Function Documentation

◆ 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() 
)

◆ call() [1/2]

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

◆ call() [2/2]

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

◆ callBuiltin()

Var & proteus::FuncBase::callBuiltin ( function_ref< Var &(FuncBase &)>  Lower)
inline

◆ declArgs()

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

◆ declVar()

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 ( Val,
StringRef  Name = "run.const.var" 
)
inline

◆ defRuntimeConsts()

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

◆ defVar()

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

◆ emitAlloca()

AllocaInst * proteus::FuncBase::emitAlloca ( Type *  Ty,
StringRef  Name 
)

◆ endFor()

void proteus::FuncBase::endFor ( )

◆ endFunction()

void proteus::FuncBase::endFunction ( )

◆ endIf()

void proteus::FuncBase::endIf ( )

◆ 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<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<Var> proteus::FuncBase::RuntimeConstants
protected

◆ Scopes

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

◆ Variables

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

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