|
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::Value * | call (const std::vector< llvm::Value * > &args, llvm::IRBuilder<> &B) const override |
| Override for call, which is only necessary if mEmbedIR is true, as the IR generation for embedded functions is delayed until the function is called. If mEmbedIR is false, this simply calls Function::call. More...
|
|
Value | call (const Arguments &args, llvm::IRBuilder<> &) const override |
|
llvm::Value * | call (const std::vector< llvm::Value * > &args, llvm::IRBuilder<> &B, const bool cast) const override |
| Uses the IRBuilder to create a call to this function with the given arguments, creating the function and inserting it into the IRBuilder's Module if necessary (through Function::create). Returns the result of the function call which can be a nullptr if the function is a non-sret void call. More...
|
|
virtual ArgInfo | types (ArgInfoVector &, llvm::LLVMContext &) const |
| Populate a vector of ArgInfos which describe this function signature. This method is used by Function::create, Function::print and Function::match. More...
|
|
virtual llvm::Type * | types (std::vector< llvm::Type * > &, llvm::LLVMContext &) const =0 |
|
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...
|
|
llvm::Function * | get (const llvm::Module &M) const |
| Convenience method for calling M.getFunction(symbol). Returns a nullptr if the function has not yet been created or if it is embedded IR. More...
|
|
Value | call (const NativeArguments &args, llvm::IRBuilder<> &B) const |
|
virtual SignatureMatch | match (const ArgInfoVector &inputs, llvm::LLVMContext &C) const |
| The base implementation for determining how a vector of llvm arguments translates to this functions signature. Returns an enum which represents the available mapping. More...
|
|
virtual SignatureMatch | match (const std::vector< llvm::Type * > &inputs, llvm::LLVMContext &C) const |
|
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...
|
|
virtual void | print (llvm::LLVMContext &C, std::ostream &os, const char *name=nullptr, const bool axTypes=true) const |
| Print this function's signature to the provided ostream. More...
|
|
const SmallArgumentVector< const char * > & | dependencies () const |
|
bool | hasParamAttribute (const size_t i, const llvm::Attribute::AttrKind &kind) const |
| Deprecated builder methods, no longer public. More...
|
|
void | setArgumentNames (std::vector< const char * > names) |
|
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) |
|
The base/abstract definition for an IR function.
llvm::Value* call |
( |
const std::vector< llvm::Value * > & |
args, |
|
|
llvm::IRBuilder<> & |
B, |
|
|
const bool |
cast |
|
) |
| const |
|
overridevirtual |
Uses the IRBuilder to create a call to this function with the given arguments, creating the function and inserting it into the IRBuilder's Module if necessary (through Function::create). Returns the result of the function call which can be a nullptr if the function is a non-sret void call.
- Note
- The IRBuilder must have a valid llvm Module/Function/Block attached
-
If the number of provided arguments do not match the size of the current function, invalid IR will be generated.
-
If the provided argument types do not match the current function and cast is false, invalid IR will be generated. Additionally, invalid IR will be generated if cast is true but no valid cast exists for a given argument.
-
When casting arguments, the readonly flags of the function are not checked (unlike Function::match). Casting an argument will cause a new copy of the argument to be created and passed to the function. These new values do not propagate back any changes to the original argument. Separate functions for all writable argument types must be created.
- Parameters
-
args | The llvm Value arguments to call this function with |
B | The llvm IRBuilder |
cast | Whether to allow implicit casting of arguments |
- Deprecated:
- "Function::call which takes llvm::Value's and " "supports casting is incompatible with LLVM 16+ and will be removed."
Reimplemented from Function.
Reimplemented in SRetFunction< SignatureT, IRFunction< SignatureT > >.
The base implementation for determining how a vector of llvm arguments translates to this functions signature. Returns an enum which represents the available mapping.
This method calls types() to figure out the function signature, then compares each argument type to the type in the input vector. If the types match exactly, an Explicit match is found. If the sizes of the inputs and signature differ, no match is found and None is returned. If however, the sizes match and there exists a valid implicit cast from the input type to the signature type for every input, an Implicit match is returned. Finally, if the sizes match but there is no implicit cast mapping, Size is returned. i8 -> i32 : Implicit i32 -> i32 : Explicit str -> i32 : Size (i32,i32) -> i32 : None Never returns Ambiguous (this state is used by FunctionGroup)
- Note
- Due to the way CFunctionSRet is implemented, the LLVM Context must be provided in case we have a zero arg function signature with a SRET.
- Parameters
-
inputs | The input types |
C | The LLVM Context |
Reimplemented in SRetFunction< SignatureT, CFunction< SignatureT > >, and SRetFunction< SignatureT, IRFunction< SignatureT > >.