@grain/binaryen.ml 0.9.1 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {binaryen-archive → binaryen-archive-v0.11.2}/.gitattributes +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/.gitignore +1 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/.gitmodules +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/CHANGELOG.md +73 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/LICENSE +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/README.md +27 -3
- {binaryen-archive → binaryen-archive-v0.11.2}/binaryen.opam +8 -8
- {binaryen-archive → binaryen-archive-v0.11.2}/dune +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/dune-project +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/dune-workspace +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/.gitattributes +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/.gitignore +0 -0
- binaryen-archive-v0.11.2/esy.lock/index.json +1365 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/astring.0.8.5/opam +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/base-threads.base/opam +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/base-unix.base/opam +0 -0
- {binaryen-archive/esy.lock/opam/base.v0.14.1 → binaryen-archive-v0.11.2/esy.lock/opam/base.v0.14.2}/opam +4 -4
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/biniou.1.2.1/opam +1 -1
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/cmdliner.1.0.4/opam +0 -0
- {binaryen-archive/esy.lock/opam/cppo.1.6.7 → binaryen-archive-v0.11.2/esy.lock/opam/cppo.1.6.8}/opam +4 -6
- {binaryen-archive/esy.lock/opam/csexp.1.4.0 → binaryen-archive-v0.11.2/esy.lock/opam/csexp.1.5.1}/opam +11 -9
- {binaryen-archive/esy.lock/opam/dune-build-info.2.8.2 → binaryen-archive-v0.11.2/esy.lock/opam/dune-build-info.2.9.1}/opam +5 -5
- {binaryen-archive/esy.lock/opam/dune-configurator.2.8.2 → binaryen-archive-v0.11.2/esy.lock/opam/dune-configurator.2.9.1}/opam +5 -5
- {binaryen-archive/esy.lock/opam/dune.2.8.2 → binaryen-archive-v0.11.2/esy.lock/opam/dune.2.9.1}/opam +4 -4
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/easy-format.1.3.2/opam +1 -1
- {binaryen-archive/esy.lock/opam/fix.20201120 → binaryen-archive-v0.11.2/esy.lock/opam/fix.20211231}/opam +7 -5
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/fpath.0.7.3/opam +0 -0
- binaryen-archive-v0.11.2/esy.lock/opam/js_of_ocaml-compiler.3.11.0/opam +54 -0
- binaryen-archive-v0.11.2/esy.lock/opam/js_of_ocaml-ppx.3.11.0/opam +44 -0
- binaryen-archive-v0.11.2/esy.lock/opam/js_of_ocaml.3.11.0/opam +45 -0
- {binaryen-archive/esy.lock/opam/menhir.20201216 → binaryen-archive-v0.11.2/esy.lock/opam/menhir.20211128}/opam +8 -6
- {binaryen-archive/esy.lock/opam/menhirLib.20201216 → binaryen-archive-v0.11.2/esy.lock/opam/menhirLib.20211128}/opam +8 -6
- {binaryen-archive/esy.lock/opam/menhirSdk.20201216 → binaryen-archive-v0.11.2/esy.lock/opam/menhirSdk.20211128}/opam +8 -6
- binaryen-archive-v0.11.2/esy.lock/opam/ocaml-compiler-libs.v0.12.4/opam +39 -0
- {binaryen-archive/esy.lock/opam/ocaml-lsp-server.1.4.0 → binaryen-archive-v0.11.2/esy.lock/opam/ocaml-lsp-server.1.9.0}/opam +15 -12
- {binaryen-archive/esy.lock/opam/ocaml-migrate-parsetree.2.1.0 → binaryen-archive-v0.11.2/esy.lock/opam/ocaml-migrate-parsetree.2.3.0}/opam +13 -10
- binaryen-archive-v0.11.2/esy.lock/opam/ocaml-version.3.4.0/opam +49 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/ocamlbuild.0.14.0/opam +1 -1
- {binaryen-archive/esy.lock/opam/ocamlfind.1.8.1 → binaryen-archive-v0.11.2/esy.lock/opam/ocamlfind.1.9.1}/opam +19 -39
- binaryen-archive-v0.11.2/esy.lock/opam/ocamlformat-rpc-lib.0.19.0/opam +40 -0
- binaryen-archive-v0.11.2/esy.lock/opam/ocamlformat.0.18.0/opam +56 -0
- {binaryen-archive/esy.lock/opam/odoc.1.5.2 → binaryen-archive-v0.11.2/esy.lock/opam/odoc.1.5.3}/opam +12 -12
- binaryen-archive-v0.11.2/esy.lock/opam/pp.1.1.2/opam +58 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/ppx_derivers.1.2.1/opam +1 -1
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/ppx_yojson_conv_lib.v0.14.0/opam +2 -2
- {binaryen-archive/esy.lock/opam/ppxlib.0.21.0 → binaryen-archive-v0.11.2/esy.lock/opam/ppxlib.0.22.2}/opam +40 -32
- {binaryen-archive/esy.lock/opam/re.1.9.0 → binaryen-archive-v0.11.2/esy.lock/opam/re.1.10.3}/opam +8 -4
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/result.1.5/opam +2 -2
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/seq.base/files/META.seq +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/seq.base/files/seq.install +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/seq.base/opam +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/sexplib0.v0.14.0/opam +2 -2
- binaryen-archive-v0.11.2/esy.lock/opam/spawn.v0.15.0/opam +56 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/stdio.v0.14.0/opam +2 -2
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/stdlib-shims.0.3.0/opam +0 -0
- {binaryen-archive/esy.lock/opam/topkg.1.0.3 → binaryen-archive-v0.11.2/esy.lock/opam/topkg.1.0.4}/opam +18 -22
- binaryen-archive-v0.11.2/esy.lock/opam/tyxml.4.5.0/opam +42 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/uchar.0.0.2/opam +0 -0
- binaryen-archive-v0.11.2/esy.lock/opam/uucp.14.0.0/opam +41 -0
- {binaryen-archive/esy.lock/opam/uuseg.13.0.0 → binaryen-archive-v0.11.2/esy.lock/opam/uuseg.14.0.0}/opam +22 -28
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/uutf.1.0.2/opam +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/yojson.1.7.0/opam +1 -1
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/files/ocamlbuild-0.14.0.patch +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/package.json +0 -0
- binaryen-archive/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch → binaryen-archive-v0.11.2/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.1_opam_override/files/findlib-1.9.1.patch +0 -0
- {binaryen-archive/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override → binaryen-archive-v0.11.2/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.1_opam_override}/package.json +1 -1
- binaryen-archive-v0.11.2/js/binaryen.es5.js +5 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/js/dune +1 -6
- binaryen-archive-v0.11.2/js/element_segment.ml +33 -0
- binaryen-archive-v0.11.2/js/export.ml +60 -0
- binaryen-archive-v0.11.2/js/expression.ml +944 -0
- binaryen-archive-v0.11.2/js/function.ml +60 -0
- binaryen-archive-v0.11.2/js/global.ml +48 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/js/import.ml +24 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/js/literal.ml +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/js/memory.ml +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/js/module.ml +42 -46
- {binaryen-archive → binaryen-archive-v0.11.2}/js/op.ml +9 -78
- binaryen-archive-v0.11.2/js/postlude.js +2 -0
- binaryen-archive-v0.11.2/js/prelude.js +11 -0
- binaryen-archive-v0.11.2/js/settings.ml +60 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/js/stubs.c +0 -0
- binaryen-archive-v0.11.2/js/table.ml +29 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/js/type.ml +3 -0
- binaryen-archive-v0.11.2/package.json +37 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_exports.c +78 -0
- binaryen-archive-v0.11.2/src/binaryen_stubs_expressions.c +1710 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_features.c +7 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_functions.c +78 -0
- binaryen-archive-v0.11.2/src/binaryen_stubs_globals.c +109 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_imports.c +29 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_literals.c +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_memory.c +1 -1
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_modules.c +0 -122
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_ops.c +19 -173
- binaryen-archive-v0.11.2/src/binaryen_stubs_settings.c +145 -0
- binaryen-archive-v0.11.2/src/binaryen_stubs_tables.c +145 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_types.c +18 -0
- binaryen-archive-v0.11.2/src/dune +14 -0
- binaryen-archive-v0.11.2/src/element_segment.ml +13 -0
- binaryen-archive-v0.11.2/src/export.ml +54 -0
- binaryen-archive-v0.11.2/src/expression.ml +844 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/function.ml +18 -0
- binaryen-archive-v0.11.2/src/global.ml +24 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/import.ml +12 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/literal.ml +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/memory.ml +0 -0
- binaryen-archive-v0.11.2/src/module.ml +115 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/ocaml_helpers.c +0 -8
- {binaryen-archive → binaryen-archive-v0.11.2}/src/ocaml_helpers.h +2 -3
- {binaryen-archive → binaryen-archive-v0.11.2}/src/op.ml +18 -131
- binaryen-archive-v0.11.2/src/settings.ml +45 -0
- binaryen-archive-v0.11.2/src/table.ml +26 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/type.ml +2 -0
- binaryen-archive-v0.11.2/test/config/dune +8 -0
- binaryen-archive-v0.11.2/test/config/ocamlopt_flags.ml +16 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/test/dune +4 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/test/test.expected +38 -5
- binaryen-archive-v0.11.2/test/test.ml +147 -0
- binaryen-archive-v0.11.2/virtual/dune +6 -0
- binaryen-archive-v0.11.2/virtual/element_segment.mli +11 -0
- binaryen-archive-v0.11.2/virtual/export.mli +33 -0
- binaryen-archive-v0.11.2/virtual/expression.mli +423 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/virtual/function.mli +16 -0
- binaryen-archive-v0.11.2/virtual/global.mli +19 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/virtual/import.mli +8 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/virtual/literal.mli +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/virtual/memory.mli +0 -0
- binaryen-archive-v0.11.2/virtual/module.mli +65 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/virtual/op.mli +9 -53
- binaryen-archive-v0.11.2/virtual/settings.mli +35 -0
- binaryen-archive-v0.11.2/virtual/table.mli +19 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/virtual/type.mli +2 -0
- binaryen-archive/esy.lock/index.json +0 -1288
- binaryen-archive/esy.lock/opam/conf-m4.1/opam +0 -22
- binaryen-archive/esy.lock/opam/dot-merlin-reader.4.1/opam +0 -30
- binaryen-archive/esy.lock/opam/js_of_ocaml-compiler.3.9.1/opam +0 -40
- binaryen-archive/esy.lock/opam/js_of_ocaml-ppx.3.9.0/opam +0 -30
- binaryen-archive/esy.lock/opam/js_of_ocaml.3.9.0/opam +0 -31
- binaryen-archive/esy.lock/opam/ocaml-compiler-libs.v0.12.3/opam +0 -29
- binaryen-archive/esy.lock/opam/ocamlfind.1.8.1/files/ocaml-stub +0 -4
- binaryen-archive/esy.lock/opam/ocamlfind.1.8.1/files/ocamlfind.install +0 -6
- binaryen-archive/esy.lock/opam/ocamlformat.0.15.1/opam +0 -41
- binaryen-archive/esy.lock/opam/tyxml.4.4.0/opam +0 -47
- binaryen-archive/esy.lock/opam/uucp.13.0.0/opam +0 -44
- binaryen-archive/esy.lock/overrides/opam__s__conf_m4_opam__c__1_opam_override/package.json +0 -6
- binaryen-archive/js/export.ml +0 -23
- binaryen-archive/js/expression.ml +0 -185
- binaryen-archive/js/features.ml +0 -27
- binaryen-archive/js/function.ml +0 -29
- binaryen-archive/js/function_table.ml +0 -13
- binaryen-archive/js/global.ml +0 -19
- binaryen-archive/js/postlude.js +0 -2
- binaryen-archive/js/table.ml +0 -12
- binaryen-archive/package.json +0 -43
- binaryen-archive/src/binaryen_stubs_expressions.c +0 -410
- binaryen-archive/src/binaryen_stubs_function_tables.c +0 -25
- binaryen-archive/src/binaryen_stubs_globals.c +0 -46
- binaryen-archive/src/binaryen_stubs_tables.c +0 -31
- binaryen-archive/src/config/dune +0 -8
- binaryen-archive/src/config/library_flags.ml +0 -16
- binaryen-archive/src/dune +0 -53
- binaryen-archive/src/export.ml +0 -21
- binaryen-archive/src/expression.ml +0 -115
- binaryen-archive/src/features.ml +0 -49
- binaryen-archive/src/function_table.ml +0 -6
- binaryen-archive/src/global.ml +0 -10
- binaryen-archive/src/module.ml +0 -89
- binaryen-archive/src/table.ml +0 -4
- binaryen-archive/test/test.ml +0 -83
- binaryen-archive/vendor/binaryen-c.h +0 -2647
- binaryen-archive/vendor/js/index.es5.js +0 -5
- binaryen-archive/vendor/linux/libbinaryen.a +0 -0
- binaryen-archive/vendor/linux/libbinaryen.so +0 -0
- binaryen-archive/vendor/macosx/libbinaryen.a +0 -0
- binaryen-archive/vendor/macosx/libbinaryen.dylib +0 -0
- binaryen-archive/vendor/mingw64/libbinaryen.a +0 -0
- binaryen-archive/vendor/mingw64/libbinaryen.dll +0 -0
- binaryen-archive/vendor/wasm-delegations.h +0 -85
- binaryen-archive/virtual/dune +0 -6
- binaryen-archive/virtual/export.mli +0 -11
- binaryen-archive/virtual/expression.mli +0 -68
- binaryen-archive/virtual/features.mli +0 -23
- binaryen-archive/virtual/function_table.mli +0 -4
- binaryen-archive/virtual/global.mli +0 -7
- binaryen-archive/virtual/module.mli +0 -67
- binaryen-archive/virtual/table.mli +0 -2
|
@@ -0,0 +1,1710 @@
|
|
|
1
|
+
#define CAML_NAME_SPACE
|
|
2
|
+
#include <caml/mlvalues.h>
|
|
3
|
+
#include <caml/fail.h>
|
|
4
|
+
#include <caml/memory.h>
|
|
5
|
+
#include <caml/alloc.h>
|
|
6
|
+
|
|
7
|
+
#include "binaryen-c.h"
|
|
8
|
+
#include "ocaml_helpers.h"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
/* Allocating an OCaml custom block to hold the given BinaryenExpressionRef */
|
|
12
|
+
static value alloc_BinaryenExpressionRef(BinaryenExpressionRef exp)
|
|
13
|
+
{
|
|
14
|
+
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenExpressionRef), 0, 1);
|
|
15
|
+
BinaryenExpressionRef_val(v) = exp;
|
|
16
|
+
return v;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
CAMLprim value
|
|
20
|
+
caml_binaryen_expression_get_id(value _expr) {
|
|
21
|
+
CAMLparam1(_expr);
|
|
22
|
+
BinaryenExpressionRef expr = BinaryenExpressionRef_val(_expr);
|
|
23
|
+
CAMLreturn(Val_int(BinaryenExpressionGetId(expr)));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
CAMLprim value
|
|
27
|
+
caml_binaryen_null_expression(value unit) {
|
|
28
|
+
CAMLparam1(unit);
|
|
29
|
+
CAMLreturn(alloc_BinaryenExpressionRef(NULL));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
CAMLprim value
|
|
33
|
+
caml_binaryen_block(value _module, value _name, value _children, value _ty) {
|
|
34
|
+
CAMLparam4(_module, _name, _children, _ty);
|
|
35
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
36
|
+
char* name = Safe_String_val(_name);
|
|
37
|
+
_children = array_of_list(_children);
|
|
38
|
+
int childLen = array_length(_children);
|
|
39
|
+
BinaryenExpressionRef children[childLen];
|
|
40
|
+
for (int i = 0; i < childLen; i++) {
|
|
41
|
+
children[i] = BinaryenExpressionRef_val(Field(_children, i));
|
|
42
|
+
}
|
|
43
|
+
BinaryenType ty = BinaryenType_val(_ty);
|
|
44
|
+
BinaryenExpressionRef block = BinaryenBlock(module, name, children, childLen, ty);
|
|
45
|
+
CAMLreturn(alloc_BinaryenExpressionRef(block));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
CAMLprim value
|
|
49
|
+
caml_binaryen_if(value _module, value _cond, value _tru, value _fals) {
|
|
50
|
+
CAMLparam4(_module, _cond, _tru, _fals);
|
|
51
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
52
|
+
BinaryenExpressionRef cond = BinaryenExpressionRef_val(_cond);
|
|
53
|
+
BinaryenExpressionRef tru = BinaryenExpressionRef_val(_tru);
|
|
54
|
+
BinaryenExpressionRef fals = BinaryenExpressionRef_val(_fals);
|
|
55
|
+
BinaryenExpressionRef exp = BinaryenIf(module, cond, tru, fals);
|
|
56
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
CAMLprim value
|
|
60
|
+
caml_binaryen_loop(value _module, value _name, value _body) {
|
|
61
|
+
CAMLparam3(_module, _name, _body);
|
|
62
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
63
|
+
char* name = Safe_String_val(_name);
|
|
64
|
+
BinaryenExpressionRef body = BinaryenExpressionRef_val(_body);
|
|
65
|
+
BinaryenExpressionRef exp = BinaryenLoop(module, name, body);
|
|
66
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
CAMLprim value
|
|
70
|
+
caml_binaryen_break(value _module, value _name, value _cond, value _res) {
|
|
71
|
+
CAMLparam4(_module, _name, _cond, _res);
|
|
72
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
73
|
+
char* name = Safe_String_val(_name);
|
|
74
|
+
BinaryenExpressionRef cond = BinaryenExpressionRef_val(_cond);
|
|
75
|
+
BinaryenExpressionRef res = BinaryenExpressionRef_val(_res);
|
|
76
|
+
BinaryenExpressionRef exp = BinaryenBreak(module, name, cond, res);
|
|
77
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
CAMLprim value
|
|
81
|
+
caml_binaryen_switch(value _module, value _names, value _defaultName, value _cond, value _val) {
|
|
82
|
+
CAMLparam5(_module, _names, _defaultName, _cond, _val);
|
|
83
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
84
|
+
_names = array_of_list(_names);
|
|
85
|
+
int namesLen = array_length(_names);
|
|
86
|
+
const char* names[namesLen];
|
|
87
|
+
for (int i = 0; i < namesLen; i++) {
|
|
88
|
+
names[i] = Safe_String_val(Field(_names, i));
|
|
89
|
+
}
|
|
90
|
+
char* defaultName = Safe_String_val(_defaultName);
|
|
91
|
+
BinaryenExpressionRef cond = BinaryenExpressionRef_val(_cond);
|
|
92
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_val);
|
|
93
|
+
BinaryenExpressionRef exp = BinaryenSwitch(module, names, namesLen, defaultName, cond, val);
|
|
94
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
CAMLprim value
|
|
98
|
+
caml_binaryen_call(value _module, value _name, value _params, value _retty) {
|
|
99
|
+
CAMLparam4(_module, _name, _params, _retty);
|
|
100
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
101
|
+
char* name = Safe_String_val(_name);
|
|
102
|
+
_params = array_of_list(_params);
|
|
103
|
+
int paramsLen = array_length(_params);
|
|
104
|
+
BinaryenExpressionRef params[paramsLen];
|
|
105
|
+
for (int i = 0; i < paramsLen; i++) {
|
|
106
|
+
params[i] = BinaryenExpressionRef_val(Field(_params, i));
|
|
107
|
+
}
|
|
108
|
+
BinaryenType retty = BinaryenType_val(_retty);
|
|
109
|
+
BinaryenExpressionRef exp = BinaryenCall(module, name, params, paramsLen, retty);
|
|
110
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
CAMLprim value
|
|
114
|
+
caml_binaryen_call_indirect(value _module, value _table, value _target, value _params, value _paramsty, value _retty) {
|
|
115
|
+
CAMLparam5(_module, _table, _target, _params, _paramsty);
|
|
116
|
+
CAMLxparam1(_retty);
|
|
117
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
118
|
+
char* table = Safe_String_val(_table);
|
|
119
|
+
BinaryenExpressionRef target = BinaryenExpressionRef_val(_target);
|
|
120
|
+
_params = array_of_list(_params);
|
|
121
|
+
int paramsLen = array_length(_params);
|
|
122
|
+
BinaryenExpressionRef params[paramsLen];
|
|
123
|
+
for (int i = 0; i < paramsLen; i++) {
|
|
124
|
+
params[i] = BinaryenExpressionRef_val(Field(_params, i));
|
|
125
|
+
}
|
|
126
|
+
BinaryenType paramsty = BinaryenType_val(_paramsty);
|
|
127
|
+
BinaryenType retty = BinaryenType_val(_retty);
|
|
128
|
+
BinaryenExpressionRef exp = BinaryenCallIndirect(module, table, target, params, paramsLen, paramsty, retty);
|
|
129
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
130
|
+
}
|
|
131
|
+
CAMLprim value
|
|
132
|
+
caml_binaryen_call_indirect__bytecode(value * argv) {
|
|
133
|
+
return caml_binaryen_call_indirect(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
CAMLprim value
|
|
137
|
+
caml_binaryen_return_call(value _module, value _name, value _params, value _retty) {
|
|
138
|
+
CAMLparam4(_module, _name, _params, _retty);
|
|
139
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
140
|
+
char* name = Safe_String_val(_name);
|
|
141
|
+
_params = array_of_list(_params);
|
|
142
|
+
int paramsLen = array_length(_params);
|
|
143
|
+
BinaryenExpressionRef params[paramsLen];
|
|
144
|
+
for (int i = 0; i < paramsLen; i++) {
|
|
145
|
+
params[i] = BinaryenExpressionRef_val(Field(_params, i));
|
|
146
|
+
}
|
|
147
|
+
BinaryenType retty = BinaryenType_val(_retty);
|
|
148
|
+
BinaryenExpressionRef exp = BinaryenReturnCall(module, name, params, paramsLen, retty);
|
|
149
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
CAMLprim value
|
|
153
|
+
caml_binaryen_return_call_indirect(value _module, value _table, value _target, value _params, value _paramsty, value _retty) {
|
|
154
|
+
CAMLparam5(_module, _table, _target, _params, _paramsty);
|
|
155
|
+
CAMLxparam1(_retty);
|
|
156
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
157
|
+
char* table = Safe_String_val(_table);
|
|
158
|
+
BinaryenExpressionRef target = BinaryenExpressionRef_val(_target);
|
|
159
|
+
_params = array_of_list(_params);
|
|
160
|
+
int paramsLen = array_length(_params);
|
|
161
|
+
BinaryenExpressionRef params[paramsLen];
|
|
162
|
+
for (int i = 0; i < paramsLen; i++) {
|
|
163
|
+
params[i] = BinaryenExpressionRef_val(Field(_params, i));
|
|
164
|
+
}
|
|
165
|
+
BinaryenType paramsty = BinaryenType_val(_paramsty);
|
|
166
|
+
BinaryenType retty = BinaryenType_val(_retty);
|
|
167
|
+
BinaryenExpressionRef exp = BinaryenReturnCallIndirect(module, table, target, params, paramsLen, paramsty, retty);
|
|
168
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
169
|
+
}
|
|
170
|
+
CAMLprim value
|
|
171
|
+
caml_binaryen_return_call_indirect__bytecode(value * argv) {
|
|
172
|
+
return caml_binaryen_return_call_indirect(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
CAMLprim value
|
|
176
|
+
caml_binaryen_local_get(value _module, value _slot, value _ty) {
|
|
177
|
+
CAMLparam3(_module, _slot, _ty);
|
|
178
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
179
|
+
int slot = Int_val(_slot);
|
|
180
|
+
BinaryenType ty = BinaryenType_val(_ty);
|
|
181
|
+
BinaryenExpressionRef exp = BinaryenLocalGet(module, slot, ty);
|
|
182
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
CAMLprim value
|
|
186
|
+
caml_binaryen_local_set(value _module, value _slot, value _val) {
|
|
187
|
+
CAMLparam3(_module, _slot, _val);
|
|
188
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
189
|
+
int slot = Int_val(_slot);
|
|
190
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_val);
|
|
191
|
+
BinaryenExpressionRef exp = BinaryenLocalSet(module, slot, val);
|
|
192
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
CAMLprim value
|
|
196
|
+
caml_binaryen_local_tee(value _module, value _slot, value _val, value _ty) {
|
|
197
|
+
CAMLparam4(_module, _slot, _val, _ty);
|
|
198
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
199
|
+
int slot = Int_val(_slot);
|
|
200
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_val);
|
|
201
|
+
BinaryenType ty = BinaryenType_val(_ty);
|
|
202
|
+
BinaryenExpressionRef exp = BinaryenLocalTee(module, slot, val, ty);
|
|
203
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
CAMLprim value
|
|
207
|
+
caml_binaryen_global_get(value _module, value _name, value _ty) {
|
|
208
|
+
CAMLparam3(_module, _name, _ty);
|
|
209
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
210
|
+
char* name = Safe_String_val(_name);
|
|
211
|
+
BinaryenType ty = BinaryenType_val(_ty);
|
|
212
|
+
BinaryenExpressionRef exp = BinaryenGlobalGet(module, name, ty);
|
|
213
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
CAMLprim value
|
|
217
|
+
caml_binaryen_global_set(value _module, value _name, value _val) {
|
|
218
|
+
CAMLparam3(_module, _name, _val);
|
|
219
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
220
|
+
char* name = Safe_String_val(_name);
|
|
221
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_val);
|
|
222
|
+
BinaryenExpressionRef exp = BinaryenGlobalSet(module, name, val);
|
|
223
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
CAMLprim value
|
|
227
|
+
caml_binaryen_load(value _module, value _bytes, value _signed_, value _offset, value _align, value _ty, value _ptr) {
|
|
228
|
+
CAMLparam5(_module, _bytes, _signed_, _offset, _align);
|
|
229
|
+
CAMLxparam2(_ty, _ptr);
|
|
230
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
231
|
+
int bytes = Int_val(_bytes);
|
|
232
|
+
int8_t signed_ = Bool_val(_signed_);
|
|
233
|
+
int offset = Int_val(_offset);
|
|
234
|
+
int align = Int_val(_align);
|
|
235
|
+
BinaryenType ty = BinaryenType_val(_ty);
|
|
236
|
+
BinaryenExpressionRef ptr = BinaryenExpressionRef_val(_ptr);
|
|
237
|
+
BinaryenExpressionRef exp = BinaryenLoad(module, bytes, signed_, offset, align, ty, ptr);
|
|
238
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
239
|
+
}
|
|
240
|
+
CAMLprim value
|
|
241
|
+
caml_binaryen_load__bytecode(value * argv) {
|
|
242
|
+
return caml_binaryen_load(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
CAMLprim value
|
|
246
|
+
caml_binaryen_store(value _module, value _bytes, value _offset, value _align, value _ptr, value _val, value _ty) {
|
|
247
|
+
CAMLparam5(_module, _bytes, _offset, _align, _ptr);
|
|
248
|
+
CAMLxparam2(_val, _ty);
|
|
249
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
250
|
+
int bytes = Int_val(_bytes);
|
|
251
|
+
int offset = Int_val(_offset);
|
|
252
|
+
int align = Int_val(_align);
|
|
253
|
+
BinaryenExpressionRef ptr = BinaryenExpressionRef_val(_ptr);
|
|
254
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_val);
|
|
255
|
+
BinaryenType ty = BinaryenType_val(_ty);
|
|
256
|
+
BinaryenExpressionRef exp = BinaryenStore(module, bytes, offset, align, ptr, val, ty);
|
|
257
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
258
|
+
}
|
|
259
|
+
CAMLprim value
|
|
260
|
+
caml_binaryen_store__bytecode(value * argv) {
|
|
261
|
+
return caml_binaryen_store(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
CAMLprim value
|
|
265
|
+
caml_binaryen_const(value _module, value _lit) {
|
|
266
|
+
CAMLparam2(_module, _lit);
|
|
267
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
268
|
+
struct BinaryenLiteral lit = BinaryenLiteral_val(_lit);
|
|
269
|
+
BinaryenExpressionRef exp = BinaryenConst(module, lit);
|
|
270
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
CAMLprim value
|
|
274
|
+
caml_binaryen_unary(value _module, value _op, value _p) {
|
|
275
|
+
CAMLparam3(_module, _op, _p);
|
|
276
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
277
|
+
BinaryenOp op = BinaryenOp_val(_op);
|
|
278
|
+
BinaryenExpressionRef p = BinaryenExpressionRef_val(_p);
|
|
279
|
+
BinaryenExpressionRef exp = BinaryenUnary(module, op, p);
|
|
280
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
CAMLprim value
|
|
284
|
+
caml_binaryen_binary(value _module, value _op, value _p1, value _p2) {
|
|
285
|
+
CAMLparam4(_module, _op, _p1, _p2);
|
|
286
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
287
|
+
BinaryenOp op = BinaryenOp_val(_op);
|
|
288
|
+
BinaryenExpressionRef p1 = BinaryenExpressionRef_val(_p1);
|
|
289
|
+
BinaryenExpressionRef p2 = BinaryenExpressionRef_val(_p2);
|
|
290
|
+
BinaryenExpressionRef exp = BinaryenBinary(module, op, p1, p2);
|
|
291
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
CAMLprim value
|
|
295
|
+
caml_binaryen_select(value _module, value _cond, value _tru, value _fals, value _ty) {
|
|
296
|
+
CAMLparam5(_module, _cond, _tru, _fals, _ty);
|
|
297
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
298
|
+
BinaryenExpressionRef cond = BinaryenExpressionRef_val(_cond);
|
|
299
|
+
BinaryenExpressionRef tru = BinaryenExpressionRef_val(_tru);
|
|
300
|
+
BinaryenExpressionRef fals = BinaryenExpressionRef_val(_fals);
|
|
301
|
+
BinaryenType ty = BinaryenType_val(_ty);
|
|
302
|
+
BinaryenExpressionRef exp = BinaryenSelect(module, cond, tru, fals, ty);
|
|
303
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
CAMLprim value
|
|
307
|
+
caml_binaryen_drop(value _module, value _p1) {
|
|
308
|
+
CAMLparam2(_module, _p1);
|
|
309
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
310
|
+
BinaryenExpressionRef p1 = BinaryenExpressionRef_val(_p1);
|
|
311
|
+
BinaryenExpressionRef exp = BinaryenDrop(module, p1);
|
|
312
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
CAMLprim value
|
|
316
|
+
caml_binaryen_return(value _module, value _p1) {
|
|
317
|
+
CAMLparam2(_module, _p1);
|
|
318
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
319
|
+
BinaryenExpressionRef p1 = BinaryenExpressionRef_val(_p1);
|
|
320
|
+
BinaryenExpressionRef exp = BinaryenReturn(module, p1);
|
|
321
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
CAMLprim value
|
|
325
|
+
caml_binaryen_memory_size(value _module) {
|
|
326
|
+
CAMLparam1(_module);
|
|
327
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
328
|
+
BinaryenExpressionRef exp = BinaryenMemorySize(module);
|
|
329
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
CAMLprim value
|
|
333
|
+
caml_binaryen_memory_grow(value _module, value _p1) {
|
|
334
|
+
CAMLparam2(_module, _p1);
|
|
335
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
336
|
+
BinaryenExpressionRef p1 = BinaryenExpressionRef_val(_p1);
|
|
337
|
+
BinaryenExpressionRef exp = BinaryenMemoryGrow(module, p1);
|
|
338
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
CAMLprim value
|
|
342
|
+
caml_binaryen_nop(value _module) {
|
|
343
|
+
CAMLparam1(_module);
|
|
344
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
345
|
+
BinaryenExpressionRef exp = BinaryenNop(module);
|
|
346
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
CAMLprim value
|
|
350
|
+
caml_binaryen_unreachable(value _module) {
|
|
351
|
+
CAMLparam1(_module);
|
|
352
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
353
|
+
BinaryenExpressionRef exp = BinaryenUnreachable(module);
|
|
354
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
CAMLprim value
|
|
358
|
+
caml_binaryen_memory_copy(value _module, value _dest, value _source, value _size) {
|
|
359
|
+
CAMLparam4(_module, _dest, _source, _size);
|
|
360
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
361
|
+
BinaryenExpressionRef dest = BinaryenExpressionRef_val(_dest);
|
|
362
|
+
BinaryenExpressionRef source = BinaryenExpressionRef_val(_source);
|
|
363
|
+
BinaryenExpressionRef size = BinaryenExpressionRef_val(_size);
|
|
364
|
+
BinaryenExpressionRef exp = BinaryenMemoryCopy(module, dest, source, size);
|
|
365
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
CAMLprim value
|
|
369
|
+
caml_binaryen_memory_fill(value _module, value _dest, value _val, value _size) {
|
|
370
|
+
CAMLparam4(_module, _dest, _val, _size);
|
|
371
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
372
|
+
BinaryenExpressionRef dest = BinaryenExpressionRef_val(_dest);
|
|
373
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_val);
|
|
374
|
+
BinaryenExpressionRef size = BinaryenExpressionRef_val(_size);
|
|
375
|
+
BinaryenExpressionRef exp = BinaryenMemoryFill(module, dest, val, size);
|
|
376
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
CAMLprim value
|
|
380
|
+
caml_binaryen_tuple_make(value _module, value _operands) {
|
|
381
|
+
CAMLparam2(_module, _operands);
|
|
382
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
383
|
+
_operands = array_of_list(_operands);
|
|
384
|
+
int operandsLen = array_length(_operands);
|
|
385
|
+
BinaryenExpressionRef operands[operandsLen];
|
|
386
|
+
for (int i = 0; i < operandsLen; i++) {
|
|
387
|
+
operands[i] = BinaryenExpressionRef_val(Field(_operands, i));
|
|
388
|
+
}
|
|
389
|
+
BinaryenExpressionRef exp = BinaryenTupleMake(module, operands, operandsLen);
|
|
390
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
CAMLprim value
|
|
394
|
+
caml_binaryen_tuple_extract(value _module, value _tuple, value _index) {
|
|
395
|
+
CAMLparam3(_module, _tuple, _index);
|
|
396
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
397
|
+
BinaryenExpressionRef tuple = BinaryenExpressionRef_val(_tuple);
|
|
398
|
+
int index = Int_val(_index);
|
|
399
|
+
BinaryenExpressionRef exp = BinaryenTupleExtract(module, tuple, index);
|
|
400
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
CAMLprim value
|
|
404
|
+
caml_binaryen_pop(value _module, value _ty) {
|
|
405
|
+
CAMLparam2(_module, _ty);
|
|
406
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
407
|
+
BinaryenType ty = BinaryenType_val(_ty);
|
|
408
|
+
BinaryenExpressionRef exp = BinaryenPop(module, ty);
|
|
409
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
CAMLprim value
|
|
413
|
+
caml_binaryen_expression_id_invalid(value unit) {
|
|
414
|
+
CAMLparam1(unit);
|
|
415
|
+
CAMLreturn(Val_int(BinaryenInvalidId()));
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
CAMLprim value
|
|
419
|
+
caml_binaryen_expression_id_nop(value unit) {
|
|
420
|
+
CAMLparam1(unit);
|
|
421
|
+
CAMLreturn(Val_int(BinaryenNopId()));
|
|
422
|
+
}
|
|
423
|
+
CAMLprim value
|
|
424
|
+
caml_binaryen_expression_id_block(value unit) {
|
|
425
|
+
CAMLparam1(unit);
|
|
426
|
+
CAMLreturn(Val_int(BinaryenBlockId()));
|
|
427
|
+
}
|
|
428
|
+
CAMLprim value
|
|
429
|
+
caml_binaryen_expression_id_if(value unit) {
|
|
430
|
+
CAMLparam1(unit);
|
|
431
|
+
CAMLreturn(Val_int(BinaryenIfId()));
|
|
432
|
+
}
|
|
433
|
+
CAMLprim value
|
|
434
|
+
caml_binaryen_expression_id_loop(value unit) {
|
|
435
|
+
CAMLparam1(unit);
|
|
436
|
+
CAMLreturn(Val_int(BinaryenLoopId()));
|
|
437
|
+
}
|
|
438
|
+
CAMLprim value
|
|
439
|
+
caml_binaryen_expression_id_break(value unit) {
|
|
440
|
+
CAMLparam1(unit);
|
|
441
|
+
CAMLreturn(Val_int(BinaryenBreakId()));
|
|
442
|
+
}
|
|
443
|
+
CAMLprim value
|
|
444
|
+
caml_binaryen_expression_id_switch(value unit) {
|
|
445
|
+
CAMLparam1(unit);
|
|
446
|
+
CAMLreturn(Val_int(BinaryenSwitchId()));
|
|
447
|
+
}
|
|
448
|
+
CAMLprim value
|
|
449
|
+
caml_binaryen_expression_id_call(value unit) {
|
|
450
|
+
CAMLparam1(unit);
|
|
451
|
+
CAMLreturn(Val_int(BinaryenCallId()));
|
|
452
|
+
}
|
|
453
|
+
CAMLprim value
|
|
454
|
+
caml_binaryen_expression_id_call_indirect(value unit) {
|
|
455
|
+
CAMLparam1(unit);
|
|
456
|
+
CAMLreturn(Val_int(BinaryenCallIndirectId()));
|
|
457
|
+
}
|
|
458
|
+
CAMLprim value
|
|
459
|
+
caml_binaryen_expression_id_local_get(value unit) {
|
|
460
|
+
CAMLparam1(unit);
|
|
461
|
+
CAMLreturn(Val_int(BinaryenLocalGetId()));
|
|
462
|
+
}
|
|
463
|
+
CAMLprim value
|
|
464
|
+
caml_binaryen_expression_id_local_set(value unit) {
|
|
465
|
+
CAMLparam1(unit);
|
|
466
|
+
CAMLreturn(Val_int(BinaryenLocalSetId()));
|
|
467
|
+
}
|
|
468
|
+
CAMLprim value
|
|
469
|
+
caml_binaryen_expression_id_global_get(value unit) {
|
|
470
|
+
CAMLparam1(unit);
|
|
471
|
+
CAMLreturn(Val_int(BinaryenGlobalGetId()));
|
|
472
|
+
}
|
|
473
|
+
CAMLprim value
|
|
474
|
+
caml_binaryen_expression_id_global_set(value unit) {
|
|
475
|
+
CAMLparam1(unit);
|
|
476
|
+
CAMLreturn(Val_int(BinaryenGlobalSetId()));
|
|
477
|
+
}
|
|
478
|
+
CAMLprim value
|
|
479
|
+
caml_binaryen_expression_id_load(value unit) {
|
|
480
|
+
CAMLparam1(unit);
|
|
481
|
+
CAMLreturn(Val_int(BinaryenLoadId()));
|
|
482
|
+
}
|
|
483
|
+
CAMLprim value
|
|
484
|
+
caml_binaryen_expression_id_store(value unit) {
|
|
485
|
+
CAMLparam1(unit);
|
|
486
|
+
CAMLreturn(Val_int(BinaryenStoreId()));
|
|
487
|
+
}
|
|
488
|
+
CAMLprim value
|
|
489
|
+
caml_binaryen_expression_id_atomic_rmw(value unit) {
|
|
490
|
+
CAMLparam1(unit);
|
|
491
|
+
CAMLreturn(Val_int(BinaryenAtomicRMWId()));
|
|
492
|
+
}
|
|
493
|
+
CAMLprim value
|
|
494
|
+
caml_binaryen_expression_id_atomic_cmpxchg(value unit) {
|
|
495
|
+
CAMLparam1(unit);
|
|
496
|
+
CAMLreturn(Val_int(BinaryenAtomicCmpxchgId()));
|
|
497
|
+
}
|
|
498
|
+
CAMLprim value
|
|
499
|
+
caml_binaryen_expression_id_atomic_wait(value unit) {
|
|
500
|
+
CAMLparam1(unit);
|
|
501
|
+
CAMLreturn(Val_int(BinaryenAtomicWaitId()));
|
|
502
|
+
}
|
|
503
|
+
CAMLprim value
|
|
504
|
+
caml_binaryen_expression_id_atomic_notify(value unit) {
|
|
505
|
+
CAMLparam1(unit);
|
|
506
|
+
CAMLreturn(Val_int(BinaryenAtomicNotifyId()));
|
|
507
|
+
}
|
|
508
|
+
CAMLprim value
|
|
509
|
+
caml_binaryen_expression_id_atomic_fence(value unit) {
|
|
510
|
+
CAMLparam1(unit);
|
|
511
|
+
CAMLreturn(Val_int(BinaryenAtomicFenceId()));
|
|
512
|
+
}
|
|
513
|
+
CAMLprim value
|
|
514
|
+
caml_binaryen_expression_id_simd_extract(value unit) {
|
|
515
|
+
CAMLparam1(unit);
|
|
516
|
+
CAMLreturn(Val_int(BinaryenSIMDExtractId()));
|
|
517
|
+
}
|
|
518
|
+
CAMLprim value
|
|
519
|
+
caml_binaryen_expression_id_simd_replace(value unit) {
|
|
520
|
+
CAMLparam1(unit);
|
|
521
|
+
CAMLreturn(Val_int(BinaryenSIMDReplaceId()));
|
|
522
|
+
}
|
|
523
|
+
CAMLprim value
|
|
524
|
+
caml_binaryen_expression_id_simd_shuffle(value unit) {
|
|
525
|
+
CAMLparam1(unit);
|
|
526
|
+
CAMLreturn(Val_int(BinaryenSIMDShuffleId()));
|
|
527
|
+
}
|
|
528
|
+
CAMLprim value
|
|
529
|
+
caml_binaryen_expression_id_simd_ternary(value unit) {
|
|
530
|
+
CAMLparam1(unit);
|
|
531
|
+
CAMLreturn(Val_int(BinaryenSIMDTernaryId()));
|
|
532
|
+
}
|
|
533
|
+
CAMLprim value
|
|
534
|
+
caml_binaryen_expression_id_simd_shift(value unit) {
|
|
535
|
+
CAMLparam1(unit);
|
|
536
|
+
CAMLreturn(Val_int(BinaryenSIMDShiftId()));
|
|
537
|
+
}
|
|
538
|
+
CAMLprim value
|
|
539
|
+
caml_binaryen_expression_id_simd_load(value unit) {
|
|
540
|
+
CAMLparam1(unit);
|
|
541
|
+
CAMLreturn(Val_int(BinaryenSIMDLoadId()));
|
|
542
|
+
}
|
|
543
|
+
CAMLprim value
|
|
544
|
+
caml_binaryen_expression_id_simd_load_store_lane(value unit) {
|
|
545
|
+
CAMLparam1(unit);
|
|
546
|
+
CAMLreturn(Val_int(BinaryenSIMDLoadStoreLaneId()));
|
|
547
|
+
}
|
|
548
|
+
CAMLprim value
|
|
549
|
+
caml_binaryen_expression_id_memory_init(value unit) {
|
|
550
|
+
CAMLparam1(unit);
|
|
551
|
+
CAMLreturn(Val_int(BinaryenMemoryInitId()));
|
|
552
|
+
}
|
|
553
|
+
CAMLprim value
|
|
554
|
+
caml_binaryen_expression_id_data_drop(value unit) {
|
|
555
|
+
CAMLparam1(unit);
|
|
556
|
+
CAMLreturn(Val_int(BinaryenDataDropId()));
|
|
557
|
+
}
|
|
558
|
+
CAMLprim value
|
|
559
|
+
caml_binaryen_expression_id_memory_copy(value unit) {
|
|
560
|
+
CAMLparam1(unit);
|
|
561
|
+
CAMLreturn(Val_int(BinaryenMemoryCopyId()));
|
|
562
|
+
}
|
|
563
|
+
CAMLprim value
|
|
564
|
+
caml_binaryen_expression_id_memory_fill(value unit) {
|
|
565
|
+
CAMLparam1(unit);
|
|
566
|
+
CAMLreturn(Val_int(BinaryenMemoryFillId()));
|
|
567
|
+
}
|
|
568
|
+
CAMLprim value
|
|
569
|
+
caml_binaryen_expression_id_const(value unit) {
|
|
570
|
+
CAMLparam1(unit);
|
|
571
|
+
CAMLreturn(Val_int(BinaryenConstId()));
|
|
572
|
+
}
|
|
573
|
+
CAMLprim value
|
|
574
|
+
caml_binaryen_expression_id_unary(value unit) {
|
|
575
|
+
CAMLparam1(unit);
|
|
576
|
+
CAMLreturn(Val_int(BinaryenUnaryId()));
|
|
577
|
+
}
|
|
578
|
+
CAMLprim value
|
|
579
|
+
caml_binaryen_expression_id_binary(value unit) {
|
|
580
|
+
CAMLparam1(unit);
|
|
581
|
+
CAMLreturn(Val_int(BinaryenBinaryId()));
|
|
582
|
+
}
|
|
583
|
+
CAMLprim value
|
|
584
|
+
caml_binaryen_expression_id_select(value unit) {
|
|
585
|
+
CAMLparam1(unit);
|
|
586
|
+
CAMLreturn(Val_int(BinaryenSelectId()));
|
|
587
|
+
}
|
|
588
|
+
CAMLprim value
|
|
589
|
+
caml_binaryen_expression_id_drop(value unit) {
|
|
590
|
+
CAMLparam1(unit);
|
|
591
|
+
CAMLreturn(Val_int(BinaryenDropId()));
|
|
592
|
+
}
|
|
593
|
+
CAMLprim value
|
|
594
|
+
caml_binaryen_expression_id_return(value unit) {
|
|
595
|
+
CAMLparam1(unit);
|
|
596
|
+
CAMLreturn(Val_int(BinaryenReturnId()));
|
|
597
|
+
}
|
|
598
|
+
CAMLprim value
|
|
599
|
+
caml_binaryen_expression_id_memory_size(value unit) {
|
|
600
|
+
CAMLparam1(unit);
|
|
601
|
+
CAMLreturn(Val_int(BinaryenMemorySizeId()));
|
|
602
|
+
}
|
|
603
|
+
CAMLprim value
|
|
604
|
+
caml_binaryen_expression_id_memory_grow(value unit) {
|
|
605
|
+
CAMLparam1(unit);
|
|
606
|
+
CAMLreturn(Val_int(BinaryenMemoryGrowId()));
|
|
607
|
+
}
|
|
608
|
+
CAMLprim value
|
|
609
|
+
caml_binaryen_expression_id_unreachable(value unit) {
|
|
610
|
+
CAMLparam1(unit);
|
|
611
|
+
CAMLreturn(Val_int(BinaryenUnreachableId()));
|
|
612
|
+
}
|
|
613
|
+
CAMLprim value
|
|
614
|
+
caml_binaryen_expression_id_pop(value unit) {
|
|
615
|
+
CAMLparam1(unit);
|
|
616
|
+
CAMLreturn(Val_int(BinaryenPopId()));
|
|
617
|
+
}
|
|
618
|
+
CAMLprim value
|
|
619
|
+
caml_binaryen_expression_id_ref_null(value unit) {
|
|
620
|
+
CAMLparam1(unit);
|
|
621
|
+
CAMLreturn(Val_int(BinaryenRefNullId()));
|
|
622
|
+
}
|
|
623
|
+
CAMLprim value
|
|
624
|
+
caml_binaryen_expression_id_ref_is(value unit) {
|
|
625
|
+
CAMLparam1(unit);
|
|
626
|
+
CAMLreturn(Val_int(BinaryenRefIsId()));
|
|
627
|
+
}
|
|
628
|
+
CAMLprim value
|
|
629
|
+
caml_binaryen_expression_id_ref_as(value unit) {
|
|
630
|
+
CAMLparam1(unit);
|
|
631
|
+
CAMLreturn(Val_int(BinaryenRefAsId()));
|
|
632
|
+
}
|
|
633
|
+
CAMLprim value
|
|
634
|
+
caml_binaryen_expression_id_ref_func(value unit) {
|
|
635
|
+
CAMLparam1(unit);
|
|
636
|
+
CAMLreturn(Val_int(BinaryenRefFuncId()));
|
|
637
|
+
}
|
|
638
|
+
CAMLprim value
|
|
639
|
+
caml_binaryen_expression_id_ref_eq(value unit) {
|
|
640
|
+
CAMLparam1(unit);
|
|
641
|
+
CAMLreturn(Val_int(BinaryenRefEqId()));
|
|
642
|
+
}
|
|
643
|
+
CAMLprim value
|
|
644
|
+
caml_binaryen_expression_id_try(value unit) {
|
|
645
|
+
CAMLparam1(unit);
|
|
646
|
+
CAMLreturn(Val_int(BinaryenTryId()));
|
|
647
|
+
}
|
|
648
|
+
CAMLprim value
|
|
649
|
+
caml_binaryen_expression_id_throw(value unit) {
|
|
650
|
+
CAMLparam1(unit);
|
|
651
|
+
CAMLreturn(Val_int(BinaryenThrowId()));
|
|
652
|
+
}
|
|
653
|
+
CAMLprim value
|
|
654
|
+
caml_binaryen_expression_id_rethrow(value unit) {
|
|
655
|
+
CAMLparam1(unit);
|
|
656
|
+
CAMLreturn(Val_int(BinaryenRethrowId()));
|
|
657
|
+
}
|
|
658
|
+
CAMLprim value
|
|
659
|
+
caml_binaryen_expression_id_tuple_make(value unit) {
|
|
660
|
+
CAMLparam1(unit);
|
|
661
|
+
CAMLreturn(Val_int(BinaryenTupleMakeId()));
|
|
662
|
+
}
|
|
663
|
+
CAMLprim value
|
|
664
|
+
caml_binaryen_expression_id_tuple_extract(value unit) {
|
|
665
|
+
CAMLparam1(unit);
|
|
666
|
+
CAMLreturn(Val_int(BinaryenTupleExtractId()));
|
|
667
|
+
}
|
|
668
|
+
CAMLprim value
|
|
669
|
+
caml_binaryen_expression_id_i31_new(value unit) {
|
|
670
|
+
CAMLparam1(unit);
|
|
671
|
+
CAMLreturn(Val_int(BinaryenI31NewId()));
|
|
672
|
+
}
|
|
673
|
+
CAMLprim value
|
|
674
|
+
caml_binaryen_expression_id_i31_get(value unit) {
|
|
675
|
+
CAMLparam1(unit);
|
|
676
|
+
CAMLreturn(Val_int(BinaryenI31GetId()));
|
|
677
|
+
}
|
|
678
|
+
CAMLprim value
|
|
679
|
+
caml_binaryen_expression_id_call_ref(value unit) {
|
|
680
|
+
CAMLparam1(unit);
|
|
681
|
+
CAMLreturn(Val_int(BinaryenCallRefId()));
|
|
682
|
+
}
|
|
683
|
+
CAMLprim value
|
|
684
|
+
caml_binaryen_expression_id_ref_test(value unit) {
|
|
685
|
+
CAMLparam1(unit);
|
|
686
|
+
CAMLreturn(Val_int(BinaryenRefTestId()));
|
|
687
|
+
}
|
|
688
|
+
CAMLprim value
|
|
689
|
+
caml_binaryen_expression_id_ref_cast(value unit) {
|
|
690
|
+
CAMLparam1(unit);
|
|
691
|
+
CAMLreturn(Val_int(BinaryenRefCastId()));
|
|
692
|
+
}
|
|
693
|
+
CAMLprim value
|
|
694
|
+
caml_binaryen_expression_id_br_on(value unit) {
|
|
695
|
+
CAMLparam1(unit);
|
|
696
|
+
CAMLreturn(Val_int(BinaryenBrOnId()));
|
|
697
|
+
}
|
|
698
|
+
CAMLprim value
|
|
699
|
+
caml_binaryen_expression_id_rtt_canon(value unit) {
|
|
700
|
+
CAMLparam1(unit);
|
|
701
|
+
CAMLreturn(Val_int(BinaryenRttCanonId()));
|
|
702
|
+
}
|
|
703
|
+
CAMLprim value
|
|
704
|
+
caml_binaryen_expression_id_rtt_sub(value unit) {
|
|
705
|
+
CAMLparam1(unit);
|
|
706
|
+
CAMLreturn(Val_int(BinaryenRttSubId()));
|
|
707
|
+
}
|
|
708
|
+
CAMLprim value
|
|
709
|
+
caml_binaryen_expression_id_struct_new(value unit) {
|
|
710
|
+
CAMLparam1(unit);
|
|
711
|
+
CAMLreturn(Val_int(BinaryenStructNewId()));
|
|
712
|
+
}
|
|
713
|
+
CAMLprim value
|
|
714
|
+
caml_binaryen_expression_id_struct_get(value unit) {
|
|
715
|
+
CAMLparam1(unit);
|
|
716
|
+
CAMLreturn(Val_int(BinaryenStructGetId()));
|
|
717
|
+
}
|
|
718
|
+
CAMLprim value
|
|
719
|
+
caml_binaryen_expression_id_struct_set(value unit) {
|
|
720
|
+
CAMLparam1(unit);
|
|
721
|
+
CAMLreturn(Val_int(BinaryenStructSetId()));
|
|
722
|
+
}
|
|
723
|
+
CAMLprim value
|
|
724
|
+
caml_binaryen_expression_id_array_new(value unit) {
|
|
725
|
+
CAMLparam1(unit);
|
|
726
|
+
CAMLreturn(Val_int(BinaryenArrayNewId()));
|
|
727
|
+
}
|
|
728
|
+
CAMLprim value
|
|
729
|
+
caml_binaryen_expression_id_array_get(value unit) {
|
|
730
|
+
CAMLparam1(unit);
|
|
731
|
+
CAMLreturn(Val_int(BinaryenArrayGetId()));
|
|
732
|
+
}
|
|
733
|
+
CAMLprim value
|
|
734
|
+
caml_binaryen_expression_id_array_set(value unit) {
|
|
735
|
+
CAMLparam1(unit);
|
|
736
|
+
CAMLreturn(Val_int(BinaryenArraySetId()));
|
|
737
|
+
}
|
|
738
|
+
CAMLprim value
|
|
739
|
+
caml_binaryen_expression_id_array_len(value unit) {
|
|
740
|
+
CAMLparam1(unit);
|
|
741
|
+
CAMLreturn(Val_int(BinaryenArrayLenId()));
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
// Expression operations
|
|
745
|
+
|
|
746
|
+
CAMLprim value
|
|
747
|
+
caml_binaryen_expression_print(value _exp) {
|
|
748
|
+
CAMLparam1(_exp);
|
|
749
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
750
|
+
BinaryenExpressionPrint(exp);
|
|
751
|
+
CAMLreturn(Val_unit);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
CAMLprim value
|
|
755
|
+
caml_binaryen_expression_finalize(value _exp) {
|
|
756
|
+
CAMLparam1(_exp);
|
|
757
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
758
|
+
BinaryenExpressionFinalize(exp);
|
|
759
|
+
CAMLreturn(Val_unit);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
CAMLprim value
|
|
763
|
+
caml_binaryen_expression_copy(value _exp, value _module) {
|
|
764
|
+
CAMLparam1(_exp);
|
|
765
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
766
|
+
BinaryenExpressionRef exp = BinaryenExpressionCopy(BinaryenExpressionRef_val(_exp), module);
|
|
767
|
+
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// Block operations
|
|
771
|
+
|
|
772
|
+
CAMLprim value
|
|
773
|
+
caml_binaryen_block_get_name(value _exp) {
|
|
774
|
+
CAMLparam1(_exp);
|
|
775
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
776
|
+
const char* name = BinaryenBlockGetName(exp);
|
|
777
|
+
if (name == NULL) {
|
|
778
|
+
CAMLreturn(Val_none);
|
|
779
|
+
} else {
|
|
780
|
+
CAMLreturn(caml_alloc_some(caml_copy_string(name)));
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
CAMLprim value
|
|
785
|
+
caml_binaryen_block_set_name(value _exp, value _name) {
|
|
786
|
+
CAMLparam2(_exp, _name);
|
|
787
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
788
|
+
char* name = Safe_String_val(_name);
|
|
789
|
+
BinaryenBlockSetName(exp, name);
|
|
790
|
+
CAMLreturn(Val_unit);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
CAMLprim value
|
|
794
|
+
caml_binaryen_block_get_num_children(value _exp) {
|
|
795
|
+
CAMLparam1(_exp);
|
|
796
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
797
|
+
CAMLreturn(Val_int(BinaryenBlockGetNumChildren(exp)));
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
CAMLprim value
|
|
801
|
+
caml_binaryen_block_get_child_at(value _exp, value _index) {
|
|
802
|
+
CAMLparam2(_exp, _index);
|
|
803
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
804
|
+
BinaryenIndex index = Int_val(_index);
|
|
805
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenBlockGetChildAt(exp, index)));
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
CAMLprim value
|
|
809
|
+
caml_binaryen_block_set_child_at(value _exp, value _index, value _child) {
|
|
810
|
+
CAMLparam3(_exp, _index, _child);
|
|
811
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
812
|
+
BinaryenIndex index = Int_val(_index);
|
|
813
|
+
BinaryenExpressionRef child = BinaryenExpressionRef_val(_child);
|
|
814
|
+
BinaryenBlockSetChildAt(exp, index, child);
|
|
815
|
+
CAMLreturn(Val_unit);
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
CAMLprim value
|
|
819
|
+
caml_binaryen_block_append_child(value _exp, value _child) {
|
|
820
|
+
CAMLparam2(_exp, _child);
|
|
821
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
822
|
+
BinaryenExpressionRef child = BinaryenExpressionRef_val(_child);
|
|
823
|
+
CAMLreturn(Val_int(BinaryenBlockAppendChild(exp, child)));
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
CAMLprim value
|
|
827
|
+
caml_binaryen_block_insert_child_at(value _exp, value _index, value _child) {
|
|
828
|
+
CAMLparam3(_exp, _index, _child);
|
|
829
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
830
|
+
BinaryenIndex index = Int_val(_index);
|
|
831
|
+
BinaryenExpressionRef child = BinaryenExpressionRef_val(_child);
|
|
832
|
+
BinaryenBlockInsertChildAt(exp, index, child);
|
|
833
|
+
CAMLreturn(Val_unit);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
CAMLprim value
|
|
837
|
+
caml_binaryen_block_remove_child_at(value _exp, value _index) {
|
|
838
|
+
CAMLparam2(_exp, _index);
|
|
839
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
840
|
+
BinaryenIndex index = Int_val(_index);
|
|
841
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenBlockRemoveChildAt(exp, index)));
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
// If operations
|
|
845
|
+
|
|
846
|
+
CAMLprim value
|
|
847
|
+
caml_binaryen_if_get_condition(value _exp) {
|
|
848
|
+
CAMLparam1(_exp);
|
|
849
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
850
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenIfGetCondition(exp)));
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
CAMLprim value
|
|
854
|
+
caml_binaryen_if_set_condition(value _exp, value _cond) {
|
|
855
|
+
CAMLparam2(_exp, _cond);
|
|
856
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
857
|
+
BinaryenExpressionRef cond = BinaryenExpressionRef_val(_cond);
|
|
858
|
+
BinaryenIfSetCondition(exp, cond);
|
|
859
|
+
CAMLreturn(Val_unit);
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
CAMLprim value
|
|
863
|
+
caml_binaryen_if_get_if_true(value _exp) {
|
|
864
|
+
CAMLparam1(_exp);
|
|
865
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
866
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenIfGetIfTrue(exp)));
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
CAMLprim value
|
|
870
|
+
caml_binaryen_if_set_if_true(value _exp, value _child) {
|
|
871
|
+
CAMLparam2(_exp, _child);
|
|
872
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
873
|
+
BinaryenExpressionRef child = BinaryenExpressionRef_val(_child);
|
|
874
|
+
BinaryenIfSetIfTrue(exp, child);
|
|
875
|
+
CAMLreturn(Val_unit);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
CAMLprim value
|
|
879
|
+
caml_binaryen_if_get_if_false(value _exp) {
|
|
880
|
+
CAMLparam1(_exp);
|
|
881
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
882
|
+
BinaryenExpressionRef ifFalse = BinaryenIfGetIfFalse(exp);
|
|
883
|
+
if (ifFalse == NULL) {
|
|
884
|
+
CAMLreturn(Val_none);
|
|
885
|
+
} else {
|
|
886
|
+
CAMLreturn(caml_alloc_some(alloc_BinaryenExpressionRef(ifFalse)));
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
CAMLprim value
|
|
891
|
+
caml_binaryen_if_set_if_false(value _exp, value _child) {
|
|
892
|
+
CAMLparam2(_exp, _child);
|
|
893
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
894
|
+
BinaryenExpressionRef child = BinaryenExpressionRef_val(_child);
|
|
895
|
+
BinaryenIfSetIfFalse(exp, child);
|
|
896
|
+
CAMLreturn(Val_unit);
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
// Loop operations
|
|
900
|
+
|
|
901
|
+
CAMLprim value
|
|
902
|
+
caml_binaryen_loop_get_name(value _exp) {
|
|
903
|
+
CAMLparam1(_exp);
|
|
904
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
905
|
+
const char* name = BinaryenLoopGetName(exp);
|
|
906
|
+
CAMLreturn(caml_copy_string(name));
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
CAMLprim value
|
|
910
|
+
caml_binaryen_loop_set_name(value _exp, value _name) {
|
|
911
|
+
CAMLparam2(_exp, _name);
|
|
912
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
913
|
+
char* name = Safe_String_val(_name);
|
|
914
|
+
BinaryenLoopSetName(exp, name);
|
|
915
|
+
CAMLreturn(Val_unit);
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
CAMLprim value
|
|
919
|
+
caml_binaryen_loop_get_body(value _exp) {
|
|
920
|
+
CAMLparam1(_exp);
|
|
921
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
922
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenLoopGetBody(exp)));
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
CAMLprim value
|
|
926
|
+
caml_binaryen_loop_set_body(value _exp, value _child) {
|
|
927
|
+
CAMLparam2(_exp, _child);
|
|
928
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
929
|
+
BinaryenExpressionRef child = BinaryenExpressionRef_val(_child);
|
|
930
|
+
BinaryenLoopSetBody(exp, child);
|
|
931
|
+
CAMLreturn(Val_unit);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
// Break operations
|
|
935
|
+
|
|
936
|
+
CAMLprim value
|
|
937
|
+
caml_binaryen_break_get_name(value _exp) {
|
|
938
|
+
CAMLparam1(_exp);
|
|
939
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
940
|
+
const char* name = BinaryenBreakGetName(exp);
|
|
941
|
+
CAMLreturn(caml_copy_string(name));
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
CAMLprim value
|
|
945
|
+
caml_binaryen_break_set_name(value _exp, value _name) {
|
|
946
|
+
CAMLparam2(_exp, _name);
|
|
947
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
948
|
+
char* name = Safe_String_val(_name);
|
|
949
|
+
BinaryenBreakSetName(exp, name);
|
|
950
|
+
CAMLreturn(Val_unit);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
CAMLprim value
|
|
954
|
+
caml_binaryen_break_get_condition(value _exp) {
|
|
955
|
+
CAMLparam1(_exp);
|
|
956
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
957
|
+
BinaryenExpressionRef cond = BinaryenBreakGetCondition(exp);
|
|
958
|
+
if (cond == NULL) {
|
|
959
|
+
CAMLreturn(Val_none);
|
|
960
|
+
} else {
|
|
961
|
+
CAMLreturn(caml_alloc_some(alloc_BinaryenExpressionRef(cond)));
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
CAMLprim value
|
|
966
|
+
caml_binaryen_break_set_condition(value _exp, value _child) {
|
|
967
|
+
CAMLparam2(_exp, _child);
|
|
968
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
969
|
+
BinaryenExpressionRef child = BinaryenExpressionRef_val(_child);
|
|
970
|
+
BinaryenBreakSetCondition(exp, child);
|
|
971
|
+
CAMLreturn(Val_unit);
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
CAMLprim value
|
|
975
|
+
caml_binaryen_break_get_value(value _exp) {
|
|
976
|
+
CAMLparam1(_exp);
|
|
977
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
978
|
+
BinaryenExpressionRef val = BinaryenBreakGetValue(exp);
|
|
979
|
+
if (val == NULL) {
|
|
980
|
+
CAMLreturn(Val_none);
|
|
981
|
+
} else {
|
|
982
|
+
CAMLreturn(caml_alloc_some(alloc_BinaryenExpressionRef(val)));
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
CAMLprim value
|
|
987
|
+
caml_binaryen_break_set_value(value _exp, value _child) {
|
|
988
|
+
CAMLparam2(_exp, _child);
|
|
989
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
990
|
+
BinaryenExpressionRef child = BinaryenExpressionRef_val(_child);
|
|
991
|
+
BinaryenBreakSetValue(exp, child);
|
|
992
|
+
CAMLreturn(Val_unit);
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
// Switch operations
|
|
996
|
+
|
|
997
|
+
CAMLprim value
|
|
998
|
+
caml_binaryen_switch_get_num_names(value _exp) {
|
|
999
|
+
CAMLparam1(_exp);
|
|
1000
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1001
|
+
CAMLreturn(Val_int(BinaryenSwitchGetNumNames(exp)));
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
CAMLprim value
|
|
1005
|
+
caml_binaryen_switch_get_name_at(value _exp, value _index) {
|
|
1006
|
+
CAMLparam2(_exp, _index);
|
|
1007
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1008
|
+
BinaryenIndex index = Int_val(_index);
|
|
1009
|
+
const char* name = BinaryenSwitchGetNameAt(exp, index);
|
|
1010
|
+
CAMLreturn(caml_copy_string(name));
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
CAMLprim value
|
|
1014
|
+
caml_binaryen_switch_set_name_at(value _exp, value _index, value _name) {
|
|
1015
|
+
CAMLparam3(_exp, _index, _name);
|
|
1016
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1017
|
+
BinaryenIndex index = Int_val(_index);
|
|
1018
|
+
char* name = Safe_String_val(_name);
|
|
1019
|
+
BinaryenSwitchSetNameAt(exp, index, name);
|
|
1020
|
+
CAMLreturn(Val_unit);
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
CAMLprim value
|
|
1024
|
+
caml_binaryen_switch_append_name(value _exp, value _name) {
|
|
1025
|
+
CAMLparam2(_exp, _name);
|
|
1026
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1027
|
+
char* name = Safe_String_val(_name);
|
|
1028
|
+
CAMLreturn(Val_int(BinaryenSwitchAppendName(exp, name)));
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
CAMLprim value
|
|
1032
|
+
caml_binaryen_switch_insert_name_at(value _exp, value _index, value _name) {
|
|
1033
|
+
CAMLparam3(_exp, _index, _name);
|
|
1034
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1035
|
+
BinaryenIndex index = Int_val(_index);
|
|
1036
|
+
char* name = Safe_String_val(_name);
|
|
1037
|
+
BinaryenSwitchInsertNameAt(exp, index, name);
|
|
1038
|
+
CAMLreturn(Val_unit);
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
CAMLprim value
|
|
1042
|
+
caml_binaryen_switch_remove_name_at(value _exp, value _index) {
|
|
1043
|
+
CAMLparam2(_exp, _index);
|
|
1044
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1045
|
+
BinaryenIndex index = Int_val(_index);
|
|
1046
|
+
const char* name = BinaryenSwitchRemoveNameAt(exp, index);
|
|
1047
|
+
CAMLreturn(caml_copy_string(name));
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
CAMLprim value
|
|
1051
|
+
caml_binaryen_switch_get_default_name(value _exp) {
|
|
1052
|
+
CAMLparam1(_exp);
|
|
1053
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1054
|
+
const char* name = BinaryenSwitchGetDefaultName(exp);
|
|
1055
|
+
if (name == NULL) {
|
|
1056
|
+
CAMLreturn(Val_none);
|
|
1057
|
+
}
|
|
1058
|
+
CAMLreturn(caml_alloc_some(caml_copy_string(name)));
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
CAMLprim value
|
|
1062
|
+
caml_binaryen_switch_set_default_name(value _exp, value _name) {
|
|
1063
|
+
CAMLparam2(_exp, _name);
|
|
1064
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1065
|
+
char* name = Safe_String_val(_name);
|
|
1066
|
+
BinaryenSwitchSetDefaultName(exp, name);
|
|
1067
|
+
CAMLreturn(Val_unit);
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
CAMLprim value
|
|
1071
|
+
caml_binaryen_switch_get_condition(value _exp) {
|
|
1072
|
+
CAMLparam1(_exp);
|
|
1073
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1074
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenSwitchGetCondition(exp)));
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
CAMLprim value
|
|
1078
|
+
caml_binaryen_switch_set_condition(value _exp, value _child) {
|
|
1079
|
+
CAMLparam2(_exp, _child);
|
|
1080
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1081
|
+
BinaryenExpressionRef child = BinaryenExpressionRef_val(_child);
|
|
1082
|
+
BinaryenSwitchSetCondition(exp, child);
|
|
1083
|
+
CAMLreturn(Val_unit);
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
CAMLprim value
|
|
1087
|
+
caml_binaryen_switch_get_value(value _exp) {
|
|
1088
|
+
CAMLparam1(_exp);
|
|
1089
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1090
|
+
BinaryenExpressionRef val = BinaryenSwitchGetValue(exp);
|
|
1091
|
+
if (val == NULL) {
|
|
1092
|
+
CAMLreturn(Val_none);
|
|
1093
|
+
} else {
|
|
1094
|
+
CAMLreturn(caml_alloc_some(alloc_BinaryenExpressionRef(val)));
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
CAMLprim value
|
|
1099
|
+
caml_binaryen_switch_set_value(value _exp, value _child) {
|
|
1100
|
+
CAMLparam2(_exp, _child);
|
|
1101
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1102
|
+
BinaryenExpressionRef child = BinaryenExpressionRef_val(_child);
|
|
1103
|
+
BinaryenSwitchSetValue(exp, child);
|
|
1104
|
+
CAMLreturn(Val_unit);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
CAMLprim value
|
|
1108
|
+
caml_binaryen_call_get_target(value _exp) {
|
|
1109
|
+
CAMLparam1(_exp);
|
|
1110
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1111
|
+
const char* name = BinaryenCallGetTarget(exp);
|
|
1112
|
+
CAMLreturn(caml_copy_string(name));
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
CAMLprim value
|
|
1116
|
+
caml_binaryen_call_set_target(value _exp, value _name) {
|
|
1117
|
+
CAMLparam2(_exp, _name);
|
|
1118
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1119
|
+
char* name = Safe_String_val(_name);
|
|
1120
|
+
BinaryenCallSetTarget(exp, name);
|
|
1121
|
+
CAMLreturn(Val_unit);
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
CAMLprim value
|
|
1125
|
+
caml_binaryen_call_get_num_operands(value _exp) {
|
|
1126
|
+
CAMLparam1(_exp);
|
|
1127
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1128
|
+
CAMLreturn(Val_int(BinaryenCallGetNumOperands(exp)));
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
CAMLprim value
|
|
1132
|
+
caml_binaryen_call_get_operand_at(value _exp, value _index) {
|
|
1133
|
+
CAMLparam2(_exp, _index);
|
|
1134
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1135
|
+
BinaryenIndex index = Int_val(_index);
|
|
1136
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenCallGetOperandAt(exp, index)));
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
CAMLprim value
|
|
1140
|
+
caml_binaryen_call_set_operand_at(value _exp, value _index, value _operand) {
|
|
1141
|
+
CAMLparam3(_exp, _index, _operand);
|
|
1142
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1143
|
+
BinaryenIndex index = Int_val(_index);
|
|
1144
|
+
BinaryenExpressionRef operand = BinaryenExpressionRef_val(_operand);
|
|
1145
|
+
BinaryenCallSetOperandAt(exp, index, operand);
|
|
1146
|
+
CAMLreturn(Val_unit);
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
CAMLprim value
|
|
1150
|
+
caml_binaryen_call_append_operand(value _exp, value _operand) {
|
|
1151
|
+
CAMLparam2(_exp, _operand);
|
|
1152
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1153
|
+
BinaryenExpressionRef operand = BinaryenExpressionRef_val(_operand);
|
|
1154
|
+
CAMLreturn(Val_int(BinaryenCallAppendOperand(exp, operand)));
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
CAMLprim value
|
|
1158
|
+
caml_binaryen_call_insert_operand_at(value _exp, value _index, value _operand) {
|
|
1159
|
+
CAMLparam3(_exp, _index, _operand);
|
|
1160
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1161
|
+
BinaryenIndex index = Int_val(_index);
|
|
1162
|
+
BinaryenExpressionRef operand = BinaryenExpressionRef_val(_operand);
|
|
1163
|
+
BinaryenCallInsertOperandAt(exp, index, operand);
|
|
1164
|
+
CAMLreturn(Val_unit);
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
CAMLprim value
|
|
1168
|
+
caml_binaryen_call_remove_operand_at(value _exp, value _index) {
|
|
1169
|
+
CAMLparam2(_exp, _index);
|
|
1170
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1171
|
+
BinaryenIndex index = Int_val(_index);
|
|
1172
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenCallRemoveOperandAt(exp, index)));
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
CAMLprim value
|
|
1176
|
+
caml_binaryen_call_is_return(value _exp) {
|
|
1177
|
+
CAMLparam1(_exp);
|
|
1178
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1179
|
+
CAMLreturn(Val_bool(BinaryenCallIsReturn(exp)));
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
CAMLprim value
|
|
1183
|
+
caml_binaryen_call_set_return(value _exp, value _isReturn) {
|
|
1184
|
+
CAMLparam2(_exp, _isReturn);
|
|
1185
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1186
|
+
int isReturn = Bool_val(_isReturn);
|
|
1187
|
+
BinaryenCallSetReturn(exp, isReturn);
|
|
1188
|
+
CAMLreturn(Val_unit);
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
CAMLprim value
|
|
1192
|
+
caml_binaryen_call_indirect_get_target(value _exp) {
|
|
1193
|
+
CAMLparam1(_exp);
|
|
1194
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1195
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenCallIndirectGetTarget(exp)));
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
CAMLprim value
|
|
1199
|
+
caml_binaryen_call_indirect_set_target(value _exp, value _target) {
|
|
1200
|
+
CAMLparam2(_exp, _target);
|
|
1201
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1202
|
+
BinaryenExpressionRef target = BinaryenExpressionRef_val(_target);
|
|
1203
|
+
BinaryenCallIndirectSetTarget(exp, target);
|
|
1204
|
+
CAMLreturn(Val_unit);
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
CAMLprim value
|
|
1208
|
+
caml_binaryen_call_indirect_get_table(value _exp) {
|
|
1209
|
+
CAMLparam1(_exp);
|
|
1210
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1211
|
+
const char* name = BinaryenCallIndirectGetTable(exp);
|
|
1212
|
+
CAMLreturn(caml_copy_string(name));
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
CAMLprim value
|
|
1216
|
+
caml_binaryen_call_indirect_set_table(value _exp, value _name) {
|
|
1217
|
+
CAMLparam2(_exp, _name);
|
|
1218
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1219
|
+
char* name = Safe_String_val(_name);
|
|
1220
|
+
BinaryenCallIndirectSetTable(exp, name);
|
|
1221
|
+
CAMLreturn(Val_unit);
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
CAMLprim value
|
|
1225
|
+
caml_binaryen_call_indirect_get_num_operands(value _exp) {
|
|
1226
|
+
CAMLparam1(_exp);
|
|
1227
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1228
|
+
CAMLreturn(Val_int(BinaryenCallIndirectGetNumOperands(exp)));
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
CAMLprim value
|
|
1232
|
+
caml_binaryen_call_indirect_get_operand_at(value _exp, value _index) {
|
|
1233
|
+
CAMLparam2(_exp, _index);
|
|
1234
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1235
|
+
BinaryenIndex index = Int_val(_index);
|
|
1236
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenCallIndirectGetOperandAt(exp, index)));
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
CAMLprim value
|
|
1240
|
+
caml_binaryen_call_indirect_set_operand_at(value _exp, value _index, value _operand) {
|
|
1241
|
+
CAMLparam3(_exp, _index, _operand);
|
|
1242
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1243
|
+
BinaryenIndex index = Int_val(_index);
|
|
1244
|
+
BinaryenExpressionRef operand = BinaryenExpressionRef_val(_operand);
|
|
1245
|
+
BinaryenCallIndirectSetOperandAt(exp, index, operand);
|
|
1246
|
+
CAMLreturn(Val_unit);
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
CAMLprim value
|
|
1250
|
+
caml_binaryen_call_indirect_append_operand(value _exp, value _operand) {
|
|
1251
|
+
CAMLparam2(_exp, _operand);
|
|
1252
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1253
|
+
BinaryenExpressionRef operand = BinaryenExpressionRef_val(_operand);
|
|
1254
|
+
CAMLreturn(Val_int(BinaryenCallIndirectAppendOperand(exp, operand)));
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
CAMLprim value
|
|
1258
|
+
caml_binaryen_call_indirect_insert_operand_at(value _exp, value _index, value _operand) {
|
|
1259
|
+
CAMLparam3(_exp, _index, _operand);
|
|
1260
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1261
|
+
BinaryenIndex index = Int_val(_index);
|
|
1262
|
+
BinaryenExpressionRef operand = BinaryenExpressionRef_val(_operand);
|
|
1263
|
+
BinaryenCallIndirectInsertOperandAt(exp, index, operand);
|
|
1264
|
+
CAMLreturn(Val_unit);
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
CAMLprim value
|
|
1268
|
+
caml_binaryen_call_indirect_remove_operand_at(value _exp, value _index) {
|
|
1269
|
+
CAMLparam2(_exp, _index);
|
|
1270
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1271
|
+
BinaryenIndex index = Int_val(_index);
|
|
1272
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenCallIndirectRemoveOperandAt(exp, index)));
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
CAMLprim value
|
|
1276
|
+
caml_binaryen_call_indirect_is_return(value _exp) {
|
|
1277
|
+
CAMLparam1(_exp);
|
|
1278
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1279
|
+
CAMLreturn(Val_bool(BinaryenCallIndirectIsReturn(exp)));
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
CAMLprim value
|
|
1283
|
+
caml_binaryen_call_indirect_set_return(value _exp, value _isReturn) {
|
|
1284
|
+
CAMLparam2(_exp, _isReturn);
|
|
1285
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1286
|
+
int isReturn = Bool_val(_isReturn);
|
|
1287
|
+
BinaryenCallIndirectSetReturn(exp, isReturn);
|
|
1288
|
+
CAMLreturn(Val_unit);
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
CAMLprim value
|
|
1292
|
+
caml_binaryen_local_set_get_value(value _exp) {
|
|
1293
|
+
CAMLparam1(_exp);
|
|
1294
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1295
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenLocalSetGetValue(exp)));
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
CAMLprim value
|
|
1299
|
+
caml_binaryen_local_set_set_value(value _exp, value _value) {
|
|
1300
|
+
CAMLparam2(_exp, _value);
|
|
1301
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1302
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1303
|
+
BinaryenLocalSetSetValue(exp, val);
|
|
1304
|
+
CAMLreturn(Val_unit);
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
CAMLprim value
|
|
1308
|
+
caml_binaryen_global_get_get_name(value _exp) {
|
|
1309
|
+
CAMLparam1(_exp);
|
|
1310
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1311
|
+
const char* name = BinaryenGlobalGetGetName(exp);
|
|
1312
|
+
CAMLreturn(caml_copy_string(name));
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
CAMLprim value
|
|
1316
|
+
caml_binaryen_global_get_set_name(value _exp, value _name) {
|
|
1317
|
+
CAMLparam2(_exp, _name);
|
|
1318
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1319
|
+
char* name = Safe_String_val(_name);
|
|
1320
|
+
BinaryenGlobalGetSetName(exp, name);
|
|
1321
|
+
CAMLreturn(Val_unit);
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
CAMLprim value
|
|
1325
|
+
caml_binaryen_global_set_get_name(value _exp) {
|
|
1326
|
+
CAMLparam1(_exp);
|
|
1327
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1328
|
+
const char* name = BinaryenGlobalSetGetName(exp);
|
|
1329
|
+
CAMLreturn(caml_copy_string(name));
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
CAMLprim value
|
|
1333
|
+
caml_binaryen_global_set_set_name(value _exp, value _name) {
|
|
1334
|
+
CAMLparam2(_exp, _name);
|
|
1335
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1336
|
+
char* name = Safe_String_val(_name);
|
|
1337
|
+
BinaryenGlobalSetSetName(exp, name);
|
|
1338
|
+
CAMLreturn(Val_unit);
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
CAMLprim value
|
|
1342
|
+
caml_binaryen_global_set_get_value(value _exp) {
|
|
1343
|
+
CAMLparam1(_exp);
|
|
1344
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1345
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenGlobalSetGetValue(exp)));
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
CAMLprim value
|
|
1349
|
+
caml_binaryen_global_set_set_value(value _exp, value _value) {
|
|
1350
|
+
CAMLparam2(_exp, _value);
|
|
1351
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1352
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1353
|
+
BinaryenGlobalSetSetValue(exp, val);
|
|
1354
|
+
CAMLreturn(Val_unit);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
CAMLprim value
|
|
1358
|
+
caml_binaryen_memory_grow_get_delta(value _exp) {
|
|
1359
|
+
CAMLparam1(_exp);
|
|
1360
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1361
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenMemoryGrowGetDelta(exp)));
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
CAMLprim value
|
|
1365
|
+
caml_binaryen_memory_grow_set_delta(value _exp, value _delta) {
|
|
1366
|
+
CAMLparam2(_exp, _delta);
|
|
1367
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1368
|
+
BinaryenExpressionRef delta = BinaryenExpressionRef_val(_delta);
|
|
1369
|
+
BinaryenMemoryGrowSetDelta(exp, delta);
|
|
1370
|
+
CAMLreturn(Val_unit);
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
CAMLprim value
|
|
1374
|
+
caml_binaryen_load_get_ptr(value _exp) {
|
|
1375
|
+
CAMLparam1(_exp);
|
|
1376
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1377
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenLoadGetPtr(exp)));
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
CAMLprim value
|
|
1381
|
+
caml_binaryen_load_set_ptr(value _exp, value _ptr) {
|
|
1382
|
+
CAMLparam2(_exp, _ptr);
|
|
1383
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1384
|
+
BinaryenExpressionRef ptr = BinaryenExpressionRef_val(_ptr);
|
|
1385
|
+
BinaryenLoadSetPtr(exp, ptr);
|
|
1386
|
+
CAMLreturn(Val_unit);
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
CAMLprim value
|
|
1390
|
+
caml_binaryen_store_get_ptr(value _exp) {
|
|
1391
|
+
CAMLparam1(_exp);
|
|
1392
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1393
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenStoreGetPtr(exp)));
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
CAMLprim value
|
|
1397
|
+
caml_binaryen_store_set_ptr(value _exp, value _ptr) {
|
|
1398
|
+
CAMLparam2(_exp, _ptr);
|
|
1399
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1400
|
+
BinaryenExpressionRef ptr = BinaryenExpressionRef_val(_ptr);
|
|
1401
|
+
BinaryenStoreSetPtr(exp, ptr);
|
|
1402
|
+
CAMLreturn(Val_unit);
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
CAMLprim value
|
|
1406
|
+
caml_binaryen_store_get_value(value _exp) {
|
|
1407
|
+
CAMLparam1(_exp);
|
|
1408
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1409
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenStoreGetValue(exp)));
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
CAMLprim value
|
|
1413
|
+
caml_binaryen_store_set_value(value _exp, value _value) {
|
|
1414
|
+
CAMLparam2(_exp, _value);
|
|
1415
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1416
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1417
|
+
BinaryenStoreSetValue(exp, val);
|
|
1418
|
+
CAMLreturn(Val_unit);
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
CAMLprim value
|
|
1422
|
+
caml_binaryen_unary_get_value(value _exp) {
|
|
1423
|
+
CAMLparam1(_exp);
|
|
1424
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1425
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenUnaryGetValue(exp)));
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
CAMLprim value
|
|
1429
|
+
caml_binaryen_unary_set_value(value _exp, value _value) {
|
|
1430
|
+
CAMLparam2(_exp, _value);
|
|
1431
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1432
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1433
|
+
BinaryenUnarySetValue(exp, val);
|
|
1434
|
+
CAMLreturn(Val_unit);
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
CAMLprim value
|
|
1438
|
+
caml_binaryen_binary_get_left(value _exp) {
|
|
1439
|
+
CAMLparam1(_exp);
|
|
1440
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1441
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenBinaryGetLeft(exp)));
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
CAMLprim value
|
|
1445
|
+
caml_binaryen_binary_set_left(value _exp, value _value) {
|
|
1446
|
+
CAMLparam2(_exp, _value);
|
|
1447
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1448
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1449
|
+
BinaryenBinarySetLeft(exp, val);
|
|
1450
|
+
CAMLreturn(Val_unit);
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
CAMLprim value
|
|
1454
|
+
caml_binaryen_binary_get_right(value _exp) {
|
|
1455
|
+
CAMLparam1(_exp);
|
|
1456
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1457
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenBinaryGetRight(exp)));
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
CAMLprim value
|
|
1461
|
+
caml_binaryen_binary_set_right(value _exp, value _value) {
|
|
1462
|
+
CAMLparam2(_exp, _value);
|
|
1463
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1464
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1465
|
+
BinaryenBinarySetRight(exp, val);
|
|
1466
|
+
CAMLreturn(Val_unit);
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
CAMLprim value
|
|
1470
|
+
caml_binaryen_select_get_if_true(value _exp) {
|
|
1471
|
+
CAMLparam1(_exp);
|
|
1472
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1473
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenSelectGetIfTrue(exp)));
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
CAMLprim value
|
|
1477
|
+
caml_binaryen_select_set_if_true(value _exp, value _value) {
|
|
1478
|
+
CAMLparam2(_exp, _value);
|
|
1479
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1480
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1481
|
+
BinaryenSelectSetIfTrue(exp, val);
|
|
1482
|
+
CAMLreturn(Val_unit);
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
CAMLprim value
|
|
1486
|
+
caml_binaryen_select_get_if_false(value _exp) {
|
|
1487
|
+
CAMLparam1(_exp);
|
|
1488
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1489
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenSelectGetIfFalse(exp)));
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
CAMLprim value
|
|
1493
|
+
caml_binaryen_select_set_if_false(value _exp, value _value) {
|
|
1494
|
+
CAMLparam2(_exp, _value);
|
|
1495
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1496
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1497
|
+
BinaryenSelectSetIfFalse(exp, val);
|
|
1498
|
+
CAMLreturn(Val_unit);
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
CAMLprim value
|
|
1502
|
+
caml_binaryen_select_get_condition(value _exp) {
|
|
1503
|
+
CAMLparam1(_exp);
|
|
1504
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1505
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenSelectGetCondition(exp)));
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
CAMLprim value
|
|
1509
|
+
caml_binaryen_select_set_condition(value _exp, value _value) {
|
|
1510
|
+
CAMLparam2(_exp, _value);
|
|
1511
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1512
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1513
|
+
BinaryenSelectSetCondition(exp, val);
|
|
1514
|
+
CAMLreturn(Val_unit);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
CAMLprim value
|
|
1518
|
+
caml_binaryen_drop_get_value(value _exp) {
|
|
1519
|
+
CAMLparam1(_exp);
|
|
1520
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1521
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenDropGetValue(exp)));
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
CAMLprim value
|
|
1525
|
+
caml_binaryen_drop_set_value(value _exp, value _value) {
|
|
1526
|
+
CAMLparam2(_exp, _value);
|
|
1527
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1528
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1529
|
+
BinaryenDropSetValue(exp, val);
|
|
1530
|
+
CAMLreturn(Val_unit);
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
CAMLprim value
|
|
1534
|
+
caml_binaryen_return_get_value(value _exp) {
|
|
1535
|
+
CAMLparam1(_exp);
|
|
1536
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1537
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenReturnGetValue(exp)));
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
CAMLprim value
|
|
1541
|
+
caml_binaryen_return_set_value(value _exp, value _value) {
|
|
1542
|
+
CAMLparam2(_exp, _value);
|
|
1543
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1544
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1545
|
+
BinaryenReturnSetValue(exp, val);
|
|
1546
|
+
CAMLreturn(Val_unit);
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
CAMLprim value
|
|
1550
|
+
caml_binaryen_memory_copy_get_dest(value _exp) {
|
|
1551
|
+
CAMLparam1(_exp);
|
|
1552
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1553
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenMemoryCopyGetDest(exp)));
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
CAMLprim value
|
|
1557
|
+
caml_binaryen_memory_copy_set_dest(value _exp, value _value) {
|
|
1558
|
+
CAMLparam2(_exp, _value);
|
|
1559
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1560
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1561
|
+
BinaryenMemoryCopySetDest(exp, val);
|
|
1562
|
+
CAMLreturn(Val_unit);
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
CAMLprim value
|
|
1566
|
+
caml_binaryen_memory_copy_get_source(value _exp) {
|
|
1567
|
+
CAMLparam1(_exp);
|
|
1568
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1569
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenMemoryCopyGetSource(exp)));
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
CAMLprim value
|
|
1573
|
+
caml_binaryen_memory_copy_set_source(value _exp, value _value) {
|
|
1574
|
+
CAMLparam2(_exp, _value);
|
|
1575
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1576
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1577
|
+
BinaryenMemoryCopySetSource(exp, val);
|
|
1578
|
+
CAMLreturn(Val_unit);
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
CAMLprim value
|
|
1582
|
+
caml_binaryen_memory_copy_get_size(value _exp) {
|
|
1583
|
+
CAMLparam1(_exp);
|
|
1584
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1585
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenMemoryCopyGetSize(exp)));
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
CAMLprim value
|
|
1589
|
+
caml_binaryen_memory_copy_set_size(value _exp, value _value) {
|
|
1590
|
+
CAMLparam2(_exp, _value);
|
|
1591
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1592
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1593
|
+
BinaryenMemoryCopySetSize(exp, val);
|
|
1594
|
+
CAMLreturn(Val_unit);
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
CAMLprim value
|
|
1598
|
+
caml_binaryen_memory_fill_get_dest(value _exp) {
|
|
1599
|
+
CAMLparam1(_exp);
|
|
1600
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1601
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenMemoryFillGetDest(exp)));
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
CAMLprim value
|
|
1605
|
+
caml_binaryen_memory_fill_set_dest(value _exp, value _value) {
|
|
1606
|
+
CAMLparam2(_exp, _value);
|
|
1607
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1608
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1609
|
+
BinaryenMemoryFillSetDest(exp, val);
|
|
1610
|
+
CAMLreturn(Val_unit);
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
CAMLprim value
|
|
1614
|
+
caml_binaryen_memory_fill_get_value(value _exp) {
|
|
1615
|
+
CAMLparam1(_exp);
|
|
1616
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1617
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenMemoryFillGetValue(exp)));
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
CAMLprim value
|
|
1621
|
+
caml_binaryen_memory_fill_set_value(value _exp, value _value) {
|
|
1622
|
+
CAMLparam2(_exp, _value);
|
|
1623
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1624
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1625
|
+
BinaryenMemoryFillSetValue(exp, val);
|
|
1626
|
+
CAMLreturn(Val_unit);
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
CAMLprim value
|
|
1630
|
+
caml_binaryen_memory_fill_get_size(value _exp) {
|
|
1631
|
+
CAMLparam1(_exp);
|
|
1632
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1633
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenMemoryFillGetSize(exp)));
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
CAMLprim value
|
|
1637
|
+
caml_binaryen_memory_fill_set_size(value _exp, value _value) {
|
|
1638
|
+
CAMLparam2(_exp, _value);
|
|
1639
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1640
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1641
|
+
BinaryenMemoryFillSetSize(exp, val);
|
|
1642
|
+
CAMLreturn(Val_unit);
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
CAMLprim value
|
|
1646
|
+
caml_binaryen_tuple_make_get_num_operands(value _exp) {
|
|
1647
|
+
CAMLparam1(_exp);
|
|
1648
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1649
|
+
CAMLreturn(Val_int(BinaryenTupleMakeGetNumOperands(exp)));
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
CAMLprim value
|
|
1653
|
+
caml_binaryen_tuple_make_get_operand_at(value _exp, value _index) {
|
|
1654
|
+
CAMLparam2(_exp, _index);
|
|
1655
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1656
|
+
BinaryenIndex index = Int_val(_index);
|
|
1657
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenTupleMakeGetOperandAt(exp, index)));
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
CAMLprim value
|
|
1661
|
+
caml_binaryen_tuple_make_set_operand_at(value _exp, value _index, value _operand) {
|
|
1662
|
+
CAMLparam3(_exp, _index, _operand);
|
|
1663
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1664
|
+
BinaryenIndex index = Int_val(_index);
|
|
1665
|
+
BinaryenExpressionRef operand = BinaryenExpressionRef_val(_operand);
|
|
1666
|
+
BinaryenTupleMakeSetOperandAt(exp, index, operand);
|
|
1667
|
+
CAMLreturn(Val_unit);
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
CAMLprim value
|
|
1671
|
+
caml_binaryen_tuple_make_append_operand(value _exp, value _operand) {
|
|
1672
|
+
CAMLparam2(_exp, _operand);
|
|
1673
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1674
|
+
BinaryenExpressionRef operand = BinaryenExpressionRef_val(_operand);
|
|
1675
|
+
CAMLreturn(Val_int(BinaryenTupleMakeAppendOperand(exp, operand)));
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
CAMLprim value
|
|
1679
|
+
caml_binaryen_tuple_make_insert_operand_at(value _exp, value _index, value _operand) {
|
|
1680
|
+
CAMLparam3(_exp, _index, _operand);
|
|
1681
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1682
|
+
BinaryenIndex index = Int_val(_index);
|
|
1683
|
+
BinaryenExpressionRef operand = BinaryenExpressionRef_val(_operand);
|
|
1684
|
+
BinaryenTupleMakeInsertOperandAt(exp, index, operand);
|
|
1685
|
+
CAMLreturn(Val_unit);
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
CAMLprim value
|
|
1689
|
+
caml_binaryen_tuple_make_remove_operand_at(value _exp, value _index) {
|
|
1690
|
+
CAMLparam2(_exp, _index);
|
|
1691
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1692
|
+
BinaryenIndex index = Int_val(_index);
|
|
1693
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenTupleMakeRemoveOperandAt(exp, index)));
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
CAMLprim value
|
|
1697
|
+
caml_binaryen_tuple_extract_get_tuple(value _exp) {
|
|
1698
|
+
CAMLparam1(_exp);
|
|
1699
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1700
|
+
CAMLreturn(alloc_BinaryenExpressionRef(BinaryenTupleExtractGetTuple(exp)));
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
CAMLprim value
|
|
1704
|
+
caml_binaryen_tuple_extract_set_tuple(value _exp, value _value) {
|
|
1705
|
+
CAMLparam2(_exp, _value);
|
|
1706
|
+
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
1707
|
+
BinaryenExpressionRef val = BinaryenExpressionRef_val(_value);
|
|
1708
|
+
BinaryenTupleExtractSetTuple(exp, val);
|
|
1709
|
+
CAMLreturn(Val_unit);
|
|
1710
|
+
}
|