@grain/binaryen.ml 0.32.0 → 0.34.0
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/CHANGELOG.md +25 -0
- binaryen-archive/binaryen.opam +2 -2
- binaryen-archive/esy.lock/index.json +18 -18
- binaryen-archive/esy.lock/opam/{topkg.1.1.0 → topkg.1.1.1}/opam +2 -2
- binaryen-archive/package.json +2 -2
- binaryen-archive/src/expression.c +1 -1
- binaryen-archive/src/expression.ml +2 -1
- binaryen-archive/src/expression.mli +1 -1
- binaryen-archive/src/function.c +8 -0
- binaryen-archive/src/function.js +5 -0
- binaryen-archive/src/function.ml +1 -0
- binaryen-archive/src/function.mli +1 -0
- binaryen-archive/src/module.ml +30 -8
- binaryen-archive/src/module.mli +7 -2
- binaryen-archive/src/module_feature.c +40 -10
- binaryen-archive/src/module_feature.js +42 -12
- binaryen-archive/src/passes.ml +93 -15
- binaryen-archive/src/passes.mli +89 -15
- binaryen-archive/src/settings.c +135 -0
- binaryen-archive/src/settings.js +131 -0
- binaryen-archive/src/settings.ml +45 -0
- binaryen-archive/src/settings.mli +18 -0
- binaryen-archive/test/test.ml +69 -4
binaryen-archive/src/passes.ml
CHANGED
|
@@ -37,12 +37,18 @@ let const_hoisting = "const-hoisting"
|
|
|
37
37
|
(** propagate constant struct field values *)
|
|
38
38
|
let cfp = "cfp"
|
|
39
39
|
|
|
40
|
+
(** propagate constant struct field values, using ref.test *)
|
|
41
|
+
let cfp_reftest = "cfp-reftest"
|
|
42
|
+
|
|
40
43
|
(** removes unreachable code *)
|
|
41
44
|
let dce = "dce"
|
|
42
45
|
|
|
43
46
|
(** forces all loads and stores to have alignment 1 *)
|
|
44
47
|
let dealign = "dealign"
|
|
45
48
|
|
|
49
|
+
(** propagate debug location from parents or previous siblings to child nodes *)
|
|
50
|
+
let propagate_debug_locs = "propagate-debug-locs"
|
|
51
|
+
|
|
46
52
|
(** instrument the wasm to convert NaNs into 0 at runtime *)
|
|
47
53
|
let denan = "denan"
|
|
48
54
|
|
|
@@ -67,6 +73,9 @@ let duplicate_function_elimination = "duplicate-function-elimination"
|
|
|
67
73
|
(** emit the target features section in the output *)
|
|
68
74
|
let emit_target_features = "emit-target-features"
|
|
69
75
|
|
|
76
|
+
(** modify the wasm (destructively) for closed-world *)
|
|
77
|
+
let enclose_world = "enclose-world"
|
|
78
|
+
|
|
70
79
|
(** leaves just one function (useful for debugging) *)
|
|
71
80
|
let extract_function = "extract-function"
|
|
72
81
|
|
|
@@ -94,9 +103,6 @@ let generate_i64_dyncalls = "generate-i64-dyncalls"
|
|
|
94
103
|
(** generate global effect info (helps later passes) *)
|
|
95
104
|
let generate_global_effects = "generate-global-effects"
|
|
96
105
|
|
|
97
|
-
(** generate Stack IR *)
|
|
98
|
-
let generate_stack_ir = "generate-stack-ir"
|
|
99
|
-
|
|
100
106
|
(** refine the types of globals *)
|
|
101
107
|
let global_refining = "global-refining"
|
|
102
108
|
|
|
@@ -110,15 +116,30 @@ let gto = "gto"
|
|
|
110
116
|
about what content can actually appear in each location *)
|
|
111
117
|
let gufa = "gufa"
|
|
112
118
|
|
|
119
|
+
(** GUFA plus add casts for all inferences *)
|
|
120
|
+
let gufa_cast_all = "gufa-cast-all"
|
|
121
|
+
|
|
113
122
|
(** GUFA plus local optimizations in functions we modified *)
|
|
114
123
|
let gufa_optimizing = "gufa-optimizing"
|
|
115
124
|
|
|
125
|
+
(** optimizes J2CL specific constructs. *)
|
|
126
|
+
let optimize_j2cl = "optimize-j2cl"
|
|
127
|
+
|
|
128
|
+
(** Merges itable structures into vtables to make types more compact *)
|
|
129
|
+
let merge_j2cl_itables = "merge-j2cl-itables"
|
|
130
|
+
|
|
116
131
|
(** apply more specific subtypes to type fields where possible *)
|
|
117
132
|
let type_refining = "type-refining"
|
|
118
133
|
|
|
134
|
+
(** apply more specific subtypes to type fields where possible (using GUFA) *)
|
|
135
|
+
let type_refining_gufa = "type-refining-gufa"
|
|
136
|
+
|
|
119
137
|
(** replace GC allocations with locals *)
|
|
120
138
|
let heap2local = "heap2local"
|
|
121
139
|
|
|
140
|
+
(** optimize heap (GC) stores *)
|
|
141
|
+
let heap_store_optimization = "heap-store-optimization"
|
|
142
|
+
|
|
122
143
|
(** inline __original_main into main *)
|
|
123
144
|
let inline_main = "inline-main"
|
|
124
145
|
|
|
@@ -137,9 +158,8 @@ let jspi = "jspi"
|
|
|
137
158
|
(** legalizes i64 types on the import/export boundary *)
|
|
138
159
|
let legalize_js_interface = "legalize-js-interface"
|
|
139
160
|
|
|
140
|
-
(** legalizes
|
|
141
|
-
|
|
142
|
-
let legalize_js_interface_minimally = "legalize-js-interface-minimally"
|
|
161
|
+
(** legalizes the import/export boundary and prunes when needed *)
|
|
162
|
+
let legalize_and_prune_js_interface = "legalize-and-prune-js-interface"
|
|
143
163
|
|
|
144
164
|
(** common subexpression elimination inside basic blocks *)
|
|
145
165
|
let local_cse = "local-cse"
|
|
@@ -153,6 +173,9 @@ let log_execution = "log-execution"
|
|
|
153
173
|
(** lower all uses of i64s to use i32s instead *)
|
|
154
174
|
let i64_to_i32_lowering = "i64-to-i32-lowering"
|
|
155
175
|
|
|
176
|
+
(** instrument the build with code to intercept specific function calls *)
|
|
177
|
+
let trace_calls = "trace-calls"
|
|
178
|
+
|
|
156
179
|
(** instrument the build with code to intercept all loads and stores *)
|
|
157
180
|
let instrument_locals = "instrument-locals"
|
|
158
181
|
|
|
@@ -168,6 +191,13 @@ let limit_segments = "limit-segments"
|
|
|
168
191
|
(** lower loads and stores to a 64-bit memory to instead use a 32-bit one *)
|
|
169
192
|
let memory64_lowering = "memory64-lowering"
|
|
170
193
|
|
|
194
|
+
(** alias for memory64-lowering *)
|
|
195
|
+
let table64_lowering = "table64-lowering"
|
|
196
|
+
|
|
197
|
+
(** Lower memory.copy and memory.fill to wasm mvp and disable the bulk-memory
|
|
198
|
+
feature. *)
|
|
199
|
+
let llvm_memory_copy_fill_lowering = "llvm-memory-copy-fill-lowering"
|
|
200
|
+
|
|
171
201
|
(** packs memory into separate segments, skipping zeros *)
|
|
172
202
|
let memory_packing = "memory-packing"
|
|
173
203
|
|
|
@@ -196,6 +226,9 @@ let minify_imports_and_exports = "minify-imports-and-exports"
|
|
|
196
226
|
let minify_imports_and_exports_and_modules =
|
|
197
227
|
"minify-imports-and-exports-and-modules"
|
|
198
228
|
|
|
229
|
+
(** Split types into minimal recursion groups *)
|
|
230
|
+
let minimize_rec_groups = "minimize-rec-groups"
|
|
231
|
+
|
|
199
232
|
(** apply the assumption that asyncify imports always unwind, and we never
|
|
200
233
|
rewind *)
|
|
201
234
|
let mod_asyncify_always_and_only_unwind = "mod-asyncify-always-and-only-unwind"
|
|
@@ -223,6 +256,19 @@ let nm = "nm"
|
|
|
223
256
|
(** (re)name all heap types *)
|
|
224
257
|
let name_types = "name-types"
|
|
225
258
|
|
|
259
|
+
(** mark functions as no-inline *)
|
|
260
|
+
let no_inline = "no-inline"
|
|
261
|
+
|
|
262
|
+
(** mark functions as no-inline (for full inlining only) *)
|
|
263
|
+
let no_full_inline = "no-full-inline"
|
|
264
|
+
|
|
265
|
+
(** mark functions as no-inline (for partial inlining only) *)
|
|
266
|
+
let no_partial_inline = "no-partial-inline"
|
|
267
|
+
|
|
268
|
+
(** lower nontrapping float-to-int operations to wasm mvp and disable the
|
|
269
|
+
nontrapping fptoint feature *)
|
|
270
|
+
let llvm_nontrapping_fptoint_lowering = "llvm-nontrapping-fptoint-lowering"
|
|
271
|
+
|
|
226
272
|
(** reduces calls to code that only runs once *)
|
|
227
273
|
let once_reduction = "once-reduction"
|
|
228
274
|
|
|
@@ -239,9 +285,6 @@ let optimize_casts = "optimize-casts"
|
|
|
239
285
|
(** optimizes instruction combinations *)
|
|
240
286
|
let optimize_instructions = "optimize-instructions"
|
|
241
287
|
|
|
242
|
-
(** optimize Stack IR *)
|
|
243
|
-
let optimize_stack_ir = "optimize-stack-ir"
|
|
244
|
-
|
|
245
288
|
(** pick load signs based on their uses *)
|
|
246
289
|
let pick_load_signs = "pick-load-signs"
|
|
247
290
|
|
|
@@ -282,15 +325,15 @@ let print_function_map = "print-function-map"
|
|
|
282
325
|
(** alias for print_function_map *)
|
|
283
326
|
let symbolmap = "symbolmap"
|
|
284
327
|
|
|
285
|
-
(** print out Stack IR (useful for internal debugging) *)
|
|
286
|
-
let print_stack_ir = "print-stack-ir"
|
|
287
|
-
|
|
288
328
|
(** removes operations incompatible with js *)
|
|
289
329
|
let remove_non_js_ops = "remove-non-js-ops"
|
|
290
330
|
|
|
291
331
|
(** removes imports and replaces them with nops *)
|
|
292
332
|
let remove_imports = "remove-imports"
|
|
293
333
|
|
|
334
|
+
(** removes memory initialization *)
|
|
335
|
+
let remove_memory_init = "remove-memory-init"
|
|
336
|
+
|
|
294
337
|
(** removes memory segments *)
|
|
295
338
|
let remove_memory = "remove-memory"
|
|
296
339
|
|
|
@@ -310,15 +353,15 @@ let remove_unused_names = "remove-unused-names"
|
|
|
310
353
|
(** remove unused private GC types *)
|
|
311
354
|
let remove_unused_types = "remove-unused-types"
|
|
312
355
|
|
|
356
|
+
(** sorts functions by name (useful for debugging) *)
|
|
357
|
+
let reorder_functions_by_name = "reorder-functions-by-name"
|
|
358
|
+
|
|
313
359
|
(** sorts functions by access frequency *)
|
|
314
360
|
let reorder_functions = "reorder-functions"
|
|
315
361
|
|
|
316
362
|
(** sorts globals by access frequency *)
|
|
317
363
|
let reorder_globals = "reorder-globals"
|
|
318
364
|
|
|
319
|
-
(** sorts globals by access frequency (even if there are few) *)
|
|
320
|
-
let reorder_globals_always = "reorder-globals-always"
|
|
321
|
-
|
|
322
365
|
(** sorts locals by access frequency *)
|
|
323
366
|
let reorder_locals = "reorder-locals"
|
|
324
367
|
|
|
@@ -337,6 +380,9 @@ let safe_heap = "safe-heap"
|
|
|
337
380
|
(** sets specified globals to specified values *)
|
|
338
381
|
let set_globals = "set-globals"
|
|
339
382
|
|
|
383
|
+
(** write data segments to a file and strip them from the module *)
|
|
384
|
+
let separate_data_segments = "separate-data-segments"
|
|
385
|
+
|
|
340
386
|
(** remove params from function signature types where possible *)
|
|
341
387
|
let signature_pruning = "signature-pruning"
|
|
342
388
|
|
|
@@ -388,6 +434,23 @@ let ssa = "ssa"
|
|
|
388
434
|
(** ssa-ify variables so that they have a single assignment, ignoring merges *)
|
|
389
435
|
let ssa_nomerge = "ssa-nomerge"
|
|
390
436
|
|
|
437
|
+
(** gathers wasm strings to globals *)
|
|
438
|
+
let string_gathering = "string-gathering"
|
|
439
|
+
|
|
440
|
+
(** lift string imports to wasm strings *)
|
|
441
|
+
let string_lifting = "string-lifting"
|
|
442
|
+
|
|
443
|
+
(** lowers wasm strings and operations to imports *)
|
|
444
|
+
let string_lowering = "string-lowering"
|
|
445
|
+
|
|
446
|
+
(** same as string-lowering, but encodes well-formed strings as magic imports *)
|
|
447
|
+
let string_lowering_magic_imports = "string-lowering-magic-imports"
|
|
448
|
+
|
|
449
|
+
(** same as string-lowering-magic-imports, but raise a fatal error if there are
|
|
450
|
+
invalid strings *)
|
|
451
|
+
let string_lowering_magic_imports_assert =
|
|
452
|
+
"string-lowering-magic-imports-assert"
|
|
453
|
+
|
|
391
454
|
(** deprecated; same as strip-debug *)
|
|
392
455
|
let strip = "strip"
|
|
393
456
|
|
|
@@ -409,18 +472,33 @@ let strip_eh = "strip-eh"
|
|
|
409
472
|
(** strip the wasm target features section *)
|
|
410
473
|
let strip_target_features = "strip-target-features"
|
|
411
474
|
|
|
475
|
+
(** translate old Phase 3 EH instructions to new ones with exnref *)
|
|
476
|
+
let translate_to_exnref = "translate-to-exnref"
|
|
477
|
+
|
|
412
478
|
(** replace trapping operations with clamping semantics *)
|
|
413
479
|
let trap_mode_clamp = "trap-mode-clamp"
|
|
414
480
|
|
|
415
481
|
(** replace trapping operations with js semantics *)
|
|
416
482
|
let trap_mode_js = "trap-mode-js"
|
|
417
483
|
|
|
484
|
+
(** optimize trivial tuples away *)
|
|
485
|
+
let tuple_optimization = "tuple-optimization"
|
|
486
|
+
|
|
487
|
+
(** mark all leaf types as final *)
|
|
488
|
+
let type_finalizing = "type-finalizing"
|
|
489
|
+
|
|
418
490
|
(** merge types to their supertypes where possible *)
|
|
419
491
|
let type_merging = "type-merging"
|
|
420
492
|
|
|
421
493
|
(** create new nominal types to help other optimizations *)
|
|
422
494
|
let type_ssa = "type-ssa"
|
|
423
495
|
|
|
496
|
+
(** mark all types as non-final (open) *)
|
|
497
|
+
let type_unfinalizing = "type-unfinalizing"
|
|
498
|
+
|
|
499
|
+
(** removes removes unnecessary subtyping relationships *)
|
|
500
|
+
let unsubtyping = "unsubtyping"
|
|
501
|
+
|
|
424
502
|
(** removes local.tees, replacing them with sets and gets *)
|
|
425
503
|
let untee = "untee"
|
|
426
504
|
|
binaryen-archive/src/passes.mli
CHANGED
|
@@ -37,12 +37,18 @@ val const_hoisting : t
|
|
|
37
37
|
val cfp : t
|
|
38
38
|
(** propagate constant struct field values *)
|
|
39
39
|
|
|
40
|
+
val cfp_reftest : t
|
|
41
|
+
(** propagate constant struct field values, using ref.test *)
|
|
42
|
+
|
|
40
43
|
val dce : t
|
|
41
44
|
(** removes unreachable code *)
|
|
42
45
|
|
|
43
46
|
val dealign : t
|
|
44
47
|
(** forces all loads and stores to have alignment 1 *)
|
|
45
48
|
|
|
49
|
+
val propagate_debug_locs : t
|
|
50
|
+
(** propagate debug location from parents or previous siblings to child nodes *)
|
|
51
|
+
|
|
46
52
|
val denan : t
|
|
47
53
|
(** instrument the wasm to convert NaNs into 0 at runtime *)
|
|
48
54
|
|
|
@@ -67,6 +73,9 @@ val duplicate_function_elimination : t
|
|
|
67
73
|
val emit_target_features : t
|
|
68
74
|
(** emit the target features section in the output *)
|
|
69
75
|
|
|
76
|
+
val enclose_world : t
|
|
77
|
+
(** modify the wasm (destructively) for closed-world *)
|
|
78
|
+
|
|
70
79
|
val extract_function : t
|
|
71
80
|
(** leaves just one function (useful for debugging) *)
|
|
72
81
|
|
|
@@ -94,9 +103,6 @@ val generate_i64_dyncalls : t
|
|
|
94
103
|
val generate_global_effects : t
|
|
95
104
|
(** generate global effect info (helps later passes) *)
|
|
96
105
|
|
|
97
|
-
val generate_stack_ir : t
|
|
98
|
-
(** generate Stack IR *)
|
|
99
|
-
|
|
100
106
|
val global_refining : t
|
|
101
107
|
(** refine the types of globals *)
|
|
102
108
|
|
|
@@ -110,15 +116,27 @@ val gufa : t
|
|
|
110
116
|
(** Grand Unified Flow Analysis: optimize the entire program using information
|
|
111
117
|
about what content can actually appear in each location *)
|
|
112
118
|
|
|
119
|
+
val gufa_cast_all : t
|
|
120
|
+
(** GUFA plus add casts for all inferences *)
|
|
121
|
+
|
|
113
122
|
val gufa_optimizing : t
|
|
114
123
|
(** GUFA plus local optimizations in functions we modified *)
|
|
115
124
|
|
|
125
|
+
val optimize_j2cl : t
|
|
126
|
+
(** optimizes J2CL specific constructs. *)
|
|
127
|
+
|
|
128
|
+
val merge_j2cl_itables : t
|
|
129
|
+
(** Merges itable structures into vtables to make types more compact *)
|
|
130
|
+
|
|
116
131
|
val type_refining : t
|
|
117
132
|
(** apply more specific subtypes to type fields where possible *)
|
|
118
133
|
|
|
119
134
|
val heap2local : t
|
|
120
135
|
(** replace GC allocations with locals *)
|
|
121
136
|
|
|
137
|
+
val heap_store_optimization : t
|
|
138
|
+
(** optimize heap (GC) stores *)
|
|
139
|
+
|
|
122
140
|
val inline_main : t
|
|
123
141
|
(** inline __original_main into main *)
|
|
124
142
|
|
|
@@ -137,9 +155,8 @@ val jspi : t
|
|
|
137
155
|
val legalize_js_interface : t
|
|
138
156
|
(** legalizes i64 types on the import/export boundary *)
|
|
139
157
|
|
|
140
|
-
val
|
|
141
|
-
(** legalizes
|
|
142
|
-
on things only JS will call *)
|
|
158
|
+
val legalize_and_prune_js_interface : t
|
|
159
|
+
(** legalizes the import/export boundary and prunes when needed *)
|
|
143
160
|
|
|
144
161
|
val local_cse : t
|
|
145
162
|
(** common subexpression elimination inside basic blocks *)
|
|
@@ -153,6 +170,9 @@ val log_execution : t
|
|
|
153
170
|
val i64_to_i32_lowering : t
|
|
154
171
|
(** lower all uses of i64s to use i32s instead *)
|
|
155
172
|
|
|
173
|
+
val trace_calls : t
|
|
174
|
+
(** instrument the build with code to intercept specific function calls *)
|
|
175
|
+
|
|
156
176
|
val instrument_locals : t
|
|
157
177
|
(** instrument the build with code to intercept all loads and stores *)
|
|
158
178
|
|
|
@@ -168,6 +188,13 @@ val limit_segments : t
|
|
|
168
188
|
val memory64_lowering : t
|
|
169
189
|
(** lower loads and stores to a 64-bit memory to instead use a 32-bit one *)
|
|
170
190
|
|
|
191
|
+
val table64_lowering : t
|
|
192
|
+
(** alias for memory64-lowering *)
|
|
193
|
+
|
|
194
|
+
val llvm_memory_copy_fill_lowering : t
|
|
195
|
+
(** Lower memory.copy and memory.fill to wasm mvp and disable the bulk-memory
|
|
196
|
+
feature. *)
|
|
197
|
+
|
|
171
198
|
val memory_packing : t
|
|
172
199
|
(** packs memory into separate segments, skipping zeros *)
|
|
173
200
|
|
|
@@ -195,6 +222,9 @@ val minify_imports_and_exports_and_modules : t
|
|
|
195
222
|
(** minifies both import and export names, and emits a mapping to the minified
|
|
196
223
|
ones, and minifies the modules as well *)
|
|
197
224
|
|
|
225
|
+
val minimize_rec_groups : t
|
|
226
|
+
(** Split types into minimal recursion groups *)
|
|
227
|
+
|
|
198
228
|
val mod_asyncify_always_and_only_unwind : t
|
|
199
229
|
(** apply the assumption that asyncify imports always unwind, and we never
|
|
200
230
|
rewind *)
|
|
@@ -221,6 +251,19 @@ val nm : t
|
|
|
221
251
|
val name_types : t
|
|
222
252
|
(** (re)name all heap types *)
|
|
223
253
|
|
|
254
|
+
val no_inline : t
|
|
255
|
+
(** mark functions as no-inline *)
|
|
256
|
+
|
|
257
|
+
val no_full_inline : t
|
|
258
|
+
(** mark functions as no-inline (for full inlining only) *)
|
|
259
|
+
|
|
260
|
+
val no_partial_inline : t
|
|
261
|
+
(** mark functions as no-inline (for partial inlining only) *)
|
|
262
|
+
|
|
263
|
+
val llvm_nontrapping_fptoint_lowering : t
|
|
264
|
+
(** lower nontrapping float-to-int operations to wasm mvp and disable the
|
|
265
|
+
nontrapping fptoint feature *)
|
|
266
|
+
|
|
224
267
|
val once_reduction : t
|
|
225
268
|
(** reduces calls to code that only runs once *)
|
|
226
269
|
|
|
@@ -237,9 +280,6 @@ val optimize_casts : t
|
|
|
237
280
|
val optimize_instructions : t
|
|
238
281
|
(** optimizes instruction combinations *)
|
|
239
282
|
|
|
240
|
-
val optimize_stack_ir : t
|
|
241
|
-
(** optimize Stack IR *)
|
|
242
|
-
|
|
243
283
|
val pick_load_signs : t
|
|
244
284
|
(** pick load signs based on their uses *)
|
|
245
285
|
|
|
@@ -280,15 +320,15 @@ val print_function_map : t
|
|
|
280
320
|
val symbolmap : t
|
|
281
321
|
(** alias for print_function_map *)
|
|
282
322
|
|
|
283
|
-
val print_stack_ir : t
|
|
284
|
-
(** print out Stack IR (useful for internal debugging) *)
|
|
285
|
-
|
|
286
323
|
val remove_non_js_ops : t
|
|
287
324
|
(** removes operations incompatible with js *)
|
|
288
325
|
|
|
289
326
|
val remove_imports : t
|
|
290
327
|
(** removes imports and replaces them with nops *)
|
|
291
328
|
|
|
329
|
+
val remove_memory_init : t
|
|
330
|
+
(** removes memory initialization *)
|
|
331
|
+
|
|
292
332
|
val remove_memory : t
|
|
293
333
|
(** removes memory segments *)
|
|
294
334
|
|
|
@@ -307,15 +347,15 @@ val remove_unused_names : t
|
|
|
307
347
|
val remove_unused_types : t
|
|
308
348
|
(** remove unused private GC types *)
|
|
309
349
|
|
|
350
|
+
val reorder_functions_by_name : t
|
|
351
|
+
(** sorts functions by name (useful for debugging) *)
|
|
352
|
+
|
|
310
353
|
val reorder_functions : t
|
|
311
354
|
(** sorts functions by access frequency *)
|
|
312
355
|
|
|
313
356
|
val reorder_globals : t
|
|
314
357
|
(** sorts globals by access frequency *)
|
|
315
358
|
|
|
316
|
-
val reorder_globals_always : t
|
|
317
|
-
(** sorts globals by access frequency (even if there are few) *)
|
|
318
|
-
|
|
319
359
|
val reorder_locals : t
|
|
320
360
|
(** sorts locals by access frequency *)
|
|
321
361
|
|
|
@@ -334,6 +374,9 @@ val safe_heap : t
|
|
|
334
374
|
val set_globals : t
|
|
335
375
|
(** sets specified globals to specified values *)
|
|
336
376
|
|
|
377
|
+
val separate_data_segments : t
|
|
378
|
+
(** write data segments to a file and strip them from the module *)
|
|
379
|
+
|
|
337
380
|
val signature_pruning : t
|
|
338
381
|
(** remove params from function signature types where possible *)
|
|
339
382
|
|
|
@@ -384,6 +427,22 @@ val ssa : t
|
|
|
384
427
|
val ssa_nomerge : t
|
|
385
428
|
(** ssa-ify variables so that they have a single assignment, ignoring merges *)
|
|
386
429
|
|
|
430
|
+
val string_gathering : t
|
|
431
|
+
(** gathers wasm strings to globals *)
|
|
432
|
+
|
|
433
|
+
val string_lifting : t
|
|
434
|
+
(** lift string imports to wasm strings *)
|
|
435
|
+
|
|
436
|
+
val string_lowering : t
|
|
437
|
+
(** lowers wasm strings and operations to imports *)
|
|
438
|
+
|
|
439
|
+
val string_lowering_magic_imports : t
|
|
440
|
+
(** same as string-lowering, but encodes well-formed strings as magic imports *)
|
|
441
|
+
|
|
442
|
+
val string_lowering_magic_imports_assert : t
|
|
443
|
+
(** same as string-lowering-magic-imports, but raise a fatal error if there are
|
|
444
|
+
invalid strings *)
|
|
445
|
+
|
|
387
446
|
val strip : t
|
|
388
447
|
(** deprecated; same as strip-debug *)
|
|
389
448
|
|
|
@@ -405,18 +464,33 @@ val strip_eh : t
|
|
|
405
464
|
val strip_target_features : t
|
|
406
465
|
(** strip the wasm target features section *)
|
|
407
466
|
|
|
467
|
+
val translate_to_exnref : t
|
|
468
|
+
(** translate old Phase 3 EH instructions to new ones with exnref *)
|
|
469
|
+
|
|
408
470
|
val trap_mode_clamp : t
|
|
409
471
|
(** replace trapping operations with clamping semantics *)
|
|
410
472
|
|
|
411
473
|
val trap_mode_js : t
|
|
412
474
|
(** replace trapping operations with js semantics *)
|
|
413
475
|
|
|
476
|
+
val tuple_optimization : t
|
|
477
|
+
(** optimize trivial tuples away *)
|
|
478
|
+
|
|
479
|
+
val type_finalizing : t
|
|
480
|
+
(** mark all leaf types as final *)
|
|
481
|
+
|
|
414
482
|
val type_merging : t
|
|
415
483
|
(** merge types to their supertypes where possible *)
|
|
416
484
|
|
|
417
485
|
val type_ssa : t
|
|
418
486
|
(** create new nominal types to help other optimizations *)
|
|
419
487
|
|
|
488
|
+
val type_unfinalizing : t
|
|
489
|
+
(** mark all types as non-final (open) *)
|
|
490
|
+
|
|
491
|
+
val unsubtyping : t
|
|
492
|
+
(** removes removes unnecessary subtyping relationships *)
|
|
493
|
+
|
|
420
494
|
val untee : t
|
|
421
495
|
(** removes local.tees, replacing them with sets and gets *)
|
|
422
496
|
|
binaryen-archive/src/settings.c
CHANGED
|
@@ -52,6 +52,36 @@ caml_binaryen_set_debug_info(value _on) {
|
|
|
52
52
|
CAMLreturn(Val_unit);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
CAMLprim value
|
|
56
|
+
caml_binaryen_get_traps_never_happen(value unit) {
|
|
57
|
+
CAMLparam1(unit);
|
|
58
|
+
bool res = BinaryenGetTrapsNeverHappen();
|
|
59
|
+
CAMLreturn(Val_bool(res));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
CAMLprim value
|
|
63
|
+
caml_binaryen_set_traps_never_happen(value _on) {
|
|
64
|
+
CAMLparam1(_on);
|
|
65
|
+
bool on = Bool_val(_on);
|
|
66
|
+
BinaryenSetTrapsNeverHappen(on);
|
|
67
|
+
CAMLreturn(Val_unit);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
CAMLprim value
|
|
71
|
+
caml_binaryen_get_closed_world(value unit) {
|
|
72
|
+
CAMLparam1(unit);
|
|
73
|
+
bool res = BinaryenGetClosedWorld();
|
|
74
|
+
CAMLreturn(Val_bool(res));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
CAMLprim value
|
|
78
|
+
caml_binaryen_set_closed_world(value _on) {
|
|
79
|
+
CAMLparam1(_on);
|
|
80
|
+
bool on = Bool_val(_on);
|
|
81
|
+
BinaryenSetClosedWorld(on);
|
|
82
|
+
CAMLreturn(Val_unit);
|
|
83
|
+
}
|
|
84
|
+
|
|
55
85
|
CAMLprim value
|
|
56
86
|
caml_binaryen_get_low_memory_unused(value unit) {
|
|
57
87
|
CAMLparam1(unit);
|
|
@@ -67,6 +97,66 @@ caml_binaryen_set_low_memory_unused(value _on) {
|
|
|
67
97
|
CAMLreturn(Val_unit);
|
|
68
98
|
}
|
|
69
99
|
|
|
100
|
+
CAMLprim value
|
|
101
|
+
caml_binaryen_get_zero_filled_memory(value unit) {
|
|
102
|
+
CAMLparam1(unit);
|
|
103
|
+
bool res = BinaryenGetZeroFilledMemory();
|
|
104
|
+
CAMLreturn(Val_bool(res));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
CAMLprim value
|
|
108
|
+
caml_binaryen_set_zero_filled_memory(value _on) {
|
|
109
|
+
CAMLparam1(_on);
|
|
110
|
+
bool on = Bool_val(_on);
|
|
111
|
+
BinaryenSetZeroFilledMemory(on);
|
|
112
|
+
CAMLreturn(Val_unit);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
CAMLprim value
|
|
116
|
+
caml_binaryen_get_fast_math(value unit) {
|
|
117
|
+
CAMLparam1(unit);
|
|
118
|
+
bool res = BinaryenGetFastMath();
|
|
119
|
+
CAMLreturn(Val_bool(res));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
CAMLprim value
|
|
123
|
+
caml_binaryen_set_fast_math(value _on) {
|
|
124
|
+
CAMLparam1(_on);
|
|
125
|
+
bool on = Bool_val(_on);
|
|
126
|
+
BinaryenSetFastMath(on);
|
|
127
|
+
CAMLreturn(Val_unit);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
CAMLprim value
|
|
131
|
+
caml_binaryen_get_generate_stack_ir(value unit) {
|
|
132
|
+
CAMLparam1(unit);
|
|
133
|
+
bool res = BinaryenGetGenerateStackIR();
|
|
134
|
+
CAMLreturn(Val_bool(res));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
CAMLprim value
|
|
138
|
+
caml_binaryen_set_generate_stack_ir(value _on) {
|
|
139
|
+
CAMLparam1(_on);
|
|
140
|
+
bool on = Bool_val(_on);
|
|
141
|
+
BinaryenSetGenerateStackIR(on);
|
|
142
|
+
CAMLreturn(Val_unit);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
CAMLprim value
|
|
146
|
+
caml_binaryen_get_optimize_stack_ir(value unit) {
|
|
147
|
+
CAMLparam1(unit);
|
|
148
|
+
bool res = BinaryenGetOptimizeStackIR();
|
|
149
|
+
CAMLreturn(Val_bool(res));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
CAMLprim value
|
|
153
|
+
caml_binaryen_set_optimize_stack_ir(value _on) {
|
|
154
|
+
CAMLparam1(_on);
|
|
155
|
+
bool on = Bool_val(_on);
|
|
156
|
+
BinaryenSetOptimizeStackIR(on);
|
|
157
|
+
CAMLreturn(Val_unit);
|
|
158
|
+
}
|
|
159
|
+
|
|
70
160
|
CAMLprim value
|
|
71
161
|
caml_binaryen_get_pass_argument(value _name) {
|
|
72
162
|
CAMLparam1(_name);
|
|
@@ -88,6 +178,36 @@ caml_binaryen_set_pass_argument(value _name, value _val) {
|
|
|
88
178
|
CAMLreturn(Val_unit);
|
|
89
179
|
}
|
|
90
180
|
|
|
181
|
+
CAMLprim value
|
|
182
|
+
caml_binaryen_clear_pass_arguments(value unit) {
|
|
183
|
+
CAMLparam1(unit);
|
|
184
|
+
BinaryenClearPassArguments();
|
|
185
|
+
CAMLreturn(Val_unit);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
CAMLprim value
|
|
189
|
+
caml_binaryen_has_pass_to_skip(value _pass) {
|
|
190
|
+
CAMLparam1(_pass);
|
|
191
|
+
const char* pass = Safe_String_val(_pass);
|
|
192
|
+
bool res = BinaryenHasPassToSkip(pass);
|
|
193
|
+
CAMLreturn(Val_bool(res));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
CAMLprim value
|
|
197
|
+
caml_binaryen_add_pass_to_skip(value _pass) {
|
|
198
|
+
CAMLparam1(_pass);
|
|
199
|
+
const char* pass = Safe_String_val(_pass);
|
|
200
|
+
BinaryenAddPassToSkip(pass);
|
|
201
|
+
CAMLreturn(Val_unit);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
CAMLprim value
|
|
205
|
+
caml_binaryen_clear_passes_to_skip(value unit) {
|
|
206
|
+
CAMLparam1(unit);
|
|
207
|
+
BinaryenClearPassesToSkip();
|
|
208
|
+
CAMLreturn(Val_unit);
|
|
209
|
+
}
|
|
210
|
+
|
|
91
211
|
CAMLprim value
|
|
92
212
|
caml_binaryen_get_always_inline_max_size(value unit) {
|
|
93
213
|
CAMLparam1(unit);
|
|
@@ -133,6 +253,21 @@ caml_binaryen_set_one_caller_inline_max_size(value _size) {
|
|
|
133
253
|
CAMLreturn(Val_unit);
|
|
134
254
|
}
|
|
135
255
|
|
|
256
|
+
CAMLprim value
|
|
257
|
+
caml_binaryen_get_allow_inlining_functions_with_loops(value unit) {
|
|
258
|
+
CAMLparam1(unit);
|
|
259
|
+
bool res = BinaryenGetAllowInliningFunctionsWithLoops();
|
|
260
|
+
CAMLreturn(Val_bool(res));
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
CAMLprim value
|
|
264
|
+
caml_binaryen_set_allow_inlining_functions_with_loops(value _size) {
|
|
265
|
+
CAMLparam1(_size);
|
|
266
|
+
int on = Bool_val(_size);
|
|
267
|
+
BinaryenSetAllowInliningFunctionsWithLoops(on);
|
|
268
|
+
CAMLreturn(Val_unit);
|
|
269
|
+
}
|
|
270
|
+
|
|
136
271
|
CAMLprim value
|
|
137
272
|
caml_binaryen_set_colors_enabled(value _on) {
|
|
138
273
|
CAMLparam1(_on);
|