Legend:
Library
Module
Module type
Parameter
Class
Class type

bind name arg fn is equivalent to let name = arg in fn name, or simply fn arg if arg is simple enough

val bind_load : string -> Cmm.expression -> (Cmm.expression -> Cmm.expression) -> Cmm.expression

Same as bind, but also treats loads from a variable as simple

val bind_nonvar : string -> Cmm.expression -> (Cmm.expression -> Cmm.expression) -> Cmm.expression

Same as bind, but does not treat variables as simple

Headers

val caml_black : nativeint

A null header with GC bits set to black

val floatarray_tag : Debuginfo.t -> Cmm.expression

A constant equal to the tag for float arrays

val block_header : int -> int -> nativeint

block_header tag size creates a header with tag tag for a block of size size

val black_block_header : int -> int -> nativeint

Same as block_header, but with GC bits set to black

val white_closure_header : int -> nativeint

Closure headers of the given size

val black_closure_header : int -> nativeint
val infix_header : int -> nativeint

Infix header at the given offset

val float_header : nativeint

Header for a boxed float value

val floatarray_header : int -> nativeint

Header for an unboxed float array of the given size

val string_header : int -> nativeint

Header for a string (or bytes) of the given length

val boxedint32_header : nativeint

Boxed integer headers

val boxedint64_header : nativeint
val boxedintnat_header : nativeint
val closure_info : arity:int -> startenv:int -> nativeint

Closure info for a closure of given arity and distance to environment

val alloc_float_header : Debuginfo.t -> Cmm.expression

Wrappers

val alloc_floatarray_header : int -> Debuginfo.t -> Cmm.expression
val alloc_closure_header : int -> Debuginfo.t -> Cmm.expression
val alloc_infix_header : int -> Debuginfo.t -> Cmm.expression
val alloc_closure_info : arity:int -> startenv:int -> Debuginfo.t -> Cmm.expression
val alloc_boxedint32_header : Debuginfo.t -> Cmm.expression
val alloc_boxedint64_header : Debuginfo.t -> Cmm.expression
val alloc_boxedintnat_header : Debuginfo.t -> Cmm.expression

Integers

val max_repr_int : int

Minimal/maximal OCaml integer values whose backend representation fits in a regular OCaml integer

val min_repr_int : int
val int_const : Debuginfo.t -> int -> Cmm.expression

Make an integer constant from the given integer (tags the integer)

val cint_const : int -> Cmm.data_item
val targetint_const : int -> Targetint.t
val natint_const_untagged : Debuginfo.t -> Nativeint.t -> Cmm.expression

Make a Cmm constant holding the given nativeint value. Uses Cconst_int instead of Cconst_nativeint when possible to preserve peephole optimisations.

val add_const : Cmm.expression -> int -> Debuginfo.t -> Cmm.expression

Add an integer to the given expression

Increment/decrement of integers

val ignore_low_bit_int : Cmm.expression -> Cmm.expression

Simplify the given expression knowing its last bit will be irrelevant

val ignore_high_bit_int : Cmm.expression -> Cmm.expression

Simplify the given expression knowing its first bit will be irrelevant

Arithmetical operations on integers

Integer tagging. tag_int x = (x lsl 1) + 1

Integer untagging. untag_int x = (x asr 1)

Specific division operations for boxed integers

If-Then-Else expression mk_if_then_else dbg cond ifso_dbg ifso ifnot_dbg ifnot associates dbg to the global if-then-else expression, ifso_dbg to the then branch ifso, and ifnot_dbg to the else branch ifnot

Boolean negation

Integer and float comparison that returns int not bool

val mk_compare_floats : Debuginfo.t -> Cmm.expression -> Cmm.expression -> Cmm.expression
val create_loop : Cmm.expression -> Debuginfo.t -> Cmm.expression

Loop construction (while true do expr done). Used to be represented as Cloop.

val raise_symbol : Debuginfo.t -> string -> Cmm.expression

Exception raising

Convert a tagged integer into a raw integer with boolean meaning

Float boxing and unboxing

val unbox_float : Debuginfo.t -> Cmm.expression -> Cmm.expression

Complex number creation and access

val return_unit : Debuginfo.t -> Cmm.expression -> Cmm.expression

Make the given expression return a unit value

val remove_unit : Cmm.expression -> Cmm.expression

Remove a trailing unit return if any

Blocks

val field_address : Cmm.expression -> int -> Debuginfo.t -> Cmm.expression

field_address ptr n dbg returns an expression for the address of the nth field of the block pointed to by ptr

get_field_gen mut ptr n dbg returns an expression for the access to the nth field of the block pointed to by ptr

set_field ptr n newval init dbg returns an expression for setting the nth field of the block pointed to by ptr to newval

Load a block's header

val get_header_without_profinfo : Cmm.expression -> Debuginfo.t -> Cmm.expression

Same as get_header, but also set all profiling bits of the header are to 0 (if profiling is enabled)

Load a block's tag

Load a block's size

Arrays

val wordsize_shift : int
val numfloat_shift : int
val is_addr_array_hdr : Cmm.expression -> Debuginfo.t -> Cmm.expression

Check whether the given array is an array of regular OCaml values (as opposed to unboxed floats), from its header or pointer

val is_addr_array_ptr : Cmm.expression -> Debuginfo.t -> Cmm.expression
val addr_array_length_shifted : Cmm.expression -> Debuginfo.t -> Cmm.expression

Get the length of an array from its header Shifts by one bit less than necessary, keeping one of the GC colour bits, to save an operation when returning the length as a caml integer or when comparing it to a caml integer. Assumes the header does not have any profiling info (as returned by get_header_without_profinfo)

val float_array_length_shifted : Cmm.expression -> Debuginfo.t -> Cmm.expression

For array_indexing ?typ log2size ptr ofs dbg : Produces a pointer to the element of the array ptr on the position ofs with the given element log2size log2 element size. ofs is given as a tagged int expression. The optional ?typ argument is the C-- type of the result. By default, it is Addr, meaning we are constructing a derived pointer into the heap. If we know the pointer is outside the heap (this is the case for bigarray indexing), we give type Int instead.

Array loads and stores unboxed_float_array_ref and float_array_ref differ in the boxing of the result; float_array_set takes an unboxed float

val int_array_ref : Cmm.expression -> Cmm.expression -> Debuginfo.t ->