jon.recoil.org

Module Cmm

type machtype_component = Cmx_format.machtype_component =
  1. | Val
  2. | Addr
  3. | Int
  4. | Float
  5. | Vec128
  6. | Vec256
  7. | Vec512
  8. | Float32
  9. | Valx2
type machtype = Cmm.machtype_component array
val typ_void : Cmm.machtype
val typ_val : Cmm.machtype
val typ_addr : Cmm.machtype
val typ_int : Cmm.machtype
val typ_float : Cmm.machtype
val typ_float32 : Cmm.machtype
val typ_vec128 : Cmm.machtype
val typ_vec256 : Cmm.machtype
val typ_vec512 : Cmm.machtype
val typ_int128 : Cmm.machtype

Least upper bound of two machtype_components.

val ge_component : Cmm.machtype_component -> Cmm.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. | XInt8
    (*

    r 8-bit integer

    *)
  3. | XInt16
    (*

    r 16-bit integer

    *)
  4. | XInt32
    (*

    r 32-bit integer

    *)
  5. | XInt64
    (*

    r 64-bit integer

    *)
  6. | XFloat32
    (*

    r single-precision FP number

    *)
  7. | XFloat
    (*

    r double-precision FP number

    *)
  8. | XVec128
    (*

    r 128-bit vector

    *)
  9. | XVec256
    (*

    r 256-bit vector

    *)
  10. | XVec512
    (*

    r 512-bit vector

    *)

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

val machtype_of_exttype : Cmm.exttype -> Cmm.machtype
val machtype_of_exttype_list : Cmm.exttype list -> Cmm.machtype
type stack_align =
  1. | Align_16
  2. | Align_32
  3. | Align_64
val equal_stack_align : Cmm.stack_align -> Cmm.stack_align -> bool
type integer_comparison = Scalar.Integer_comparison.t =
  1. | Ceq
  2. | Cne
  3. | Clt
  4. | Cgt
  5. | Cle
  6. | Cge
  7. | Cult
  8. | Cugt
  9. | Cule
  10. | Cuge
val negate_integer_comparison : Cmm.integer_comparison -> Cmm.integer_comparison
val swap_integer_comparison : Cmm.integer_comparison -> Cmm.integer_comparison
type float_comparison = Scalar.Float_comparison.t =
  1. | CFeq
  2. | CFneq
  3. | CFlt
  4. | CFnlt
  5. | CFgt
  6. | CFngt
  7. | CFle
  8. | CFnle
  9. | CFge
  10. | CFnge
val negate_float_comparison : Cmm.float_comparison -> Cmm.float_comparison
val swap_float_comparison : Cmm.float_comparison -> Cmm.float_comparison
type label = Label.t
val new_label : unit -> Cmm.label
val set_label : Cmm.label -> unit
val cur_label : unit -> Cmm.label
type exit_label =
  1. | Return_lbl
  2. | Lbl of Lambda.static_label
type prefetch_temporal_locality_hint =
  1. | Nonlocal
  2. | Low
  3. | Moderate
  4. | High
type atomic_op =
  1. | Fetch_and_add
  2. | Add
  3. | Sub
  4. | Land
  5. | Lor
  6. | Lxor
  7. | Exchange
  8. | Compare_set
  9. | Compare_exchange
type atomic_bitwidth =
  1. | Thirtytwo
  2. | Sixtyfour
  3. | Word
type effects =
  1. | No_effects
  2. | Arbitrary_effects
type coeffects =
  1. | No_coeffects
  2. | Has_coeffects
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 trywith_shared_label = Lambda.static_label
type trap_action =
  1. | Push of Cmm.trywith_shared_label
    (*

    Add the corresponding handler to the trap stack.

    *)
  2. | Pop of Cmm.trywith_shared_label
    (*

    Remove the last handler from the trap stack.

    *)
type bswap_bitwidth =
  1. | Sixteen
  2. | Thirtytwo
  3. | Sixtyfour
type initialization_or_assignment =
  1. | Initialization
  2. | Assignment
type float_width =
  1. | Float64
  2. | Float32
type vector_width =
  1. | Vec128
  2. | Vec256
  3. | Vec512
