Skip to content

Commit 5052e90

Browse files
authored
Move Cmm builtin translation code (ocaml-flambda#1033)
1 parent 2798499 commit 5052e90

11 files changed

+641
-588
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ fmt:
9393
$$(find backend/debug \
9494
\( -name "*.ml" -or -name "*.mli" \))
9595
ocamlformat -i backend/cmm_helpers.ml{,i}
96+
ocamlformat -i backend/cmm_builtins.ml{,i}
9697
ocamlformat -i backend/checkmach.ml{,i}
9798
ocamlformat -i tools/merge_archives.ml
9899
ocamlformat -i \
@@ -114,6 +115,7 @@ check-fmt:
114115
[ "$$(git status --porcelain backend/asm_targets)" != "" ] || \
115116
[ "$$(git status --porcelain backend/debug)" != "" ] || \
116117
[ "$$(git status --porcelain backend/cmm_helpers.ml{,i})" != "" ] || \
118+
[ "$$(git status --porcelain backend/cmm_builtins.ml{,i})" != "" ] || \
117119
[ "$$(git status --porcelain backend/checkmach.ml{,i})" != "" ] || \
118120
[ "$$(git status --porcelain tools/merge_archives.ml)" != "" ] || \
119121
[ "$$(git status --porcelain ocaml/utils)" != "" ] || \
@@ -130,6 +132,7 @@ check-fmt:
130132
[ "$$(git diff backend/asm_targets)" != "" ] || \
131133
[ "$$(git diff backend/debug)" != "" ] || \
132134
[ "$$(git diff backend/cmm_helpers.ml{,i})" != "" ] || \
135+
[ "$$(git diff backend/cmm_builtins.ml{,i})" != "" ] || \
133136
[ "$$(git diff backend/checkmach.ml{,i})" != "" ] || \
134137
[ "$$(git diff tools/merge_archives.ml)" != "" ] || \
135138
[ "$$(git diff ocaml/utils)" != "" ] || \

backend/.ocamlformat-enable

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
cmm_helpers.ml
22
cmm_helpers.mli
3+
cmm_builtins.ml
4+
cmm_builtins.mli
35
internal_assembler/*.ml
46
internal_assembler/*.mli
57
checkmach.ml

backend/cmm_builtins.ml

+581
Large diffs are not rendered by default.

backend/cmm_builtins.mli

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
(**************************************************************************)
2+
(* *)
3+
(* OCaml *)
4+
(* *)
5+
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
6+
(* *)
7+
(* Copyright 1996 Institut National de Recherche en Informatique et *)
8+
(* en Automatique. *)
9+
(* *)
10+
(* All rights reserved. This file is distributed under the terms of *)
11+
(* the GNU Lesser General Public License version 2.1, with the *)
12+
(* special exception on linking described in the file LICENSE. *)
13+
(* *)
14+
(**************************************************************************)
15+
16+
open Cmm
17+
18+
(** Create a C function call. *)
19+
val extcall :
20+
dbg:Debuginfo.t ->
21+
returns:bool ->
22+
alloc:bool ->
23+
is_c_builtin:bool ->
24+
ty_args:exttype list ->
25+
string ->
26+
machtype ->
27+
expression list ->
28+
expression
29+
30+
(** [cextcall prim args dbg type_of_result] returns Cextcall operation that
31+
corresponds to [prim]. If [prim] is a C builtin supported on the target,
32+
returns [Cmm.operation] variant for [prim]'s intrinsics. *)
33+
val cextcall :
34+
Primitive.description ->
35+
expression list ->
36+
Debuginfo.t ->
37+
machtype ->
38+
exttype list ->
39+
bool ->
40+
expression

0 commit comments

Comments
 (0)