Module Primitive
type native_repr = | Repr_poly| Same_as_ocaml_repr of Jkind_types.Sort.Const.t| Unboxed_float of Primitive.boxed_float| Unboxed_vector of Primitive.boxed_vector| Unboxed_or_untagged_integer of Primitive.unboxed_or_untagged_integer
Representation of arguments/result for the native code version of a primitive.
Untagged integers (such as int[@untagged]) are represented as Unboxed_integer Untagged_int
type 'repr description_gen = private {prim_name : string;prim_arity : int;prim_alloc : bool;prim_c_builtin : bool;prim_effects : Primitive.effects;prim_coeffects : Primitive.coeffects;prim_native_name : string;prim_native_repr_args : (Primitive.mode * 'repr) list;prim_native_repr_res : Primitive.mode * 'repr;prim_is_layout_poly : bool;
}type description = Primitive.native_repr Primitive.description_genmake_prim_repr_args n x is the same as List.init n (fun _ -> x). Keeping this function here to be close to upstream. It's intended for use with make.
val make :
name:string ->
alloc:bool ->
c_builtin:bool ->
effects:Primitive.effects ->
coeffects:Primitive.coeffects ->
native_name:string ->
native_repr_args:(Primitive.mode * 'repr) list ->
native_repr_res:(Primitive.mode * 'repr) ->
is_layout_poly:bool ->
'repr Primitive.description_genval parse_declaration :
Parsetree.value_description ->
native_repr_args:(Primitive.mode * Primitive.native_repr) list ->
native_repr_res:(Primitive.mode * Primitive.native_repr) ->
is_layout_poly:bool ->
Primitive.descriptionval print :
Primitive.description ->
Outcometree.out_val_decl ->
Outcometree.out_val_declval native_name : 'a Primitive.description_gen -> stringval byte_name : 'a Primitive.description_gen -> stringval unboxed_float : Primitive.boxed_float -> Primitive.unboxed_floatval unboxed_or_untagged_integer :
Primitive.boxed_integer ->
Primitive.unboxed_or_untagged_integerval unboxed_vector : Primitive.boxed_vector -> Primitive.unboxed_vectorval equal_unboxed_or_untagged_integer :
Primitive.unboxed_or_untagged_integer ->
Primitive.unboxed_or_untagged_integer ->
boolval equal_unboxed_float :
Primitive.unboxed_float ->
Primitive.unboxed_float ->
boolval equal_unboxed_vector :
Primitive.unboxed_vector ->
Primitive.unboxed_vector ->
boolval compare_unboxed_float :
Primitive.unboxed_float ->
Primitive.unboxed_float ->
intval compare_unboxed_vector :
Primitive.unboxed_vector ->
Primitive.unboxed_vector ->
intval equal_boxed_integer :
Primitive.boxed_integer ->
Primitive.boxed_integer ->
boolval equal_boxed_float : Primitive.boxed_float -> Primitive.boxed_float -> boolval equal_boxed_vector :
Primitive.boxed_vector ->
Primitive.boxed_vector ->
boolval compare_boxed_float : Primitive.boxed_float -> Primitive.boxed_float -> intval compare_boxed_vector :
Primitive.boxed_vector ->
Primitive.boxed_vector ->
intval equal_native_repr : Primitive.native_repr -> Primitive.native_repr -> boolval equal_effects : Primitive.effects -> Primitive.effects -> boolval equal_coeffects : Primitive.coeffects -> Primitive.coeffects -> boolval native_name_is_external : Primitive.description -> boolnative_name_is_externa returns true iff the native_name for the given primitive identifies that the primitive is not implemented in the compiler itself.
val prim_has_valid_reprs : loc:Location.t -> Primitive.description -> unitCheck if a primitive has the correct native representations for its argument/return types. This check is done based on the primitive name and only imposes constraints on built-in primitives. Raises if the check fails.
val prim_can_contain_layout_any : Primitive.description -> boolCheck if a primitive can have layout any anywhere within its type declaration. Returns false for built-in primitives that inspect the layout of type parameters (%array_length for example).
type error = | Old_style_float_with_native_repr_attribute| Old_style_float_with_non_value| Old_style_noalloc_with_noalloc_attribute| No_native_primitive_with_repr_attribute| No_native_primitive_with_non_value| Inconsistent_attributes_for_effects| Inconsistent_noalloc_attributes_for_effects| Invalid_representation_polymorphic_attribute| Invalid_native_repr_for_primitive of string
exception Error of Location.t * Primitive.error