type vec128_type =
  1. | Int8x16
  2. | Int16x8
  3. | Int32x4
  4. | Int64x2
  5. | Float16x8
  6. | Float32x4
  7. | Float64x2
type vec256_type =
  1. | Int8x32
  2. | Int16x16
  3. | Int32x8
  4. | Int64x4
  5. | Float16x16
  6. | Float32x8
  7. | Float64x4
type vec512_type =
  1. | Int8x64
  2. | Int16x32
  3. | Int32x16
  4. | Int64x8
  5. | Float16x32
  6. | Float32x16
  7. | Float64x8
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 of {
    1. reg : Cmm.float_width;
    }
  10. | Double
  11. | Onetwentyeight_unaligned
  12. | Onetwentyeight_aligned
  13. | Twofiftysix_unaligned
  14. | Twofiftysix_aligned
  15. | Fivetwelve_unaligned
  16. | Fivetwelve_aligned
type reinterpret_cast =
  1. | Int_of_value
  2. | Value_of_int
  3. | Float_of_float32
  4. | Float32_of_float
  5. | Float_of_int64
  6. | Int64_of_float
  7. | Float32_of_int32
  8. | Int32_of_float32
  9. | V128_of_vec of Cmm.vector_width
  10. | V256_of_vec of Cmm.vector_width
  11. | V512_of_vec of Cmm.vector_width
type static_cast =
  1. | Float_of_int of Cmm.float_width
  2. | Int_of_float of Cmm.float_width
  3. | Float_of_float32
  4. | Float32_of_float
  5. | V128_of_scalar of Cmm.vec128_type
  6. | Scalar_of_v128 of Cmm.vec128_type
  7. | V256_of_scalar of Cmm.vec256_type
  8. | Scalar_of_v256 of Cmm.vec256_type
  9. | V512_of_scalar of Cmm.vec512_type
  10. | Scalar_of_v512 of Cmm.vec512_type
module Alloc_mode : sig ... end
type alloc_block_kind =
  1. | Alloc_block_kind_other
  2. | Alloc_block_kind_closure
  3. | Alloc_block_kind_float
  4. | Alloc_block_kind_float32
  5. | Alloc_block_kind_vec128
  6. | Alloc_block_kind_vec256
  7. | Alloc_block_kind_vec512
  8. | Alloc_block_kind_boxed_int of Primitive.boxed_integer
  9. | Alloc_block_kind_float_array
  10. | Alloc_block_kind_float32_u_array
  11. | Alloc_block_kind_int_u_array
  12. | Alloc_block_kind_int8_u_array
  13. | Alloc_block_kind_int16_u_array
  14. | Alloc_block_kind_int32_u_array
  15. | Alloc_block_kind_int64_u_array
  16. | Alloc_block_kind_vec128_u_array
  17. | Alloc_block_kind_vec256_u_array
  18. | Alloc_block_kind_vec512_u_array
type alloc_dbginfo_item = {
  1. alloc_words : int;
  2. alloc_block_kind : Cmm.alloc_block_kind;
  3. alloc_dbg : Debuginfo.t;
}

Due to Comballoc, a single Ialloc instruction may combine several unrelated allocations. Their Debuginfo.t (which may differ) are stored as a list of alloc_dbginfo. This list is in order of increasing memory address, which is the reverse of the original allocation order. Later allocations are consed to the front of this list by Comballoc.

type alloc_dbginfo = Cmm.alloc_dbginfo_item list
type is_global =
  1. | Global
  2. | Local
