package ocaml-base-compiler

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type machtype_component =
  1. | Val
  2. | Addr
  3. | Int
  4. | Float
type machtype = machtype_component array
val typ_void : machtype
val typ_val : machtype
val typ_addr : machtype
val typ_int : machtype
val typ_float : machtype

Least upper bound of two machtype_components.

val ge_component : machtype_component -> machtype_component -> bool

Returns true iff the first supplied machtype_component is greater than or equal to the second under the relation used by lub_component.

type exttype =
  1. | XInt
    (*

    r OCaml value, word-sized integer

    *)
  2. | XInt32
    (*

    r 32-bit integer

    *)
  3. | XInt64
    (*

    r 64-bit integer

    *)
  4. | XFloat
    (*

    r double-precision FP number

    *)

A variant of machtype used to describe arguments to external C functions

val machtype_of_exttype : exttype -> machtype
val machtype_of_exttype_list : exttype list -> machtype
type integer_comparison = Lambda.integer_comparison =
  1. | Ceq
  2. | Cne
  3. | Clt
  4. | Cgt
  5. | Cle
  6. | Cge
val negate_integer_comparison : integer_comparison -> integer_comparison
val swap_integer_comparison : integer_comparison -> integer_comparison
type float_comparison = Lambda.float_comparison =
  1. | CFeq
  2. | CFneq
  3. | CFlt
  4. | CFnlt
  5. | CFgt
  6. | CFngt
  7. | CFle
  8. | CFnle
  9. | CFge
  10. | CFnge
val negate_float_comparison : float_comparison -> float_comparison
val swap_float_comparison : float_comparison -> float_comparison
type label = int
val new_label : unit -> label
val set_label : label -> unit
val cur_label : unit -> label
type rec_flag =
  1. | Nonrecursive
  2. | Recursive
type phantom_defining_expr =
  1. | Cphantom_const_int of Targetint.t
    (*

    The phantom-let-bound variable is a constant integer. The argument must be the tagged representation of an integer within the range of type int on the target. (Analogously to Cconst_int.)

    *)
  2. | Cphantom_const_symbol of string
    (*

    The phantom-let-bound variable is an alias for a symbol.

    *)
  3. | Cphantom_var of Backend_var.t
    (*

    The phantom-let-bound variable is an alias for another variable. The aliased variable must not be a bound by a phantom let.

    *)
  4. | Cphantom_offset_var of {
    1. var : Backend_var.t;
    2. offset_in_words : int;
    }
    (*

    The phantom-let-bound-variable's value is defined by adding the given number of words to the pointer contained in the given identifier.

    *)
  5. | Cphantom_read_field of {
    1. var : Backend_var.t;
    2. field : int;
    }
    (*

    The phantom-let-bound-variable's value is found by adding the given number of words to the pointer contained in the given identifier, then dereferencing.

    *)
  6. | Cphantom_read_symbol_field of {
    1. sym : string;
    2. field : int;
    }
    (*

    As for Uphantom_read_var_field, but with the pointer specified by a symbol.

    *)
  7. | Cphantom_block of {
    1. tag : int;
    2. fields : Backend_var.t list;
    }
    (*

    The phantom-let-bound variable points at a block with the given structure.

    *)
type memory_chunk =
  1. | Byte_unsigned
  2. | Byte_signed
  3. | Sixteen_unsigned
  4. | Sixteen_signed
  5. | Thirtytwo_unsigned
  6. | Thirtytwo_signed
  7. | Word_int
  8. | Word_val
  9. | Single
  10. | Double
