Skip to content

Commit 8eed375

Browse files
committed
feat: Update Passes
1 parent 55724f6 commit 8eed375

File tree

2 files changed

+182
-30
lines changed

2 files changed

+182
-30
lines changed

src/passes.ml

Lines changed: 93 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,18 @@ let const_hoisting = "const-hoisting"
3737
(** propagate constant struct field values *)
3838
let cfp = "cfp"
3939

40+
(** propagate constant struct field values, using ref.test *)
41+
let cfp_reftest = "cfp-reftest"
42+
4043
(** removes unreachable code *)
4144
let dce = "dce"
4245

4346
(** forces all loads and stores to have alignment 1 *)
4447
let dealign = "dealign"
4548

49+
(** propagate debug location from parents or previous siblings to child nodes *)
50+
let propagate_debug_locs = "propagate-debug-locs"
51+
4652
(** instrument the wasm to convert NaNs into 0 at runtime *)
4753
let denan = "denan"
4854

@@ -67,6 +73,9 @@ let duplicate_function_elimination = "duplicate-function-elimination"
6773
(** emit the target features section in the output *)
6874
let emit_target_features = "emit-target-features"
6975

76+
(** modify the wasm (destructively) for closed-world *)
77+
let enclose_world = "enclose-world"
78+
7079
(** leaves just one function (useful for debugging) *)
7180
let extract_function = "extract-function"
7281

@@ -94,9 +103,6 @@ let generate_i64_dyncalls = "generate-i64-dyncalls"
94103
(** generate global effect info (helps later passes) *)
95104
let generate_global_effects = "generate-global-effects"
96105

97-
(** generate Stack IR *)
98-
let generate_stack_ir = "generate-stack-ir"
99-
100106
(** refine the types of globals *)
101107
let global_refining = "global-refining"
102108

@@ -110,15 +116,30 @@ let gto = "gto"
110116
about what content can actually appear in each location *)
111117
let gufa = "gufa"
112118

119+
(** GUFA plus add casts for all inferences *)
120+
let gufa_cast_all = "gufa-cast-all"
121+
113122
(** GUFA plus local optimizations in functions we modified *)
114123
let gufa_optimizing = "gufa-optimizing"
115124

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+
116131
(** apply more specific subtypes to type fields where possible *)
117132
let type_refining = "type-refining"
118133

134+
(** apply more specific subtypes to type fields where possible (using GUFA) *)
135+
let type_refining_gufa = "type-refining-gufa"
136+
119137
(** replace GC allocations with locals *)
120138
let heap2local = "heap2local"
121139

140+
(** optimize heap (GC) stores *)
141+
let heap_store_optimization = "heap-store-optimization"
142+
122143
(** inline __original_main into main *)
123144
let inline_main = "inline-main"
124145

@@ -137,9 +158,8 @@ let jspi = "jspi"
137158
(** legalizes i64 types on the import/export boundary *)
138159
let legalize_js_interface = "legalize-js-interface"
139160

140-
(** legalizes i64 types on the import/export boundary in a minimal manner, only
141-
on things only JS will call *)
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"
143163

144164
(** common subexpression elimination inside basic blocks *)
145165
let local_cse = "local-cse"
@@ -153,6 +173,9 @@ let log_execution = "log-execution"
153173
(** lower all uses of i64s to use i32s instead *)
154174
let i64_to_i32_lowering = "i64-to-i32-lowering"
155175

176+
(** instrument the build with code to intercept specific function calls *)
177+
let trace_calls = "trace-calls"
178+
156179
(** instrument the build with code to intercept all loads and stores *)
157180
let instrument_locals = "instrument-locals"
158181

@@ -168,6 +191,13 @@ let limit_segments = "limit-segments"
168191
(** lower loads and stores to a 64-bit memory to instead use a 32-bit one *)
169192
let memory64_lowering = "memory64-lowering"
170193

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+
171201
(** packs memory into separate segments, skipping zeros *)
172202
let memory_packing = "memory-packing"
173203

@@ -196,6 +226,9 @@ let minify_imports_and_exports = "minify-imports-and-exports"
196226
let minify_imports_and_exports_and_modules =
197227
"minify-imports-and-exports-and-modules"
198228

