A group of functions which all have the same name but different signatures. For example: float abs(float) double abs(double) As well as serving as a way of grouping common functions, this class provides an API for selecting the best possible function signature, should a match exist, against a provided set of argument types.
More...
#include <openvdb_ax/codegen/FunctionTypes.h>
|
| | FunctionGroup (const char *name, const char *doc, const FunctionList &list) |
| | ~FunctionGroup ()=default |
| bool | HasUniqueFunctionSymbols () const |
| | Verify the function symbol names in this group (must be unique).
|
| bool | HasUniqueTypeSignatures (llvm::LLVMContext &C) const |
| | Verify the function signatures in this group (must be unique).
|
| std::pair< const Function *, Function::SignatureMatch > | match (const ArgInfoVector &args, llvm::LLVMContext &C) const |
| | Given a vector of args, 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.
|
| Value | execute (const Arguments &args, llvm::IRBuilder<> &B) const |
| | Given a set of Arguments, find an EXPLICIT signature match, generate and execute the function body. If no explicit match exists, Value::Invalid() is returned.
|
| Value | execute (const NativeArguments &args, llvm::IRBuilder<> &B) const |
| | Given a set of NativeArguments, find the best possible function signature, generate and execute the function body. Returns the return value of the function or Value::Invalid() if no Explicit or Implicit match is found.
|
| const FunctionList & | list () const |
| | Accessor to the underlying function signature list.
|
| const char * | name () const |
| const char * | doc () const |
A group of functions which all have the same name but different signatures. For example: float abs(float) double abs(double) As well as serving as a way of grouping common functions, this class provides an API for selecting the best possible function signature, should a match exist, against a provided set of argument types.
◆ FunctionList
◆ Ptr
◆ UniquePtr
◆ FunctionGroup()
◆ ~FunctionGroup()
◆ doc()
| const char * doc |
( |
| ) |
const |
|
inline |
◆ execute() [1/2]
Given a set of Arguments, find an EXPLICIT signature match, generate and execute the function body. If no explicit match exists, Value::Invalid() is returned.
- Note
- To ensure something is matched/executed, consider calling match() and Function::call instead. This method should only be used by internal methods that can assert an explicit match exists.
- Parameters
-
| args | Function arguments |
| B | The current llvm IRBuilder |
◆ execute() [2/2]
Given a set of NativeArguments, find the best possible function signature, generate and execute the function body. Returns the return value of the function or Value::Invalid() if no Explicit or Implicit match is found.
- Note
- This function will throw if no valid return is provided by the matched declaration implementation.
- Parameters
-
| args | Natively supported function arguments |
| B | The current llvm IRBuilder |
◆ HasUniqueFunctionSymbols()
| bool HasUniqueFunctionSymbols |
( |
| ) |
const |
Verify the function symbol names in this group (must be unique).
◆ HasUniqueTypeSignatures()
| bool HasUniqueTypeSignatures |
( |
llvm::LLVMContext & | C | ) |
const |
Verify the function signatures in this group (must be unique).
◆ list()
Accessor to the underlying function signature list.
◆ match()
Given a vector of args, 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
- Returns a nullptr if no compatible match was found or if the function list is empty. A compatible match is defined as an Explicit, Implicit or Ambiguous match (where the latter returns the first matched implicit function where other implicit matches exist).
-
If multiple implicit matches are found, the first match is returned and 'type' is set to Ambiguous (if provided).
- Warning
- All funcions in this group must implement the types(ArgInfo) virtual function, which is optional in LLVM 15 but required from LLVM 16.
- Parameters
-
| args | Args representing the function argument types |
| C | The llvm context |
◆ name()
| const char * name |
( |
| ) |
const |
|
inline |