Module Ocaml_typing.Primitive
type native_repr = | Repr_poly| Same_as_ocaml_repr of Ocaml_typing.Jkind_types.Sort.Const.t| Unboxed_float of Ocaml_typing.Primitive.boxed_float| Unboxed_vector of Ocaml_typing.Primitive.boxed_vector| Unboxed_or_untagged_integer of Ocaml_typing.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 : Ocaml_typing.Primitive.effects;prim_coeffects : Ocaml_typing.Primitive.coeffects;prim_native_name : string;prim_native_repr_args : (Ocaml_typing.Primitive.mode * 'repr) list;prim_native_repr_res : Ocaml_typing.Primitive.mode * 'repr;prim_is_layout_poly : bool;
}type description =
Ocaml_typing.Primitive.native_repr Ocaml_typing.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:Ocaml_typing.Primitive.effects ->
coeffects:Ocaml_typing.Primitive.coeffects ->
native_name:string ->
native_repr_args:(Ocaml_typing.Primitive.mode * 'repr) list ->
native_repr_res:(Ocaml_typing.Primitive.mode * 'repr) ->
is_layout_poly:bool ->
'repr Ocaml_typing.Primitive.description_genval parse_declaration :
Ocaml_parsing.Parsetree.value_description ->
native_repr_args:
(Ocaml_typing.Primitive.mode * Ocaml_typing.Primitive.native_repr) list ->
native_repr_res:
(Ocaml_typing.Primitive.mode * Ocaml_typing.Primitive.native_repr) ->
is_layout_poly:bool ->
Ocaml_typing.Primitive.descriptionval native_name : 'a Ocaml_typing.Primitive.description_gen -> stringval byte_name : 'a Ocaml_typing.Primitive.description_gen -> stringval unboxed_float :
Ocaml_typing.Primitive.boxed_float ->
Ocaml_typing.Primitive.unboxed_floatval unboxed_or_untagged_integer :
Ocaml_typing.Primitive.boxed_integer ->
Ocaml_typing.Primitive.unboxed_or_untagged_integerval unboxed_vector :
Ocaml_typing.Primitive.boxed_vector ->
Ocaml_typing.Primitive.unboxed_vectorval equal_unboxed_or_untagged_integer :
Ocaml_typing.Primitive.unboxed_or_untagged_integer ->
Ocaml_typing.Primitive.unboxed_or_untagged_integer ->
boolval equal_unboxed_float :
Ocaml_typing.Primitive.unboxed_float ->
Ocaml_typing.Primitive.unboxed_float ->
boolval equal_unboxed_vector :
Ocaml_typing.Primitive.unboxed_vector ->
Ocaml_typing.Primitive.unboxed_vector ->
boolval compare_unboxed_float :
Ocaml_typing.Primitive.unboxed_float ->
Ocaml_typing.Primitive.unboxed_float ->
intval compare_unboxed_vector :
Ocaml_typing.Primitive.unboxed_vector ->
Ocaml_typing.Primitive.unboxed_vector ->
intval equal_boxed_integer :
Ocaml_typing.Primitive.boxed_integer ->
Ocaml_typing.Primitive.boxed_integer ->
boolval equal_boxed_float :
Ocaml_typing.Primitive.boxed_float ->
Ocaml_typing.Primitive.boxed_float ->
boolval equal_boxed_vector :
Ocaml_typing.Primitive.boxed_vector ->
Ocaml_typing.Primitive.boxed_vector ->
boolval compare_boxed_float :
Ocaml_typing.Primitive.boxed_float ->
Ocaml_typing.Primitive.boxed_float ->
intval compare_boxed_vector :
Ocaml_typing.Primitive.boxed_vector ->
Ocaml_typing.Primitive.boxed_vector ->
intval equal_native_repr :
Ocaml_typing.Primitive.native_repr ->
Ocaml_typing.Primitive.native_repr ->
boolval equal_effects :
Ocaml_typing.Primitive.effects ->
Ocaml_typing.Primitive.effects ->
boolval equal_coeffects :
Ocaml_typing.Primitive.coeffects ->
Ocaml_typing.Primitive.coeffects ->
boolval native_name_is_external : Ocaml_typing.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:Ocaml_parsing.Location.t ->
Ocaml_typing.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 : Ocaml_typing.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 Ocaml_parsing.Location.t * Ocaml_typing.Primitive.error