A gcc_jit_function represents a function - either one that we’re creating ourselves, or one that we’re referencing.
Create a gcc_jit_function with the given name and parameters.
This enum controls the kind of function created, and has the following values:
- C Macro: GCC_JIT_FUNCTION_EXPORTED ¶
Function is defined by the client code and visible by name outside of the JIT.
This value is required if you want to extract machine code for this function from a gcc_jit_result via gcc_jit_result_get_code().
- C Macro: GCC_JIT_FUNCTION_INTERNAL ¶
Function is defined by the client code, but is invisible outside of the JIT. Analogous to a “static” function.
- C Macro: GCC_JIT_FUNCTION_IMPORTED ¶
Function is not defined by the client code; we’re merely referring to it. Analogous to using an “extern” function from a header file.
- C Macro: GCC_JIT_FUNCTION_ALWAYS_INLINE ¶
Function is only ever inlined into other functions, and is invisible outside of the JIT.
Analogous to prefixing with
inline
and adding__attribute__((always_inline))
Inlining will only occur when the optimization level is above 0; when optimization is off, this is essentially the same as GCC_JIT_FUNCTION_INTERNAL.
The parameter name
must be non-NULL. The call takes a copy of the
underlying string, so it is valid to pass in a pointer to an on-stack
buffer.
Get the gcc_jit_function for the built-in function with the given name. For example:
gcc_jit_function *fn = gcc_jit_context_get_builtin_function (ctxt, "__builtin_memcpy");
|
Upcasting from function to object.
Get the param of the given index (0-based).
Emit the function in graphviz format to the given path.
Create a new local variable within the function, of the given type and name.
The parameter type
must be non-void.
The parameter name
must be non-NULL. The call takes a copy of the
underlying string, so it is valid to pass in a pointer to an on-stack
buffer.
Get the number of parameters of the function.
Get the return type of the function.
The API entrypoints relating to getting info about parameters and return types:
were added in LIBGCCJIT_ABI_16; you can test for their presence using
#ifdef LIBGCCJIT_HAVE_REFLECTION