and operation =
  1. | Capply of machtype
  2. | Cextcall of string * machtype * exttype list * bool
    (*

    The machtype is the machine type of the result. The exttype list describes the unboxing types of the arguments. An empty list means "all arguments are machine words XInt". The boolean indicates whether the function may allocate.

    *)
  3. | Cload of {
    1. memory_chunk : memory_chunk;
    2. mutability : Asttypes.mutable_flag;
    3. is_atomic : bool;
    }
  4. | Calloc
  5. | Cstore of memory_chunk * Lambda.initialization_or_assignment
  6. | Caddi
  7. | Csubi
  8. | Cmuli
  9. | Cmulhi
  10. | Cdivi
  11. | Cmodi
  12. | Cand
  13. | Cor
  14. | Cxor
  15. | Clsl
  16. | Clsr
  17. | Casr
  18. | Ccmpi of integer_comparison
  19. | Caddv
  20. | Cadda
  21. | Ccmpa of integer_comparison
  22. | Cnegf
  23. | Cabsf
  24. | Caddf
  25. | Csubf
  26. | Cmulf
  27. | Cdivf
  28. | Cfloatofint
  29. | Cintoffloat
  30. | Ccmpf of float_comparison
  31. | Craise of Lambda.raise_kind
  32. | Ccheckbound
  33. | Copaque
  34. | Cdls_get
and expression =
  1. | Cconst_int of int * Debuginfo.t
  2. | Cconst_natint of nativeint * Debuginfo.t
  3. | Cconst_float of float * Debuginfo.t
  4. | Cconst_symbol of string * Debuginfo.t
  5. | Cvar of Backend_var.t
  6. | Clet of Backend_var.With_provenance.t * expression * expression
  7. | Clet_mut of Backend_var.With_provenance.t * machtype * expression * expression
  8. | Cphantom_let of Backend_var.With_provenance.t * phantom_defining_expr option * expression
  9. | Cassign of Backend_var.t * expression
  10. | Ctuple of expression list
  11. | Cop of operation * expression list * Debuginfo.t
  12. | Csequence of expression * expression
  13. | Cifthenelse of expression * Debuginfo.t * expression * Debuginfo.t * expression * Debuginfo.t
  14. | Cswitch of expression * int array * (expression * Debuginfo.t) array * Debuginfo.t
  15. | Ccatch of rec_flag * (int * (Backend_var.With_provenance.t * machtype) list * expression * Debuginfo.t) list * expression
  16. | Cexit of int * expression list
  17. | Ctrywith of expression * Backend_var.With_provenance.t * expression * Debuginfo.t

Every basic block should have a corresponding Debuginfo.t for its beginning.

type codegen_option =
  1. | Reduce_code_size
  2. | No_CSE
type fundecl = {
  1. fun_name : string;
  2. fun_args : (Backend_var.With_provenance.t * machtype) list;
  3. fun_body : expression;
  4. fun_codegen_options : codegen_option list;
  5. fun_poll : Lambda.poll_attribute;
  6. fun_dbg : Debuginfo.t;
}
type data_item =
  1. | Cdefine_symbol of string
  2. | Cglobal_symbol of string
  3. | Cint8 of int
  4. | Cint16 of int
  5. | Cint32 of nativeint
  6. | Cint of nativeint
  7. | Csingle of float
  8. | Cdouble of float
  9. | Csymbol_address of string
  10. | Cstring of string
  11. | Cskip of int
  12. | Calign of int
type phrase =
  1. | Cfunction of fundecl
  2. | Cdata of data_item list
val reset : unit -> unit
val iter_shallow_tail : (expression -> unit) -> expression -> bool

Either apply the callback to all immediate sub-expressions that can produce the final result for the expression and return true, or do nothing and return false. Note that the notion of "tail" sub-expression used here does not match the one used to trigger tail calls; in particular, try...with handlers are considered to be in tail position (because their result become the final result for the expression).

val map_tail : (expression -> expression) -> expression -> expression

Apply the transformation to an expression, trying to push it to all inner sub-expressions that can produce the final result. Same disclaimer as for iter_shallow_tail about the notion of "tail" sub-expression.

val map_shallow : (expression -> expression) -> expression -> expression

Apply the transformation to each immediate sub-expression.

OCaml

Innovation. Community. Security.