val equal_is_global : Cmm.is_global -> Cmm.is_global -> bool
type symbol = {
  1. sym_name : string;
  2. sym_global : Cmm.is_global;
}
type operation =
  1. | Capply of {
    1. result_type : Cmm.machtype;
    2. region : Lambda.region_close;
    3. callees : Cmm.symbol list option;
    }
  2. | Cextcall of {
    1. func : string;
    2. ty : Cmm.machtype;
    3. ty_args : Cmm.exttype list;
    4. alloc : bool;
    5. builtin : bool;
    6. returns : bool;
    7. effects : Cmm.effects;
    8. coeffects : Cmm.coeffects;
    }
    (*

    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 : Cmm.memory_chunk;
    2. mutability : Asttypes.mutable_flag;
    3. is_atomic : bool;
    }
  4. | Calloc of Cmm.Alloc_mode.t * Cmm.alloc_block_kind
  5. | Cstore of Cmm.memory_chunk * Cmm.initialization_or_assignment
  6. | Caddi
  7. | Csubi
  8. | Cmuli
  9. | Cmulhi of {
    1. signed : bool;
    }
  10. | Cdivi
  11. | Cmodi
  12. | Caddi128
  13. | Csubi128
  14. | Cmuli64 of {
    1. signed : bool;
    }
  15. | Cand
  16. | Cor
  17. | Cxor
  18. | Clsl
  19. | Clsr
  20. | Casr
  21. | Cbswap of {
    1. bitwidth : Cmm.bswap_bitwidth;
    }
  22. | Ccsel of Cmm.machtype
  23. | Cclz of {
    1. arg_is_non_zero : bool;
    }
  24. | Cctz of {
    1. arg_is_non_zero : bool;
    }
  25. | Cpopcnt
  26. | Cprefetch of {
    1. is_write : bool;
    2. locality : Cmm.prefetch_temporal_locality_hint;
    }
  27. | Catomic of {
    1. op : Cmm.atomic_op;
    2. size : Cmm.atomic_bitwidth;
    }
  28. | Ccmpi of Cmm.integer_comparison
  29. | Caddv
  30. | Cadda
  31. | Cnegf of Cmm.float_width
  32. | Cabsf of Cmm.float_width
  33. | Caddf of Cmm.float_width
  34. | Csubf of Cmm.float_width
  35. | Cmulf of Cmm.float_width
  36. | Cdivf of Cmm.float_width
  37. | Cpackf32
  38. | Creinterpret_cast of Cmm.reinterpret_cast
  39. | Cstatic_cast of Cmm.static_cast
  40. | Ccmpf of Cmm.float_width * Cmm.float_comparison
  41. | Craise of Lambda.raise_kind
  42. | Cprobe of {
    1. name : string;
    2. handler_code_sym : string;
    3. enabled_at_init : bool;
    }
  43. | Cprobe_is_enabled of {
    1. name : string;
    2. enabled_at_init : bool option;
    }
  44. | Copaque
  45. | Cbeginregion
  46. | Cendregion
  47. | Ctuple_field of int * Cmm.machtype array
  48. | Cdls_get
  49. | Ctls_get
  50. | Cpoll
  51. | Cpause
type vec128_bits = {
  1. word0 : int64;
  2. word1 : int64;
}
type vec256_bits = {
  1. word0 : int64;
  2. word1 : int64;
  3. word2 : int64;
  4. word3 : int64;
}
type vec512_bits = {
  1. word0 : int64;
  2. word1 : int64;
  3. word2 : int64;
  4. word3 : int64;
  5. word4 : int64;
  6. word5 : int64;
  7. word6 : int64;
  8. word7 : int64;
}
val global_symbol : string -> Cmm.symbol
type ccatch_flag =
  1. | Normal
  2. | Recursive
  3. | Exn_handler
type static_handler = {
  1. label : Lambda.static_label;
  2. params : (Backend_var.With_provenance.t * Cmm.machtype) list;
  3. body : Cmm.expression;
  4. dbg : Debuginfo.t;
  5. is_cold : bool;
}

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

and expression =
  1. | Cconst_int of int * Debuginfo.t
  2. | Cconst_natint of nativeint * Debuginfo.t
  3. | Cconst_float32 of float * Debuginfo.t
  4. | Cconst_float of float * Debuginfo.t
  5. | Cconst_vec128 of Cmm.vec128_bits * Debuginfo.t
  6. | Cconst_vec256 of Cmm.vec256_bits * Debuginfo.t
  7. | Cconst_vec512 of Cmm.vec512_bits * Debuginfo.t
  8. | Cconst_symbol of Cmm.symbol * Debuginfo.t
  9. | Cvar of Backend_var.t
  10. | Clet of Backend_var.With_provenance.t * Cmm.expression * Cmm.expression
  11. | Cphantom_let of Backend_var.With_provenance.t * Cmm.phantom_defining_expr option * Cmm.expression
  12. | Ctuple of Cmm.expression list
  13. | Cop of Cmm.operation * Cmm.expression list * Debuginfo.t
  14. | Csequence of Cmm.expression * Cmm.expression
  15. | Cifthenelse of Cmm.expression * Debuginfo.t * Cmm.expression * Debuginfo.t * Cmm.expression * Debuginfo.t
  16. | Cswitch of Cmm.expression * int array * (Cmm.expression * Debuginfo.t) array * Debuginfo.t
  17. | Ccatch of Cmm.ccatch_flag * Cmm.static_handler list * Cmm.expression
  18. | Cexit of Cmm.exit_label * Cmm.expression list * Cmm.trap_action list
