Represents a concrete IR function with the first argument as its return type.
More...
#include <FunctionTypes.h>
Inherits SRetFunction< SignatureT, IRFunction< SignatureT > >.
|
| IRFunctionSRet (const std::string &symbol, const IRFunctionBase::GeneratorCb &gen) |
|
| ~IRFunctionSRet () override=default |
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
llvm::Type * | types (std::vector< llvm::Type * > &types, llvm::LLVMContext &C) const override |
| Populate a vector of llvm::Types which describe this function signature. This method is used by Function::create, Function::print and Function::match. More...
|
|
void | setEmbedIR (bool on) |
| Enable or disable the embedding of IR. Embedded IR is currently required for function which use parent function parameters. More...
|
|
bool | hasEmbedIR () const |
|
llvm::Function * | create (llvm::LLVMContext &C, llvm::Module *M) const override |
| Override for the creation of an IR function. This ensures that the body and prototype of the function are generated if a Module is provided. More...
|
|
llvm::Function * | create (llvm::Module &M) const |
| Convenience method which always uses the provided module to find the function or insert it if necessary. More...
|
|
size_t | size () const |
| The number of arguments that this function has. More...
|
|
const char * | symbol () const |
| The function symbol name. More...
|
|
const char * | argName (const size_t idx) const |
| Returns the descriptive name of the given argument index. More...
|
|
bool | hasParamAttribute (const size_t i, const llvm::Attribute::AttrKind &kind) const |
| Builder methods. More...
|
|
void | setArgumentNames (std::vector< const char * > names) |
|
const std::vector< const char * > & | dependencies () const |
|
void | setDependencies (std::vector< const char * > deps) |
|
void | setFnAttributes (const std::vector< llvm::Attribute::AttrKind > &in) |
|
void | setRetAttributes (const std::vector< llvm::Attribute::AttrKind > &in) |
|
void | setParamAttributes (const size_t i, const std::vector< llvm::Attribute::AttrKind > &in) |
|
|
void | verifyResultType (const llvm::Type *result, const llvm::Type *expected) const |
|
|
static void | cast (std::vector< llvm::Value * > &args, const std::vector< llvm::Type * > &types, llvm::IRBuilder<> &B) |
| Cast the provided arguments to the given type as supported by implicit casting of function types. If the types already match OR if a cast cannot be performed, nothing is done to the argument. More...
|
|
template<typename SignatureT>
struct openvdb::v8_0::ax::codegen::IRFunctionSRet< SignatureT >
Represents a concrete IR function with the first argument as its return type.
◆ BaseT
◆ GeneratorCb
using GeneratorCb = std::function<llvm::Value* (const std::vector<llvm::Value*>&, llvm::IRBuilder<>&)> |
|
inherited |
The IR callback function which will write the LLVM IR for this function's body.
The first argument is the vector of functional arguments. i.e. a representation of the value that the callback has been invoked with. The last argument is the IR builder which should be used to generate the function body IR.
- Note
- You can return a nullptr from this method which will represent a ret void, a ret void instruction, or an actual value
◆ Ptr
◆ Traits
◆ SignatureMatch
The result type from calls to Function::match.
Enumerator |
---|
None | |
Size | |
Implicit | |
Explicit | |
◆ IRFunctionSRet()
◆ ~IRFunctionSRet()
◆ argName()
const char* argName |
( |
const size_t |
idx | ) |
const |
|
inlineinherited |
Returns the descriptive name of the given argument index.
If the index is greater than the number of arguments, an empty string is returned.
- Parameters
-
idx | The index of the argument |
◆ call()
llvm::Value* call |
( |
const std::vector< llvm::Value * > & |
args, |
|
|
llvm::IRBuilder<> & |
B, |
|
|
const bool |
cast |
|
) |
| const |
|
inlineoverridevirtualinherited |
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
Reimplemented from IRFunctionBase.
◆ cast()
static void cast |
( |
std::vector< llvm::Value * > & |
args, |
|
|
const std::vector< llvm::Type * > & |
types, |
|
|
llvm::IRBuilder<> & |
B |
|
) |
| |
|
staticprotectedinherited |
Cast the provided arguments to the given type as supported by implicit casting of function types. If the types already match OR if a cast cannot be performed, nothing is done to the argument.
◆ create() [1/2]
llvm::Function* create |
( |
llvm::LLVMContext & |
C, |
|
|
llvm::Module * |
M |
|
) |
| const |
|
overridevirtualinherited |
Override for the creation of an IR function. This ensures that the body and prototype of the function are generated if a Module is provided.
- Note
- A nullptr is returned if mEmbedIR is true and no action is performed.
-
Throws if this function has been initialized with a nullptr generator callback. In this case, the function prototype will be created, but not the function body.
-
Throws if the return type of the generator callback does not match the function prototype. In this case, both the prototype and the function body will be created and inserted, but the IR will be invalid.
Reimplemented from Function.
◆ create() [2/2]
llvm::Function* create |
( |
llvm::Module & |
M | ) |
const |
|
inlineinherited |
Convenience method which always uses the provided module to find the function or insert it if necessary.
- Parameters
-
◆ dependencies()
const std::vector<const char*>& dependencies |
( |
| ) |
const |
|
inlineinherited |
◆ hasEmbedIR()
bool hasEmbedIR |
( |
| ) |
const |
|
inlineinherited |
◆ hasParamAttribute()
bool hasParamAttribute |
( |
const size_t |
i, |
|
|
const llvm::Attribute::AttrKind & |
kind |
|
) |
| const |
|
inlineinherited |
◆ match()
|
inlineoverridevirtualinherited |
Override of match which inserts the SRET type such that the base class methods ignore it.
Reimplemented from Function.
◆ print()
void print |
( |
llvm::LLVMContext & |
C, |
|
|
std::ostream & |
os, |
|
|
const char * |
name = nullptr , |
|
|
const bool |
axTypes = true |
|
) |
| const |
|
inlineoverridevirtualinherited |
Override of print to avoid printing out the SRET type.
Reimplemented from Function.
◆ setArgumentNames()
void setArgumentNames |
( |
std::vector< const char * > |
names | ) |
|
|
inlineinherited |
◆ setDependencies()
void setDependencies |
( |
std::vector< const char * > |
deps | ) |
|
|
inlineinherited |
◆ setEmbedIR()
void setEmbedIR |
( |
bool |
on | ) |
|
|
inlineinherited |
Enable or disable the embedding of IR. Embedded IR is currently required for function which use parent function parameters.
◆ setFnAttributes()
void setFnAttributes |
( |
const std::vector< llvm::Attribute::AttrKind > & |
in | ) |
|
|
inlineinherited |
◆ setParamAttributes()
void setParamAttributes |
( |
const size_t |
i, |
|
|
const std::vector< llvm::Attribute::AttrKind > & |
in |
|
) |
| |
|
inlineinherited |
◆ setRetAttributes()
void setRetAttributes |
( |
const std::vector< llvm::Attribute::AttrKind > & |
in | ) |
|
|
inlineinherited |
◆ size()
The number of arguments that this function has.
◆ symbol()
const char* symbol |
( |
| ) |
const |
|
inlineinherited |
The function symbol name.
This will be used as its identifier in IR and must be unique.
◆ types()
llvm::Type* types |
( |
std::vector< llvm::Type * > & |
, |
|
|
llvm::LLVMContext & |
|
|
) |
| const |
|
inlineoverridevirtualinherited |
◆ verifyResultType()
void verifyResultType |
( |
const llvm::Type * |
result, |
|
|
const llvm::Type * |
expected |
|
) |
| const |
|
inlineprotectedinherited |
◆ mEmbedIR
◆ mGen
The documentation for this struct was generated from the following file: