OS Manuals

/usr/bin/wasm2js

Optimizer and compiler/toolchain library for WebAssembly

From binaryen 133-r0 (os), captured 2026-11-05 by running wasm2js --help (exit 0). permalink

================================================================================
wasm2js INFILE

Transform .wasm/.wat files to asm.js
================================================================================


wasm2js options:
----------------

  --output,-o                                   Output file (stdout if not
                                                specified)

  --allow-asserts                               Allow compilation of .wast
                                                testing asserts

  --pedantic                                    Emulate WebAssembly trapping
                                                behavior

  --emscripten                                  Emulate the glue in
                                                emscripten-compatible form (and
                                                not ES6 module form)

  --deterministic                               Replace WebAssembly trapping
                                                behavior deterministically (the
                                                default is to not care about
                                                what would trap in wasm, like a
                                                load out of bounds or integer
                                                divide by zero; with this flag,
                                                we try to be deterministic at
                                                least in what happens, which
                                                might or might not be to trap
                                                like wasm, but at least should
                                                not vary)

  --symbols-file                                Emit a symbols file that maps
                                                function indexes to their
                                                original names


Optimization passes:
--------------------

  --abstract-type-refining                      refine and merge abstract
                                                (never-created) types

  --alignment-lowering                          lower unaligned loads and stores
                                                to smaller aligned ones

  --asyncify                                    async/await style transform,
                                                allowing pausing and resuming

  --avoid-reinterprets                          Tries to avoid reinterpret
                                                operations via more loads

  --cfp                                         propagate constant struct field
                                                values

  --cfp-reftest                                 propagate constant struct field
                                                values, using ref.test

  --coalesce-locals                             reduce # of locals by coalescing

  --coalesce-locals-learning                    reduce # of locals by coalescing
                                                and learning

  --code-folding                                fold code, merging duplicates

  --code-pushing                                push code forward, potentially
                                                making it not always execute

  --const-hoisting                              hoist repeated constants to a
                                                local

  --constraint-analysis                         finds and uses mathematical
                                                constraints on locals

  --dae                                         removes arguments to calls in an
                                                lto-like manner

  --dae-optimizing                              removes arguments to calls in an
                                                lto-like manner, and optimizes
                                                where we removed

  --dae2                                        Experimental reimplementation of
                                                DAE

  --dce                                         removes unreachable code

  --dealign                                     forces all loads and stores to
                                                have alignment 1

  --denan                                       instrument the wasm to convert
                                                NaNs into 0 at runtime

  --dfo                                         optimizes using the DataFlow SSA
                                                IR

  --directize                                   turns indirect calls into direct
                                                ones

  --discard-global-effects                      discards global effect info

  --duplicate-function-elimination              removes duplicate functions

  --duplicate-import-elimination                removes duplicate imports

  --dwarfdump                                   dump DWARF debug info sections
                                                from the read binary

  --emit-target-features                        emit the target features section
                                                in the output

  --enclose-world                               modify the wasm (destructively)
                                                for closed-world

  --extract-function                            leaves just one function (useful
                                                for debugging)

  --extract-function-index                      leaves just one function
                                                selected by index

  --flatten                                     flattens out code, removing
                                                nesting

  --fpcast-emu                                  emulates function pointer casts,
                                                allowing incorrect indirect
                                                calls to (sometimes) work

  --func-metrics                                reports function metrics

  --generate-dyncalls                           generate dynCall functions used
                                                by emscripten ABI

  --generate-global-effects                     generate global effect info
                                                (helps later passes)

  --generate-i64-dyncalls                       generate dynCall functions used
                                                by emscripten ABI, but only for
                                                functions with i64 in their
                                                signature (which cannot be
                                                invoked via the wasm table
                                                without JavaScript BigInt
                                                support).

  --global-refining                             refine the types of globals

  --gsi                                         globally optimize struct values

  --gsi-desc-cast                               globally optimize struct values,
                                                also emitting ref.cast_desc_eq

  --gto                                         globally optimize GC types

  --gufa                                        Grand Unified Flow Analysis:
                                                optimize the entire program
                                                using information about what
                                                content can actually appear in
                                                each location

  --gufa-cast-all                               GUFA plus add casts for all
                                                inferences

  --gufa-optimizing                             GUFA plus local optimizations in
                                                functions we modified

  --heap-store-optimization                     optimize heap (GC) stores

  --heap2local                                  replace GC allocations with
                                                locals

  --i64-to-i32-lowering                         lower all uses of i64s to use
                                                i32s instead

  --inline-main                                 inline __original_main into main

  --inlining                                    inline functions (you probably
                                                want inlining-optimizing)

  --inlining-optimizing                         inline functions and optimizes
                                                where we inlined

  --instrument-branch-hints                     instrument branch hints so we
                                                can see which guessed right

  --instrument-locals                           instrument the build with code
                                                to intercept all loads and
                                                stores

  --instrument-memory                           instrument the build with code
                                                to intercept all loads and
                                                stores

  --intrinsic-lowering                          lower away binaryen intrinsics

  --legalize-and-prune-js-interface             legalizes the import/export
                                                boundary and prunes when needed

  --legalize-js-interface                       legalizes i64 types on the
                                                import/export boundary

  --licm                                        loop invariant code motion

  --limit-segments                              attempt to merge segments to fit
                                                within web limits

  --llvm-memory-copy-fill-lowering              Lower memory.copy and
                                                memory.fill to wasm mvp and
                                                disable the bulk-memory feature.

  --llvm-nontrapping-fptoint-lowering           lower nontrapping float-to-int
                                                operations to wasm mvp and
                                                disable the nontrapping fptoint
                                                feature

  --local-cse                                   common subexpression elimination
                                                inside basic blocks

  --local-subtyping                             apply more specific subtypes to
                                                locals where possible

  --log-execution                               instrument the build with
                                                logging of where execution goes

  --make-shared-objects                         Make structs and arrays shared
                                                and functions unshared

  --mark-js-called                              mark js called functions (using
                                                configureAll) as doing so

  --memory-packing                              packs memory into separate
                                                segments, skipping zeros

  --memory64-lowering                           lower loads and stores to a
                                                64-bit memory to instead use a
                                                32-bit one

  --merge-blocks                                merges blocks to their parents

  --merge-j2cl-itables                          Merges itable structures into
                                                vtables to make types more
                                                compact

  --merge-locals                                merges locals when beneficial

  --merge-similar-functions                     merges similar functions when
                                                beneficial

  --metrics                                     reports metrics (with an
                                                optional title,
                                                --metrics[=TITLE])

  --minify-imports                              minifies import names (only
                                                those, and not export names),
                                                and emits a mapping to the
                                                minified ones

  --minify-imports-and-exports                  minifies both import and export
                                                names, and emits a mapping to
                                                the minified ones

  --minify-imports-and-exports-and-modules      minifies both import and export
                                                names, and emits a mapping to
                                                the minified ones, and minifies
                                                the modules as well

  --minimize-rec-groups                         Split types into minimal
                                                recursion groups

  --monomorphize                                creates specialized versions of
                                                functions

  --monomorphize-always                         creates specialized versions of
                                                functions (even if unhelpful)

  --multi-memory-lowering                       combines multiple memories into
                                                a single memory

  --multi-memory-lowering-with-bounds-checks    combines multiple memories into
                                                a single memory, trapping if the
                                                read or write is larger than the
                                                length of the memory's data

  --name-types                                  (re)name all heap types

  --nm                                          name list

  --no-full-inline                              mark functions as no-inline (for
                                                full inlining only)

  --no-inline                                   mark functions as no-inline

  --no-partial-inline                           mark functions as no-inline (for
                                                partial inlining only)

  --once-reduction                              reduces calls to code that only
                                                runs once

  --optimize-added-constants                    optimizes added constants into
                                                load/store offsets

  --optimize-added-constants-propagate          optimizes added constants into
                                                load/store offsets, propagating
                                                them across locals too

  --optimize-casts                              eliminate and reuse casts

  --optimize-for-js                             early optimize of the
                                                instruction combinations for js

  --optimize-instructions                       optimizes instruction
                                                combinations

  --optimize-j2cl                               optimizes J2CL specific
                                                constructs.

  --outlining                                   outline instructions

  --pick-load-signs                             pick load signs based on their
                                                uses

  --poppify                                     Transform Binaryen IR into Poppy
                                                IR

  --post-emscripten                             miscellaneous optimizations for
                                                Emscripten-generated code

  --precompute                                  computes compile-time
                                                evaluatable expressions

  --precompute-propagate                        computes compile-time
                                                evaluatable expressions and
                                                propagates them through locals

  --print                                       print in s-expression format

  --print-boundary                              print boundary in JSON format

  --print-call-graph                            print call graph

  --print-features                              print options for enabled
                                                features

  --print-full                                  print in full s-expression
                                                format

  --print-function-map                          print a map of function indexes
                                                to names

  --print-minified                              print in minified s-expression
                                                format

  --propagate-debug-locs                        propagate debug location from
                                                parents or previous siblings to
                                                child nodes

  --propagate-globals-globally                  propagate global values to other
                                                globals (useful for tests)

  --remove-empty-function-exports               removes exports of empty
                                                functions

  --remove-exports                              removes exports using a wildcard

  --remove-imports                              removes imports and replaces
                                                them with nops

  --remove-memory                               removes memory init (legacy
                                                name)

  --remove-memory-init                          removes memory initialization

  --remove-non-js-ops                           removes operations incompatible
                                                with js

  --remove-relaxed-simd                         replaces relaxed SIMD
                                                instructions with unreachable

  --remove-unused-brs                           removes breaks from locations
                                                that are not needed

  --remove-unused-module-elements               removes unused module elements

  --remove-unused-names                         removes names from locations
                                                that are never branched to

  --remove-unused-nonfunction-module-elements   removes unused module elements
                                                that are not functions

  --remove-unused-types                         remove unused private GC types

  --reorder-functions                           sorts functions by access
                                                frequency

  --reorder-functions-by-name                   sorts functions by name (useful
                                                for debugging)

  --reorder-globals                             sorts globals by access
                                                frequency

  --reorder-locals                              sorts locals by access frequency

  --reorder-types                               sorts private types by access
                                                frequency

  --rereloop                                    re-optimize control flow using
                                                the relooper algorithm

  --roundtrip                                   write the module to binary, then
                                                read it

  --rse                                         remove redundant local.sets

  --safe-heap                                   instrument loads and stores to
                                                check for invalid behavior

  --separate-data-segments                      write data segments to a file
                                                and strip them from the module

  --set-globals                                 sets specified globals to
                                                specified values

  --signature-pruning                           remove params from function
                                                signature types where possible

  --signature-refining                          apply more specific subtypes to
                                                signature types where possible

  --signext-lowering                            lower sign-ext operations to
                                                wasm mvp and disable the sign
                                                extension feature

  --simplify-globals                            miscellaneous globals-related
                                                optimizations

  --simplify-globals-optimizing                 miscellaneous globals-related
                                                optimizations, and optimizes
                                                where we replaced global.gets
                                                with constants

  --simplify-locals                             miscellaneous locals-related
                                                optimizations

  --simplify-locals-nonesting                   miscellaneous locals-related
                                                optimizations (no nesting at
                                                all; preserves flatness)

  --simplify-locals-nostructure                 miscellaneous locals-related
                                                optimizations (no structure)

  --simplify-locals-notee                       miscellaneous locals-related
                                                optimizations (no tees)

  --simplify-locals-notee-nostructure           miscellaneous locals-related
                                                optimizations (no tees or
                                                structure)

  --souperify                                   emit Souper IR in text form

  --souperify-single-use                        emit Souper IR in text form
                                                (single-use nodes only)

  --spill-pointers                              spill pointers to the C stack
                                                (useful for Boehm-style GC)

  --ssa                                         ssa-ify variables so that they
                                                have a single assignment

  --ssa-nomerge                                 ssa-ify variables so that they
                                                have a single assignment,
                                                ignoring merges

  --stack-check                                 enforce limits on llvm's
                                                __stack_pointer global

  --string-gathering                            gathers wasm strings to globals

  --string-lifting                              lift string imports to wasm
                                                strings

  --string-lowering                             lowers wasm strings and
                                                operations to imports

  --string-lowering-magic-imports               same as string-lowering, but
                                                encodes well-formed strings as
                                                magic imports

  --string-lowering-magic-imports-assert        same as
                                                string-lowering-magic-imports,
                                                but raise a fatal error if there
                                                are invalid strings

  --strip                                       deprecated; same as strip-debug

  --strip-debug                                 strip debug info (including the
                                                names section)

  --strip-dwarf                                 strip dwarf debug info

  --strip-eh                                    strip EH instructions

  --strip-producers                             strip the wasm producers section

  --strip-target-features                       strip the wasm target features
                                                section

  --strip-toolchain-annotations                 strip all toolchain-specific
                                                code annotations

  --stub-unsupported-js                         stub out unsupported JS
                                                operations

  --symbolmap                                   (alias for print-function-map)

  --table64-lowering                            alias for memory64-lowering

  --tail-call                                   convert calls in tail position
                                                to return calls

  --trace-calls                                 instrument the build with code
                                                to intercept specific function
                                                calls

  --translate-to-exnref                         translate old Phase 3 EH
                                                instructions to new ones with
                                                exnref

  --translate-to-new-eh                         deprecated; same as
                                                translate-to-exnref

  --tuple-optimization                          optimize trivial tuples away

  --type-finalizing                             mark all leaf types as final

  --type-merging                                merge types to their supertypes
                                                where possible

  --type-refining                               apply more specific subtypes to
                                                type fields where possible

  --type-refining-gufa                          apply more specific subtypes to
                                                type fields where possible
                                                (using GUFA)

  --type-ssa                                    create new types to help other
                                                optimizations

  --type-unfinalizing                           mark all types as non-final
                                                (open)

  --unsubtyping                                 removes unnecessary subtyping
                                                relationships

  --untee                                       removes local.tees, replacing
                                                them with sets and gets

  --vacuum                                      removes obviously unneeded code


