package ocaml-base-compiler

  1. Overview
  2. Docs
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
val size_component : machtype_component -> int

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.

val size_machtype : machtype -> int
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
type raise_kind =
  1. | Raise_withtrace
  2. | Raise_notrace
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
  11. | Double_u
and operation =
  1. | Capply of machtype
  2. | Cextcall of string * machtype * bool * label option
  3. | Cload of memory_chunk * Asttypes.mutable_flag
  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 raise_kind
  32. | Ccheckbound
and expression =
  1. | Cconst_int of int
  2. | Cconst_natint of nativeint
  3. | Cconst_float of float
  4. | Cconst_symbol of string
  5. | Cconst_pointer of int
  6. | Cconst_natpointer of nativeint
  7. | Cblockheader of nativeint * Debuginfo.t
  8. | Cvar of Backend_var.t
  9. | Clet of Backend_var.With_provenance.t * expression * expression
  10. | Cphantom_let of Backend_var.With_provenance.t * phantom_defining_expr option * expression
  11. | Cassign of Backend_var.t * expression
  12. | Ctuple of expression list
  13. | Cop of operation * expression list * Debuginfo.t
  14. | Csequence of expression * expression
  15. | Cifthenelse of expression * expression * expression
  16. | Cswitch of expression * int array * expression array * Debuginfo.t
  17. | Cloop of expression
  18. | Ccatch of rec_flag * (int * (Backend_var.With_provenance.t * machtype) list * expression) list * expression
  19. | Cexit of int * expression list
  20. | Ctrywith of expression * Backend_var.With_provenance.t * expression

Not all cmm expressions currently have Debuginfo.t values attached to them. The ones that do are those that are likely to generate code that can fairly robustly be mapped back to a source location. In the future it might be the case that more Debuginfo.t annotations are desirable.

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_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