Documentation

LeanGccJit.Core.Function

Func represents a function in the JIT context. It is either created inside the context or imported.

See documentation of LeanGccJit.Core.Func, or the C API reference.

@[extern lean_gcc_jit_context_new_function]

Create a gcc_jit_function with the given name and parameters. LeanGccJit.Core.FunctionKind specifies the kind of function created.

@[extern lean_gcc_jit_context_get_builtin_function]

Get the Func for the built-in function with the given name. For example:

let bMemcpy ← ctx.getBuiltinFunction "__builtin_memcpy"
@[extern lean_gcc_jit_function_as_object]

Upcasting from Func to Object.

@[extern lean_gcc_jit_function_get_param]

Get the Param of the given index (0-based).

@[extern lean_gcc_jit_function_dump_to_dot]

Emit the Func in graphviz format to the given path.

@[extern lean_gcc_jit_function_get_address]

Get the address of a function as an RValue, of function pointer type.

Note #

You can generate calls that use a function pointer via LeanGccJit.Core.Context.newCallThroughPtr, which requires a LeanGccJit.Core.RValue containing the address of the function. Func.getAddress is one way to obtain such a LeanGccJit.Core.RValue.

@[extern lean_gcc_jit_function_get_return_type]

Get the return type of the Func.

@[extern lean_gcc_jit_function_get_param_count]

Get the number of parameters of the Func.