1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
2011-07-27 07:17:02 -07:00
|
|
|
(* OCaml *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
1999-11-17 10:59:06 -08:00
|
|
|
(* en Automatique. All rights reserved. This file is distributed *)
|
|
|
|
(* under the terms of the Q Public License version 1.0. *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
1995-07-27 10:47:52 -07:00
|
|
|
(* Description of primitive functions *)
|
|
|
|
|
2015-08-25 09:18:46 -07:00
|
|
|
type boxed_integer = Pnativeint | Pint32 | Pint64
|
|
|
|
|
|
|
|
(* Representation of arguments/result for the native code version
|
|
|
|
of a primitive *)
|
|
|
|
type native_repr =
|
|
|
|
| Same_as_ocaml_repr
|
|
|
|
| Unboxed_float
|
|
|
|
| Unboxed_integer of boxed_integer
|
|
|
|
| Untagged_int
|
|
|
|
|
|
|
|
type description = private
|
1995-07-27 10:47:52 -07:00
|
|
|
{ prim_name: string; (* Name of primitive or C function *)
|
|
|
|
prim_arity: int; (* Number of arguments *)
|
|
|
|
prim_alloc: bool; (* Does it allocates or raise? *)
|
|
|
|
prim_native_name: string; (* Name of C function for the nat. code gen. *)
|
2015-08-25 09:18:46 -07:00
|
|
|
prim_native_repr_args: native_repr list;
|
|
|
|
prim_native_repr_res: native_repr }
|
|
|
|
|
2015-10-31 04:41:16 -07:00
|
|
|
(* Invariant [List.length d.prim_native_repr_args = d.prim_arity] *)
|
|
|
|
|
2015-08-25 09:18:46 -07:00
|
|
|
val simple
|
|
|
|
: name:string
|
|
|
|
-> arity:int
|
|
|
|
-> alloc:bool
|
|
|
|
-> description
|
1995-07-27 10:47:52 -07:00
|
|
|
|
2015-10-31 04:41:16 -07:00
|
|
|
val make
|
|
|
|
: name:string
|
|
|
|
-> alloc:bool
|
|
|
|
-> native_name:string
|
|
|
|
-> native_repr_args: native_repr list
|
|
|
|
-> native_repr_res: native_repr
|
|
|
|
-> description
|
|
|
|
|
2015-08-25 09:18:46 -07:00
|
|
|
val parse_declaration
|
|
|
|
: Parsetree.value_description
|
|
|
|
-> native_repr_args:native_repr list
|
|
|
|
-> native_repr_res:native_repr
|
|
|
|
-> description
|
2000-03-13 08:49:01 -08:00
|
|
|
|
2015-10-06 03:58:25 -07:00
|
|
|
val print
|
|
|
|
: description
|
|
|
|
-> Outcometree.out_val_decl
|
|
|
|
-> Outcometree.out_val_decl
|
2008-07-23 22:35:22 -07:00
|
|
|
|
|
|
|
val native_name: description -> string
|
|
|
|
val byte_name: description -> string
|
2015-08-25 09:18:46 -07:00
|
|
|
|
|
|
|
type error =
|
2015-10-06 03:58:28 -07:00
|
|
|
| Old_style_float_with_native_repr_attribute
|
|
|
|
| Old_style_noalloc_with_noalloc_attribute
|
2015-08-25 09:18:46 -07:00
|
|
|
|
|
|
|
exception Error of Location.t * error
|