Module Melange_compiler_libs.Primitive

type boxed_integer =
  1. | Pnativeint
  2. | Pint32
  3. | Pint64
;
type native_repr =
  1. | Same_as_ocaml_repr
  2. | Unboxed_float
  3. | Unboxed_integer(boxed_integer)
  4. | Untagged_int
;
type description = pri {
  1. prim_name: string,
  2. prim_arity: int,
  3. prim_alloc: bool,
  4. prim_native_name: string,
  5. prim_native_repr_args: list(native_repr),
  6. prim_native_repr_res: native_repr,
};
let simple: name:string => arity:int => alloc:bool => description;
let make: name:string => alloc:bool => native_name:string => native_repr_args:list(native_repr) => native_repr_res:native_repr => description;
let parse_declaration: Parsetree.value_description => native_repr_args:list(native_repr) => native_repr_res:native_repr => description;
let native_name: description => string;
let byte_name: description => string;
let equal_boxed_integer: boxed_integer => boxed_integer => bool;
let equal_native_repr: native_repr => native_repr => bool;
let native_name_is_external: description => bool;

native_name_is_externa returns true iff the native_name for the given primitive identifies that the primitive is not implemented in the compiler itself.

type error =
  1. | Old_style_float_with_native_repr_attribute
  2. | Old_style_noalloc_with_noalloc_attribute
  3. | No_native_primitive_with_repr_attribute
;
exception Error(Location.t, error);