package gccjit

  1. Overview
  2. Docs
val type_of : rvalue -> type_

Get the type of this rvalue.

val int : context -> type_ -> int -> rvalue

Given a numeric type (integer or floating point), build an rvalue for the given constant int value.

val zero : context -> type_ -> rvalue

Given a numeric type (integer or floating point), get the rvalue for zero. Essentially this is just a shortcut for:

new_rvalue_from_int ctx numeric_type 0
val one : context -> type_ -> rvalue

Given a numeric type (integer or floating point), get the rvalue for one. Essentially this is just a shortcut for:

new_rvalue_from_int ctx numeric_type 1
val double : context -> type_ -> float -> rvalue

Given a numeric type (integer or floating point), build an rvalue for the given constant double value.

val ptr : context -> type_ -> 'a Ctypes.ptr -> rvalue

Given a pointer type, build an rvalue for the given address.

val null : context -> type_ -> rvalue

Given a pointer type, build an rvalue for NULL. Essentially this is just a shortcut for:

new_rvalue_from_ptr ctx pointer_type Ctypes.null
val string_literal : context -> string -> rvalue

Generate an rvalue for the given NIL-terminated string, of type Const_char_ptr.

val unary_op : context -> ?loc:location -> unary_op -> type_ -> rvalue -> rvalue

Build a unary operation out of an input rvalue. See unary_op.

val binary_op : context -> ?loc:location -> binary_op -> type_ -> rvalue -> rvalue -> rvalue

Build a binary operation out of two constituent rvalues. See binary_op.

val comparison : context -> ?loc:location -> comparison -> rvalue -> rvalue -> rvalue

Build a boolean rvalue out of the comparison of two other rvalues.

val call : context -> ?loc:location -> function_ -> rvalue list -> rvalue

Given a function and the given table of argument rvalues, construct a call to the function, with the result as an rvalue.

Note

new_call merely builds a rvalue i.e. an expression that can be evaluated, perhaps as part of a more complicated expression. The call won't happen unless you add a statement to a function that evaluates the expression.

For example, if you want to call a function and discard the result (or to call a function with void return type), use add_eval:

(* Add "(void)printf (args);". *)
add_eval block (new_call ctx printf_func args)
val indirect_call : context -> ?loc:location -> rvalue -> rvalue list -> rvalue

Call through a function pointer.

val cast : context -> ?loc:location -> rvalue -> type_ -> rvalue

Given an rvalue of T, construct another rvalue of another type. Currently only a limited set of conversions are possible:

  • int <-> float
  • int <-> bool
  • P* <-> Q*, for pointer types P and Q
val access_field : ?loc:location -> rvalue -> field -> rvalue
val lvalue : lvalue -> rvalue
val param : param -> rvalue
val to_string : rvalue -> string

Get a human-readable description of this object.

OCaml

Innovation. Community. Security.