Skip to content

Move Cmm builtin translation code #1033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ fmt:
$$(find backend/debug \
\( -name "*.ml" -or -name "*.mli" \))
ocamlformat -i backend/cmm_helpers.ml{,i}
ocamlformat -i backend/cmm_builtins.ml{,i}
ocamlformat -i backend/checkmach.ml{,i}
ocamlformat -i tools/merge_archives.ml
ocamlformat -i \
Expand All @@ -111,6 +112,7 @@ check-fmt:
[ "$$(git status --porcelain backend/asm_targets)" != "" ] || \
[ "$$(git status --porcelain backend/debug)" != "" ] || \
[ "$$(git status --porcelain backend/cmm_helpers.ml{,i})" != "" ] || \
[ "$$(git status --porcelain backend/cmm_builtins.ml{,i})" != "" ] || \
[ "$$(git status --porcelain backend/checkmach.ml{,i})" != "" ] || \
[ "$$(git status --porcelain tools/merge_archives.ml)" != "" ] || \
[ "$$(git status --porcelain utils)" != "" ]; then \
Expand All @@ -126,6 +128,7 @@ check-fmt:
[ "$$(git diff backend/asm_targets)" != "" ] || \
[ "$$(git diff backend/debug)" != "" ] || \
[ "$$(git diff backend/cmm_helpers.ml{,i})" != "" ] || \
[ "$$(git diff backend/cmm_builtins.ml{,i})" != "" ] || \
[ "$$(git diff backend/checkmach.ml{,i})" != "" ] || \
[ "$$(git diff tools/merge_archives.ml)" != "" ] || \
[ "$$(git diff utils)" != "" ]; then \
Expand Down
2 changes: 2 additions & 0 deletions backend/.ocamlformat-enable
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmm_helpers.ml
cmm_helpers.mli
cmm_builtins.ml
cmm_builtins.mli
internal_assembler/*.ml
internal_assembler/*.mli
checkmach.ml
Expand Down
581 changes: 581 additions & 0 deletions backend/cmm_builtins.ml

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions backend/cmm_builtins.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
(**************************************************************************)
(* *)
(* OCaml *)
(* *)
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
(* *)
(* Copyright 1996 Institut National de Recherche en Informatique et *)
(* en Automatique. *)
(* *)
(* All rights reserved. This file is distributed under the terms of *)
(* the GNU Lesser General Public License version 2.1, with the *)
(* special exception on linking described in the file LICENSE. *)
(* *)
(**************************************************************************)

open Cmm

(** Create a C function call. *)
val extcall :
dbg:Debuginfo.t ->
returns:bool ->
alloc:bool ->
is_c_builtin:bool ->
ty_args:exttype list ->
string ->
machtype ->
expression list ->
expression

(** [cextcall prim args dbg type_of_result] returns Cextcall operation that
corresponds to [prim]. If [prim] is a C builtin supported on the target,
returns [Cmm.operation] variant for [prim]'s intrinsics. *)
val cextcall :
Primitive.description ->
expression list ->
Debuginfo.t ->
machtype ->
exttype list ->
bool ->
expression
Loading