type codegen_option =
  1. | Reduce_code_size
  2. | No_CSE
  3. | Use_linscan_regalloc
  4. | Use_regalloc of Clflags.Register_allocator.t
  5. | Use_regalloc_param of string list
  6. | Cold
  7. | Assume_zero_alloc of {
    1. strict : bool;
    2. never_returns_normally : bool;
    3. never_raises : bool;
    4. loc : Location.t;
    }
  8. | Check_zero_alloc of {
    1. strict : bool;
    2. loc : Location.t;
    3. custom_error_msg : string option;
    }
type fundecl = {
  1. fun_name : Cmm.symbol;
  2. fun_args : (Backend_var.With_provenance.t * Cmm.machtype) list;
  3. fun_body : Cmm.expression;
  4. fun_codegen_options : Cmm.codegen_option list;
  5. fun_poll : Lambda.poll_attribute;
  6. fun_dbg : Debuginfo.t;
  7. fun_ret_type : Cmm.machtype;
}
type data_item =
  1. | Cdefine_symbol of Cmm.symbol
  2. | Cint8 of int
  3. | Cint16 of int
  4. | Cint32 of nativeint
  5. | Cint of nativeint
  6. | Csingle of float
  7. | Cdouble of float
  8. | Cvec128 of Cmm.vec128_bits
  9. | Cvec256 of Cmm.vec256_bits
  10. | Cvec512 of Cmm.vec512_bits
  11. | Csymbol_address of Cmm.symbol
  12. | Csymbol_offset of Cmm.symbol * int
  13. | Cstring of string
  14. | Cskip of int
  15. | Calign of int

When data items that are less than 64 bits wide occur in blocks, whose fields are 64-bits wide, the following rules apply:

  • For int32, the value is sign extended.
  • For float32, the value is zero extended. It is ok to rely on zero-initialization of the data section to achieve this.
type phrase =
  1. | Cfunction of Cmm.fundecl
  2. | Cdata of Cmm.data_item list
val reset : unit -> unit
val iter_shallow_tail : (Cmm.expression -> unit) -> Cmm.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).

Apply the transformation to those immediate sub-expressions of an expression that are in tail position, using the same definition of "tail" as iter_shallow_tail

Apply the transformation to an expression, trying to push it to all inner sub-expressions that can produce the final result, by recursively applying map_shallow_tail

val iter_shallow : (Cmm.expression -> unit) -> Cmm.expression -> unit

Apply the callback to each immediate sub-expression.

Apply the transformation to each immediate sub-expression.

val compare_machtype_component : Cmm.machtype_component -> Cmm.machtype_component -> int
val equal_machtype_component : Cmm.machtype_component -> Cmm.machtype_component -> bool
val equal_exttype : Cmm.exttype -> Cmm.exttype -> bool
val equal_static_cast : Cmm.static_cast -> Cmm.static_cast -> bool
val equal_reinterpret_cast : Cmm.reinterpret_cast -> Cmm.reinterpret_cast -> bool
val equal_float_width : Cmm.float_width -> Cmm.float_width -> bool
val equal_float_comparison : Cmm.float_comparison -> Cmm.float_comparison -> bool
val equal_memory_chunk : Cmm.memory_chunk -> Cmm.memory_chunk -> bool
val equal_integer_comparison : Cmm.integer_comparison -> Cmm.integer_comparison -> bool
val caml_flambda2_invalid : string
val is_val : Cmm.machtype_component -> bool
val is_int : Cmm.machtype_component -> bool
val is_addr : Cmm.machtype_component -> bool
val is_exn_handler : Cmm.ccatch_flag -> bool