Optimization options:
---------------------

   -O                                           execute default optimization
                                                passes (equivalent to -Os)

   -O0                                          execute no optimization passes

   -O1                                          execute -O1 optimization passes
                                                (quick&useful opts, useful for
                                                iteration builds)

   -O2                                          execute -O2 optimization passes
                                                (most opts, generally gets most
                                                perf)

   -O3                                          execute -O3 optimization passes
                                                (spends potentially a lot of
                                                time optimizing)

   -O4                                          execute -O4 optimization passes
                                                (also flatten the IR, which can
                                                take a lot more time and memory,
                                                but is useful on more nested /
                                                complex / less-optimized input)

   -Os                                          execute default optimization
                                                passes, focusing on code size

   -Oz                                          execute default optimization
                                                passes, super-focusing on code
                                                size

  --optimize-level,-ol                          How much to focus on optimizing
                                                code

  --shrink-level,-s                             How much to focus on shrinking
                                                code size

  --debuginfo,-g                                Emit names section in wasm
                                                binary (or full debuginfo in
                                                wast)

  --always-inline-max-function-size,-aimfs      Max size of functions that are
                                                always inlined (default 2, which
                                                is safe for use with -Os builds)

  --flexible-inline-max-function-size,-fimfs    Max size of functions that are
                                                inlined when lightweight (no
                                                loops or function calls) when
                                                optimizing aggressively for
                                                speed (-O3). Default: 20

  --one-caller-inline-max-function-size,-ocimfs Max size of functions that are
                                                inlined when there is only one
                                                caller (default -1, which means
                                                all such functions are inlined)

  --inline-max-combined-binary-size,-imcbs      Max size of combined functions
                                                after inlining. Default: 409600

  --inline-functions-with-loops,-ifwl           Allow inlining functions with
                                                loops

  --partial-inlining-ifs,-pii                   Number of ifs allowed in partial
                                                inlining (zero means partial
                                                inlining is disabled) (default:
                                                0)

  --ignore-implicit-traps,-iit                  Optimize under the helpful
                                                assumption that no surprising
                                                traps occur (from load, div/mod,
                                                etc.)

  --traps-never-happen,-tnh                     Optimize under the helpful
                                                assumption that no trap is
                                                reached at runtime (from load,
                                                div/mod, etc.)

  --low-memory-unused,-lmu                      Optimize under the helpful
                                                assumption that the low 1K of
                                                memory is not used by the
                                                application

  --fast-math,-ffm                              Optimize floats without handling
                                                corner cases of NaNs, rounding,
                                                and negative zero

  --zero-filled-memory,-uim                     Assume that an imported memory
                                                will be zero-initialized

  --skip-pass,-sp                               Skip a pass (do not run it)


