OpenVDB 11.0.0

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
SRetFunction< SignatureT, DerivedFunction > Struct Template Reference

Templated interface class for SRET functions. This struct provides the interface for functions that wish to return arrays (vectors or matrices) by internally remapping the first argument for the user. As far as LLVM and any bindings are concerned, the function signature remains unchanged - however the first argument becomes "invisible" to the user and is instead allocated by LLVM before the function is executed. Importantly, the argument has no impact on the user facing AX signature and doesn't affect declaration selection. More...

`#include <openvdb_ax/codegen/FunctionTypes.h>`

Inheritance diagram for SRetFunction< SignatureT, DerivedFunction >:

## Public Types
using | Ptr = std::shared_ptr< SRetFunction< SignatureT, DerivedFunction > >
using | Traits = FunctionTraits< SignatureT >

## Public Member Functions
Function::SignatureMatch | match (const std::vector< llvm::Type * > &args, llvm::LLVMContext &C) const override
| Override of match which inserts the SRET type such that the base class methods ignore it.
llvm::Value * | call (const std::vector< llvm::Value * > &args, llvm::IRBuilder<> &B, const bool cast) const override
| Override of call which allocates the required SRET llvm::Value for this function.
void | print (llvm::LLVMContext &C, std::ostream &os, const char *name=nullptr, const bool axTypes=true) const override
| Override of print to avoid printing out the SRET type.

## Protected Member Functions
template<typename ... Args>
| SRetFunction (Args &&... ts)
| Forward all arguments to the derived class.

## Detailed Description

template<typename SignatureT, typename DerivedFunction>
struct openvdb::v11_0::ax::codegen::SRetFunction< SignatureT, DerivedFunction >

Templated interface class for SRET functions. This struct provides the interface for functions that wish to return arrays (vectors or matrices) by internally remapping the first argument for the user. As far as LLVM and any bindings are concerned, the function signature remains unchanged - however the first argument becomes "invisible" to the user and is instead allocated by LLVM before the function is executed. Importantly, the argument has no impact on the user facing AX signature and doesn't affect declaration selection.

Note
  This class is not intended to be instantiated directly, but instead used by derived implementation which hold a valid implementations of member functions required to create a llvm::Function (such as Function::types and Function::call). This exists as an interface to avoid virtual inheritance.

## Member Typedef Documentation

## ◆ Ptr

template<typename SignatureT , typename DerivedFunction >

using Ptr = std::shared_ptr<SRetFunction<SignatureT, DerivedFunction> >

## ◆ Traits

template<typename SignatureT , typename DerivedFunction >

using Traits = FunctionTraits<SignatureT>

## Constructor & Destructor Documentation

## ◆ SRetFunction()

template<typename SignatureT , typename DerivedFunction >
template<typename ... Args>

SRetFunction | ( | Args &&... | ts | ) |
| inline protected

Forward all arguments to the derived class.

## Member Function Documentation

## ◆ call()

template<typename SignatureT , typename DerivedFunction >

llvm::Value * call | ( | const std::vector< llvm::Value * > & | args,
|  | llvm::IRBuilder<> & | B,
|  | const bool | cast
| ) |  | const
| inline override

Override of call which allocates the required SRET llvm::Value for this function.

Note
  Unlike other function where the returned llvm::Value* is a llvm::CallInst (which also represents the return value), SRET functions return the allocated 1st argument i.e. not a llvm::CallInst

## ◆ match()

template<typename SignatureT , typename DerivedFunction >

Function::SignatureMatch match | ( | const std::vector< llvm::Type * > & | args,
|  | llvm::LLVMContext & | C
| ) |  | const
| inline override

Override of match which inserts the SRET type such that the base class methods ignore it.

## ◆ print()

template<typename SignatureT , typename DerivedFunction >

void print | ( | llvm::LLVMContext & | C,
|  | std::ostream & | os,
|  | const char * | name = `nullptr`,
|  | const bool | axTypes = `true`
| ) |  | const
| inline override

Override of print to avoid printing out the SRET type.