Module Gccjit.Function

type function_kind =
  1. | Exported
    (*

    Function is defined by the client code and visible by name outside of the JIT.

    *)
  2. | Internal
    (*

    Function is defined by the client code, but is invisible outside of the JIT. Analogous to a "static" function.

    *)
  3. | 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.

    *)
  4. | 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 FUNCTION_Internal.

    *)

Kinds of function.

val create : context -> ?loc:location -> ?variadic:bool -> function_kind -> type_ -> string -> param list -> function_

Create a function with the given name and parameters.

val builtin : context -> string -> function_

Create a reference to a builtin function (sometimes called intrinsic functions).

val param : function_ -> int -> param

Get a specific param of a function by index (0-based).

val dump_dot : function_ -> string -> unit

Emit the function in graphviz format to the given path.

val local : ?loc:location -> function_ -> type_ -> string -> lvalue

Add a new local variable within the function, of the given type and name.

val to_string : function_ -> string

Get a human-readable description of this object.