Tool options:
-------------

  --mvp-features,-mvp                           Disable all non-MVP features

  --all-features,-all                           Enable all features

  --detect-features                             (deprecated - this flag does
                                                nothing)

  --quiet,-q                                    Emit less verbose output and
                                                hide trivial warnings.

  --experimental-poppy                          Parse wast files as Poppy IR for
                                                testing purposes.

  --emit-module-names                           Emit module names, even if not
                                                emitting the rest of the names
                                                section.

  --enable-sign-ext                             Enable sign extension operations

  --disable-sign-ext                            Disable sign extension
                                                operations

  --enable-threads                              Enable atomic operations

  --disable-threads                             Disable atomic operations

  --enable-mutable-globals                      Enable mutable globals

  --disable-mutable-globals                     Disable mutable globals

  --enable-nontrapping-float-to-int             Enable nontrapping float-to-int
                                                operations

  --disable-nontrapping-float-to-int            Disable nontrapping float-to-int
                                                operations

  --enable-simd                                 Enable SIMD operations and types

  --disable-simd                                Disable SIMD operations and
                                                types

  --enable-bulk-memory                          Enable bulk memory operations

  --disable-bulk-memory                         Disable bulk memory operations

  --enable-bulk-memory-opt                      Enable memory.copy and
                                                memory.fill

  --disable-bulk-memory-opt                     Disable memory.copy and
                                                memory.fill

  --enable-call-indirect-overlong               Enable LEB encoding of
                                                call-indirect (Ignored for
                                                compatibility as it has no
                                                effect on Binaryen)

  --disable-call-indirect-overlong              Disable LEB encoding of
                                                call-indirect (Ignored for
                                                compatibility as it has no
                                                effect on Binaryen)

  --enable-exception-handling                   Enable exception handling
                                                operations

  --disable-exception-handling                  Disable exception handling
                                                operations

  --enable-tail-call                            Enable tail call operations

  --disable-tail-call                           Disable tail call operations

  --enable-reference-types                      Enable reference types

  --disable-reference-types                     Disable reference types

  --enable-multivalue                           Enable multivalue functions

  --disable-multivalue                          Disable multivalue functions

  --enable-gc                                   Enable garbage collection

  --disable-gc                                  Disable garbage collection

  --enable-memory64                             Enable memory64

  --disable-memory64                            Disable memory64

  --enable-relaxed-simd                         Enable relaxed SIMD

  --disable-relaxed-simd                        Disable relaxed SIMD

  --enable-extended-const                       Enable extended const
                                                expressions

  --disable-extended-const                      Disable extended const
                                                expressions

  --enable-strings                              Enable strings

  --disable-strings                             Disable strings

  --enable-multimemory                          Enable multimemory

  --disable-multimemory                         Disable multimemory

  --enable-stack-switching                      Enable stack switching

  --disable-stack-switching                     Disable stack switching

  --enable-shared-everything                    Enable shared-everything threads

  --disable-shared-everything                   Disable shared-everything
                                                threads

  --enable-fp16                                 Enable float 16 operations

  --disable-fp16                                Disable float 16 operations

  --enable-custom-descriptors                   Enable custom descriptors (RTTs)
                                                and exact references

  --disable-custom-descriptors                  Disable custom descriptors
                                                (RTTs) and exact references

  --enable-multibyte                            Enable multibyte array loads and
                                                stores

  --disable-multibyte                           Disable multibyte array loads
                                                and stores

  --enable-acquire-release-atomics              Enable acquire/release atomic
                                                memory operations

  --disable-acquire-release-atomics             Disable acquire/release atomic
                                                memory operations

  --enable-custom-page-sizes                    Enable custom page sizes

  --disable-custom-page-sizes                   Disable custom page sizes

  --enable-wide-arithmetic                      Enable wide arithmetic

  --disable-wide-arithmetic                     Disable wide arithmetic

  --enable-compact-imports                      Enable compact import section

  --disable-compact-imports                     Disable compact import section

  --enable-relaxed-atomics                      Enable relaxed atomic memory
                                                operations

  --disable-relaxed-atomics                     Disable relaxed atomic memory
                                                operations

  --enable-typed-function-references            Deprecated compatibility flag

  --disable-typed-function-references           Deprecated compatibility flag

  --no-validation,-n                            Disables validation, assumes
                                                inputs are correct

  --pass-arg,-pa                                An argument passed along to
                                                optimization passes being run.
                                                Must be in the form KEY@VALUE.
                                                If KEY is the name of a pass
                                                then it applies to the closest
                                                instance of that pass before us.
                                                If KEY is not the name of a pass
                                                then it is a global option that
                                                applies to all pass instances
                                                that read it.

  --closed-world,-cw                            Assume code outside of the
                                                module does not inspect or
                                                interact with GC and function
                                                references, even if they are
                                                passed out. The outside may hold
                                                on to them and pass them back
                                                in, but not inspect their
                                                contents or call them.

  --preserve-type-order                         Preserve the order of types from
                                                the input (useful for debugging
                                                and testing)

  --generate-stack-ir                           generate StackIR during writing

  --optimize-stack-ir                           optimize StackIR during writing

  --print-stack-ir                              print StackIR during writing

  --no-stack-ir                                 do not use StackIR (even when it
                                                is the default)