229+
(** Split types into minimal recursion groups *)
230+
let minimize_rec_groups = "minimize-rec-groups"
231+
199232
(** apply the assumption that asyncify imports always unwind, and we never
200233
rewind *)
201234
let mod_asyncify_always_and_only_unwind = "mod-asyncify-always-and-only-unwind"
@@ -223,6 +256,19 @@ let nm = "nm"
223256
(** (re)name all heap types *)
224257
let name_types = "name-types"
225258

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+
226272
(** reduces calls to code that only runs once *)
227273
let once_reduction = "once-reduction"
228274

@@ -239,9 +285,6 @@ let optimize_casts = "optimize-casts"
239285
(** optimizes instruction combinations *)
240286
let optimize_instructions = "optimize-instructions"
241287

242-
(** optimize Stack IR *)
243-
let optimize_stack_ir = "optimize-stack-ir"
244-
245288
(** pick load signs based on their uses *)
246289
let pick_load_signs = "pick-load-signs"
247290

@@ -282,15 +325,15 @@ let print_function_map = "print-function-map"
282325
(** alias for print_function_map *)
283326
let symbolmap = "symbolmap"
284327

285-
(** print out Stack IR (useful for internal debugging) *)
286-
let print_stack_ir = "print-stack-ir"
287-
288328
(** removes operations incompatible with js *)
289329
let remove_non_js_ops = "remove-non-js-ops"
290330

291331
(** removes imports and replaces them with nops *)
292332
let remove_imports = "remove-imports"
293333

334+
(** removes memory initialization *)
335+
let remove_memory_init = "remove-memory-init"
336+
294337
(** removes memory segments *)
295338
let remove_memory = "remove-memory"
296339

@@ -310,15 +353,15 @@ let remove_unused_names = "remove-unused-names"
310353
(** remove unused private GC types *)
311354
let remove_unused_types = "remove-unused-types"
312355

356+
(** sorts functions by name (useful for debugging) *)
357+
let reorder_functions_by_name = "reorder-functions-by-name"
358+
313359
(** sorts functions by access frequency *)
314360
let reorder_functions = "reorder-functions"
315361

316362
(** sorts globals by access frequency *)
317363
let reorder_globals = "reorder-globals"
318364

319-
(** sorts globals by access frequency (even if there are few) *)
320-
let reorder_globals_always = "reorder-globals-always"
321-
322365
(** sorts locals by access frequency *)
323366
let reorder_locals = "reorder-locals"
324367

@@ -337,6 +380,9 @@ let safe_heap = "safe-heap"
337380
(** sets specified globals to specified values *)
338381
let set_globals = "set-globals"
339382

383+
(** write data segments to a file and strip them from the module *)
384+
let separate_data_segments = "separate-data-segments"
385+
340386
(** remove params from function signature types where possible *)
341387
let signature_pruning = "signature-pruning"
342388

@@ -388,6 +434,23 @@ let ssa = "ssa"
388434
(** ssa-ify variables so that they have a single assignment, ignoring merges *)
389435
let ssa_nomerge = "ssa-nomerge"
390436

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+
391454
(** deprecated; same as strip-debug *)
392455
let strip = "strip"
393456

@@ -409,18 +472,33 @@ let strip_eh = "strip-eh"
409472
(** strip the wasm target features section *)
410473
let strip_target_features = "strip-target-features"
411474

475+
(** translate old Phase 3 EH instructions to new ones with exnref *)
476+
let translate_to_exnref = "translate-to-exnref"
477+
412478
(** replace trapping operations with clamping semantics *)
413479
let trap_mode_clamp = "trap-mode-clamp"
414480

415481
(** replace trapping operations with js semantics *)
416482
let trap_mode_js = "trap-mode-js"
417483

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+
418490
(** merge types to their supertypes where possible *)
419491
let type_merging = "type-merging"
420492

421493
(** create new nominal types to help other optimizations *)
422494
let type_ssa = "type-ssa"
423495

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+
424502
(** removes local.tees, replacing them with sets and gets *)
425503
let untee = "untee"
426504

0 commit comments

Comments
 (0)