OpenVDB  9.0.1
Public Types | Public Member Functions | List of all members
FunctionGroup Struct Reference

todo More...

#include <openvdb_ax/codegen/FunctionTypes.h>

Public Types

using Ptr = std::shared_ptr< FunctionGroup >
 
using UniquePtr = std::unique_ptr< FunctionGroup >
 
using FunctionList = std::vector< Function::Ptr >
 

Public Member Functions

 FunctionGroup (const char *name, const char *doc, const FunctionList &list)
 
 ~FunctionGroup ()=default
 
const Functionmatch (const std::vector< llvm::Type * > &types, llvm::LLVMContext &C, Function::SignatureMatch *type=nullptr) const
 Given a vector of llvm types, automatically returns the best possible function declaration from the stored function list. The 'best' declaration is determined by the provided types compatibility to each functions signature. More...
 
llvm::Value * execute (const std::vector< llvm::Value * > &args, llvm::IRBuilder<> &B) const
 Given a vector of llvm values, find the best possible function signature, generate and execute the function body. Returns the return value of the function (nullptr if void). The behaviour is undefined if a valid match does not exist. For such cases, call the second version of FunctionGroup::execute. More...
 
const Functionexecute (const std::vector< llvm::Value * > &args, llvm::IRBuilder<> &B, llvm::Value *&result) const
 Given a vector of llvm values, find the best possible function signature, generate and execute the function body. Returns the Function that was selected and executed or a nullptr if no valid match was found. Sets the result variable to the return value of the function (nullptr if void). If no match is found, the result variable if left unset. More...
 
const FunctionListlist () const
 Accessor to the underlying function signature list. More...
 
const char * name () const
 
const char * doc () const
 

Detailed Description

todo

Member Typedef Documentation

using FunctionList = std::vector<Function::Ptr>
using Ptr = std::shared_ptr<FunctionGroup>
using UniquePtr = std::unique_ptr<FunctionGroup>

Constructor & Destructor Documentation

FunctionGroup ( const char *  name,
const char *  doc,
const FunctionList list 
)
inline
~FunctionGroup ( )
default

Member Function Documentation

const char* doc ( ) const
inline
llvm::Value* execute ( const std::vector< llvm::Value * > &  args,
llvm::IRBuilder<> &  B 
) const

Given a vector of llvm values, find the best possible function signature, generate and execute the function body. Returns the return value of the function (nullptr if void). The behaviour is undefined if a valid match does not exist. For such cases, call the second version of FunctionGroup::execute.

Note
This function will throw if no valid return is provided by the matched declaration implementation.
Parameters
argsA vector of values representing the function arguments
BThe current llvm IRBuilder
const Function* execute ( const std::vector< llvm::Value * > &  args,
llvm::IRBuilder<> &  B,
llvm::Value *&  result 
) const

Given a vector of llvm values, find the best possible function signature, generate and execute the function body. Returns the Function that was selected and executed or a nullptr if no valid match was found. Sets the result variable to the return value of the function (nullptr if void). If no match is found, the result variable if left unset.

Note
This function will throw if no valid return is provided by the matched declaration implementation.
Parameters
argsA vector of values representing the function arguments
BThe current llvm IRBuilder
resultThe result to set. nullptr on void return.
Returns
The matched function. nullptr if no match was found
const FunctionList& list ( ) const
inline

Accessor to the underlying function signature list.

const Function* match ( const std::vector< llvm::Type * > &  types,
llvm::LLVMContext &  C,
Function::SignatureMatch type = nullptr 
) const

Given a vector of llvm types, automatically returns the best possible function declaration from the stored function list. The 'best' declaration is determined by the provided types compatibility to each functions signature.

Note
If multiple implicit matches are found, the first match is returned.
Returns a nullptr if no compatible match was found or if the function list is empty. A compatible match is defined as an Explicit or Implicit match.
Parameters
typesA vector of types representing the function argument types
CThe llvm context
typeIf provided, type is set to the type of match that occurred
const char* name ( ) const
inline