General options:
----------------

  --version                                     Output version information and
                                                exit

  --help,-h                                     Show this help message and exit

  --debug,-d                                    Print debug information to
                                                stderr
Options (275)
OptionDescriptionSource
--output, -oOutput file (stdout if not specified)help
--allow-assertsAllow compilation of .wast testing assertshelp
--pedanticEmulate WebAssembly trapping behaviorhelp
--emscriptenEmulate the glue in emscripten-compatible form (and not ES6 module form)help
--deterministicReplace WebAssembly trapping behavior deterministically (the default is to not care about what would trap in wasm, like a load out of bounds or integer divide by zero;help
--symbols-fileEmit a symbols file that maps function indexes to their original nameshelp
--abstract-type-refiningrefine and merge abstract (never-created) typeshelp
--alignment-loweringlower unaligned loads and stores to smaller aligned oneshelp
--asyncifyasync/await style transform, allowing pausing and resuminghelp
--avoid-reinterpretsTries to avoid reinterpret operations via more loadshelp
--cfppropagate constant struct field valueshelp
--cfp-reftestpropagate constant struct field values, using ref.testhelp
--coalesce-localsreduce # of locals by coalescinghelp
--coalesce-locals-learningreduce # of locals by coalescing and learninghelp
--code-foldingfold code, merging duplicateshelp
--code-pushingpush code forward, potentially making it not always executehelp
--const-hoistinghoist repeated constants to a localhelp
--constraint-analysisfinds and uses mathematical constraints on localshelp
--daeremoves arguments to calls in an lto-like mannerhelp
--dae-optimizingremoves arguments to calls in an lto-like manner, and optimizes where we removedhelp
--dae2Experimental reimplementation of DAEhelp
--dceremoves unreachable codehelp
--dealignforces all loads and stores to have alignment 1help
--denaninstrument the wasm to convert NaNs into 0 at runtimehelp
--dfooptimizes using the DataFlow SSA IRhelp
--directizeturns indirect calls into direct oneshelp
--discard-global-effectsdiscards global effect infohelp
--duplicate-function-eliminationremoves duplicate functionshelp
--duplicate-import-eliminationremoves duplicate importshelp
--dwarfdumpdump DWARF debug info sections from the read binaryhelp
--emit-target-featuresemit the target features section in the outputhelp
--enclose-worldmodify the wasm (destructively) for closed-worldhelp
--extract-functionleaves just one function (useful for debugging)help
--extract-function-indexleaves just one function selected by indexhelp
--flattenflattens out code, removing nestinghelp
--fpcast-emuemulates function pointer casts, allowing incorrect indirect calls to (sometimes) workhelp
--func-metricsreports function metricshelp
--generate-dyncallsgenerate dynCall functions used by emscripten ABIhelp
--generate-global-effectsgenerate global effect info (helps later passes)help
--generate-i64-dyncallsgenerate dynCall functions used by emscripten ABI, but only for functions with i64 in their signature (which cannot be invoked via the wasm table without JavaScript BigInt support).help
--global-refiningrefine the types of globalshelp
--gsiglobally optimize struct valueshelp
--gsi-desc-castglobally optimize struct values, also emitting ref.cast_desc_eqhelp
--gtoglobally optimize GC typeshelp
--gufaGrand Unified Flow Analysis: optimize the entire program using information about what content can actually appear in each locationhelp
--gufa-cast-allGUFA plus add casts for all inferenceshelp
--gufa-optimizingGUFA plus local optimizations in functions we modifiedhelp
--heap-store-optimizationoptimize heap (GC) storeshelp
--heap2localreplace GC allocations with localshelp
--i64-to-i32-loweringlower all uses of i64s to use i32s insteadhelp
--inline-maininline __original_main into mainhelp
--inlininginline functions (you probably want inlining-optimizing)help
--inlining-optimizinginline functions and optimizes where we inlinedhelp
--instrument-branch-hintsinstrument branch hints so we can see which guessed righthelp
--instrument-localsinstrument the build with code to intercept all loads and storeshelp
--instrument-memoryinstrument the build with code to intercept all loads and storeshelp
--intrinsic-loweringlower away binaryen intrinsicshelp
--legalize-and-prune-js-interfacelegalizes the import/export boundary and prunes when neededhelp
--legalize-js-interfacelegalizes i64 types on the import/export boundaryhelp
--licmloop invariant code motionhelp
--limit-segmentsattempt to merge segments to fit within web limitshelp
--llvm-memory-copy-fill-loweringLower memory.copy and memory.fill to wasm mvp and disable the bulk-memory feature.help
--llvm-nontrapping-fptoint-loweringlower nontrapping float-to-int operations to wasm mvp and disable the nontrapping fptoint featurehelp
--local-csecommon subexpression elimination inside basic blockshelp
--local-subtypingapply more specific subtypes to locals where possiblehelp
--log-executioninstrument the build with logging of where execution goeshelp
--make-shared-objectsMake structs and arrays shared and functions unsharedhelp
--mark-js-calledmark js called functions (using configureAll) as doing sohelp
--memory-packingpacks memory into separate segments, skipping zeroshelp
--memory64-loweringlower loads and stores to a 64-bit memory to instead use a 32-bit onehelp
--merge-blocksmerges blocks to their parentshelp
--merge-j2cl-itablesMerges itable structures into vtables to make types more compacthelp
--merge-localsmerges locals when beneficialhelp
--merge-similar-functionsmerges similar functions when beneficialhelp
--metricsreports metrics (with an optional title,help
--minify-importsminifies import names (only those, and not export names), and emits a mapping to the minified oneshelp
--minify-imports-and-exportsminifies both import and export names, and emits a mapping to the minified oneshelp
--minify-imports-and-exports-and-modulesminifies both import and export names, and emits a mapping to the minified ones, and minifies the modules as wellhelp
--minimize-rec-groupsSplit types into minimal recursion groupshelp
--monomorphizecreates specialized versions of functionshelp
--monomorphize-alwayscreates specialized versions of functions (even if unhelpful)help
--multi-memory-loweringcombines multiple memories into a single memoryhelp
--multi-memory-lowering-with-bounds-checkscombines multiple memories into a single memory, trapping if the read or write is larger than the length of the memory's datahelp
--name-types(re)name all heap typeshelp
--nmname listhelp
--no-full-inlinemark functions as no-inline (for full inlining only)help
--no-inlinemark functions as no-inlinehelp
--no-partial-inlinemark functions as no-inline (for partial inlining only)help
--once-reductionreduces calls to code that only runs oncehelp
--optimize-added-constantsoptimizes added constants into load/store offsetshelp
--optimize-added-constants-propagateoptimizes added constants into load/store offsets, propagating them across locals toohelp
--optimize-castseliminate and reuse castshelp
--optimize-for-jsearly optimize of the instruction combinations for jshelp
--optimize-instructionsoptimizes instruction combinationshelp
--optimize-j2cloptimizes J2CL specific constructs.help
--outliningoutline instructionshelp
--pick-load-signspick load signs based on their useshelp
--poppifyTransform Binaryen IR into Poppy IRhelp
--post-emscriptenmiscellaneous optimizations for Emscripten-generated codehelp
--precomputecomputes compile-time evaluatable expressionshelp
--precompute-propagatecomputes compile-time evaluatable expressions and propagates them through localshelp
--printprint in s-expression formathelp
--print-boundaryprint boundary in JSON formathelp
--print-call-graphprint call graphhelp
--print-featuresprint options for enabled featureshelp
--print-fullprint in full s-expression formathelp
--print-function-mapprint a map of function indexes to nameshelp
--print-minifiedprint in minified s-expression formathelp
--propagate-debug-locspropagate debug location from parents or previous siblings to child nodeshelp
--propagate-globals-globallypropagate global values to other globals (useful for tests)help
--remove-empty-function-exportsremoves exports of empty functionshelp
--remove-exportsremoves exports using a wildcardhelp
--remove-importsremoves imports and replaces them with nopshelp
--remove-memoryremoves memory init (legacy name)help
--remove-memory-initremoves memory initializationhelp
--remove-non-js-opsremoves operations incompatible with jshelp
--remove-relaxed-simdreplaces relaxed SIMD instructions with unreachablehelp
--remove-unused-brsremoves breaks from locations that are not neededhelp
--remove-unused-module-elementsremoves unused module elementshelp
--remove-unused-namesremoves names from locations that are never branched tohelp
--remove-unused-nonfunction-module-elementsremoves unused module elements that are not functionshelp
--remove-unused-typesremove unused private GC typeshelp
--reorder-functionssorts functions by access frequencyhelp
--reorder-functions-by-namesorts functions by name (useful for debugging)help
--reorder-globalssorts globals by access frequencyhelp
--reorder-localssorts locals by access frequencyhelp
--reorder-typessorts private types by access frequencyhelp
--rereloopre-optimize control flow using the relooper algorithmhelp
--roundtripwrite the module to binary, then read ithelp
--rseremove redundant local.setshelp
--safe-heapinstrument loads and stores to check for invalid behaviorhelp
--separate-data-segmentswrite data segments to a file and strip them from the modulehelp
--set-globalssets specified globals to specified valueshelp
--signature-pruningremove params from function signature types where possiblehelp
--signature-refiningapply more specific subtypes to signature types where possiblehelp
--signext-loweringlower sign-ext operations to wasm mvp and disable the sign extension featurehelp
--simplify-globalsmiscellaneous globals-related optimizationshelp
--simplify-globals-optimizingmiscellaneous globals-related optimizations, and optimizes where we replaced global.gets with constantshelp
--simplify-localsmiscellaneous locals-related optimizationshelp
--simplify-locals-nonestingmiscellaneous locals-related optimizations (no nesting at all;help
--simplify-locals-nostructuremiscellaneous locals-related optimizations (no structure)help
--simplify-locals-noteemiscellaneous locals-related optimizations (no tees)help
--simplify-locals-notee-nostructuremiscellaneous locals-related optimizations (no tees or structure)help
--souperifyemit Souper IR in text formhelp
--souperify-single-useemit Souper IR in text form (single-use nodes only)help
--spill-pointersspill pointers to the C stack (useful for Boehm-style GC)help
--ssassa-ify variables so that they have a single assignmenthelp
--ssa-nomergessa-ify variables so that they have a single assignment, ignoring mergeshelp
--stack-checkenforce limits on llvm's __stack_pointer globalhelp
--string-gatheringgathers wasm strings to globalshelp
--string-liftinglift string imports to wasm stringshelp
--string-loweringlowers wasm strings and operations to importshelp
--string-lowering-magic-importssame as string-lowering, but encodes well-formed strings as magic importshelp
--string-lowering-magic-imports-assertsame as string-lowering-magic-imports, but raise a fatal error if there are invalid stringshelp
--stripdeprecated;help
--strip-debugstrip debug info (including the names section)help
--strip-dwarfstrip dwarf debug infohelp
--strip-ehstrip EH instructionshelp
--strip-producersstrip the wasm producers sectionhelp
--strip-target-featuresstrip the wasm target features sectionhelp
--strip-toolchain-annotationsstrip all toolchain-specific code annotationshelp
--stub-unsupported-jsstub out unsupported JS operationshelp
--symbolmap(alias for print-function-map)help
--table64-loweringalias for memory64-loweringhelp
--tail-callconvert calls in tail position to return callshelp
--trace-callsinstrument the build with code to intercept specific function callshelp
--translate-to-exnreftranslate old Phase 3 EH instructions to new ones with exnrefhelp
--translate-to-new-ehdeprecated;help
--tuple-optimizationoptimize trivial tuples awayhelp
--type-finalizingmark all leaf types as finalhelp
--type-mergingmerge types to their supertypes where possiblehelp
--type-refiningapply more specific subtypes to type fields where possiblehelp
--type-refining-gufaapply more specific subtypes to type fields where possible (using GUFA)help
--type-ssacreate new types to help other optimizationshelp
--type-unfinalizingmark all types as non-final (open)help
--unsubtypingremoves unnecessary subtyping relationshipshelp
--unteeremoves local.tees, replacing them with sets and getshelp
--vacuumremoves obviously unneeded codehelp
-Oexecute default optimization passes (equivalent to -Os)help
-O0execute no optimization passeshelp
-O1execute -O1 optimization passes (quick&useful opts, useful for iteration builds)help
-O2execute -O2 optimization passes (most opts, generally gets most perf)help
-O3execute -O3 optimization passes (spends potentially a lot of time optimizing)help
-O4execute -O4 optimization passes (also flatten the IR, which can take a lot more time and memory, but is useful on more nested / complex / less-optimized input)help
-Osexecute default optimization passes, focusing on code sizehelp
-Ozexecute default optimization passes, super-focusing on code sizehelp
--optimize-level, -olHow much to focus on optimizing codehelp
--shrink-level, -sHow much to focus on shrinking code sizehelp
--debuginfo, -gEmit names section in wasm binary (or full debuginfo in wast)help
--always-inline-max-function-size, -aimfsMax size of functions that are always inlined (default 2, which is safe for use with -Os builds)help
--flexible-inline-max-function-size, -fimfsMax size of functions that are inlined when lightweight (no loops or function calls) when optimizing aggressively for speed (-O3).help
--inline-max-combined-binary-size, -imcbsMax size of combined functions after inlining.help
--inline-functions-with-loops, -ifwlAllow inlining functions with loopshelp
--partial-inlining-ifs, -piiNumber of ifs allowed in partial inlining (zero means partial inlining is disabled) (default: 0)help
--ignore-implicit-traps, -iitOptimize under the helpful assumption that no surprising traps occur (from load, div/mod, etc.)help
--traps-never-happen, -tnhOptimize under the helpful assumption that no trap is reached at runtime (from load, div/mod, etc.)help
--low-memory-unused, -lmuOptimize under the helpful assumption that the low 1K of memory is not used by the applicationhelp
--fast-math, -ffmOptimize floats without handling corner cases of NaNs, rounding, and negative zerohelp
--zero-filled-memory, -uimAssume that an imported memory will be zero-initializedhelp
--skip-pass, -spSkip a pass (do not run it)help
--mvp-features, -mvpDisable all non-MVP featureshelp
--all-features, -allEnable all featureshelp
--detect-features(deprecated - this flag does nothing)help
--quiet, -qEmit less verbose output and hide trivial warnings.help
--experimental-poppyParse wast files as Poppy IR for testing purposes.help
--emit-module-namesEmit module names, even if not emitting the rest of the names section.help
--enable-sign-extEnable sign extension operationshelp
--disable-sign-extDisable sign extension operationshelp
--enable-threadsEnable atomic operationshelp
--disable-threadsDisable atomic operationshelp
--enable-mutable-globalsEnable mutable globalshelp
--disable-mutable-globalsDisable mutable globalshelp
--enable-nontrapping-float-to-intEnable nontrapping float-to-int operationshelp
--disable-nontrapping-float-to-intDisable nontrapping float-to-int operationshelp
--enable-simdEnable SIMD operations and typeshelp
--disable-simdDisable SIMD operations and typeshelp
--enable-bulk-memoryEnable bulk memory operationshelp
--disable-bulk-memoryDisable bulk memory operationshelp
--enable-bulk-memory-optEnable memory.copy and memory.fillhelp
--disable-bulk-memory-optDisable memory.copy and memory.fillhelp
--enable-call-indirect-overlongEnable LEB encoding of call-indirect (Ignored for compatibility as it has no effect on Binaryen)help
--disable-call-indirect-overlongDisable LEB encoding of call-indirect (Ignored for compatibility as it has no effect on Binaryen)help
--enable-exception-handlingEnable exception handling operationshelp
--disable-exception-handlingDisable exception handling operationshelp
--enable-tail-callEnable tail call operationshelp
--disable-tail-callDisable tail call operationshelp
--enable-reference-typesEnable reference typeshelp
--disable-reference-typesDisable reference typeshelp
--enable-multivalueEnable multivalue functionshelp
--disable-multivalueDisable multivalue functionshelp
--enable-gcEnable garbage collectionhelp
--disable-gcDisable garbage collectionhelp
--enable-memory64Enable memory64help
--disable-memory64Disable memory64help
--enable-relaxed-simdEnable relaxed SIMDhelp
--disable-relaxed-simdDisable relaxed SIMDhelp
--enable-extended-constEnable extended const expressionshelp
--disable-extended-constDisable extended const expressionshelp
--enable-stringsEnable stringshelp
--disable-stringsDisable stringshelp
--enable-multimemoryEnable multimemoryhelp
--disable-multimemoryDisable multimemoryhelp
--enable-stack-switchingEnable stack switchinghelp
--disable-stack-switchingDisable stack switchinghelp
--enable-shared-everythingEnable shared-everything threadshelp
--disable-shared-everythingDisable shared-everything threadshelp
--enable-fp16Enable float 16 operationshelp
--disable-fp16Disable float 16 operationshelp
--enable-custom-descriptorsEnable custom descriptors (RTTs) and exact referenceshelp
--disable-custom-descriptorsDisable custom descriptors (RTTs) and exact referenceshelp
--enable-multibyteEnable multibyte array loads and storeshelp
--disable-multibyteDisable multibyte array loads and storeshelp
--enable-acquire-release-atomicsEnable acquire/release atomic memory operationshelp
--disable-acquire-release-atomicsDisable acquire/release atomic memory operationshelp
--enable-custom-page-sizesEnable custom page sizeshelp
--disable-custom-page-sizesDisable custom page sizeshelp
--enable-wide-arithmeticEnable wide arithmetichelp
--disable-wide-arithmeticDisable wide arithmetichelp
--enable-compact-importsEnable compact import sectionhelp
--disable-compact-importsDisable compact import sectionhelp
--enable-relaxed-atomicsEnable relaxed atomic memory operationshelp
--disable-relaxed-atomicsDisable relaxed atomic memory operationshelp
--enable-typed-function-referencesDeprecated compatibility flaghelp
--disable-typed-function-referencesDeprecated compatibility flaghelp
--no-validation, -nDisables validation, assumes inputs are correcthelp
--pass-arg, -paAn argument passed along to optimization passes being run.help
--closed-world, -cwAssume code outside of the module does not inspect or interact with GC and function references, even if they are passed out.help
--preserve-type-orderPreserve the order of types from the input (useful for debugging and testing)help
--generate-stack-irgenerate StackIR during writinghelp
--optimize-stack-iroptimize StackIR during writinghelp
--print-stack-irprint StackIR during writinghelp
--no-stack-irdo not use StackIR (even when it is the default)help
--versionOutput version information and exithelp
--help, -hShow this help message and exithelp
--debug, -dPrint debug information to stderrhelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.