#[non_exhaustive]pub enum Pass {
Show 137 variants
AlignmentLowering,
Asyncify,
AvoidReinterprets,
Dae,
DaeOptimizing,
AbstractTypeRefining,
CoalesceLocals,
CoalesceLocalsLearning,
CodePushing,
CodeFolding,
ConstHoisting,
Cfp,
Dce,
Dealign,
DeNan,
Directize,
DiscardGlobalEffects,
Dfo,
DwarfDump,
DuplicateImportElimination,
DuplicateFunctionElimination,
EmitTargetFeatures,
ExtractFunction,
ExtractFunctionIndex,
Flatten,
FpCastEmu,
FuncMetrics,
GenerateDyncalls,
GenerateI64Dyncalls,
GenerateGlobalEffects,
GenerateStackIr,
GlobalRefining,
Gto,
Gsi,
Gufa,
GufaCastAll,
GufaOptimizing,
TypeRefining,
Heap2Local,
InlineMain,
Inlining,
InliningOptimizing,
IntrinsicLowering,
Jspi,
LegalizeJsInterface,
LegalizeJsInterfaceMinimally,
LocalCse,
LocalSubtyping,
LogExecution,
I64ToI32Lowering,
InstrumentLocals,
InstrumentMemory,
Licm,
LimitSegments,
Memory64Lowering,
MemoryPacking,
MergeBlocks,
MergeSimilarFunctions,
MergeLocals,
Metrics,
MinifyImports,
MinifyImportsAndExports,
MinifyImportsAndExportsAndModules,
ModAsyncifyAlwaysAndOnlyUnwind,
ModAsyncifyNeverUnwind,
Monomorphize,
MonomorphizeAlways,
MultiMemoryLowering,
MultiMemoryLoweringWithBoundsChecks,
Nm,
NameTypes,
OnceReduction,
OptimizeAddedConstants,
OptimizeAddedConstantsPropagate,
OptimizeCasts,
OptimizeInstructions,
OptimizeStackIr,
PickLoadSigns,
Poppify,
PostEmscripten,
OptimizeForJs,
Precompute,
PrecomputePropagate,
Print,
PrintMinified,
PrintFeatures,
PrintFull,
PrintCallGraph,
PrintFunctionMap,
Symbolmap,
PrintStackIr,
RemoveNonJsOps,
RemoveImports,
RemoveMemory,
RemoveUnusedBrs,
RemoveUnusedModuleElements,
RemoveUnusedNonfunctionModuleElements,
RemoveUnusedNames,
RemoveUnusedTypes,
ReorderFunctionsByName,
ReorderFunctions,
ReorderGlobals,
RecorderLocals,
Rereloop,
Rse,
Roundtrip,
SafeHeap,
SetGlobals,
SignaturePruning,
SignatureRefining,
SignextLowering,
SimplifyGlobals,
SimplifyGlobalsOptimizing,
SimplifyLocals,
SimplifyLocalsNonesting,
SimplifyLocalsNotee,
SimplifyLocalsNostructure,
SimplifyLocalsNoteeNostructure,
Souperify,
SouperifySingleUse,
SpillPointers,
StubUnsupportedJs,
Ssa,
SsaNomerge,
Strip,
StackCheck,
StripDebug,
StripDwarf,
StripProducers,
StripEh,
StripTargetFeatuers,
TrapModeClamp,
TrapModeJs,
TypeMerging,
TypeSsa,
Untee,
Vacuum,
}
Expand description
A Binaryen optimization pass.
These have the same names as given on the command line to
wasm-opt
, but with Rust capitalization conventions.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AlignmentLowering
Lower unaligned loads and stores to smaller aligned ones.
Asyncify
Async/await style transform, allowing pausing and resuming.
AvoidReinterprets
Tries to avoid reinterpret operations via more loads.
Dae
Removes arguments to calls in an lto-like manner.
DaeOptimizing
Removes arguments to calls in an lto-like manner, and optimizes where removed.
AbstractTypeRefining
Refine and merge abstract (never-created) types.
CoalesceLocals
Reduce # of locals by coalescing.
CoalesceLocalsLearning
Reduce # of locals by coalescing and learning.
CodePushing
Push code forward, potentially making it not always execute.
CodeFolding
Fold code, merging duplicates.
ConstHoisting
Hoist repeated constants to a local.
Cfp
Propagate constant struct field values.
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.
Directize
Turns indirect calls into direct ones.
DiscardGlobalEffects
Discards global effect info.
Dfo
Optimizes using the DataFlow SSA IR.
DwarfDump
Dump DWARF debug info sections from the read binary.
DuplicateImportElimination
Removes duplicate imports.
DuplicateFunctionElimination
Removes duplicate functions.
EmitTargetFeatures
Emit the target features section in the output.
ExtractFunction
Leaves just one function (useful for debugging).
ExtractFunctionIndex
Leaves just one function selected by index.
Flatten
Flattens out code, removing nesting.
FpCastEmu
Emulates function pointer casts, allowing incorrect indirect calls to (sometimes) work.
FuncMetrics
Reports function metrics.
GenerateDyncalls
Generate dynCall fuctions used by emscripten ABI.
GenerateI64Dyncalls
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).
GenerateGlobalEffects
Generate global effect info (helps later passes).
GenerateStackIr
Generate Stack IR.
GlobalRefining
Refine the types of globals.
Gto
Globally optimize GC types.
Gsi
Globally optimize struct values.
Gufa
Grand unified flow analyses.
Optimize the entire program using information about what content can actually appear in each location.
GufaCastAll
GUFA plus add casts for all inferences.
GufaOptimizing
Gufa plus local optimizations in functions we modified.
TypeRefining
Apply more specific subtypes to type fields where possible.
Heap2Local
Replace GC allocations with locals.
InlineMain
Inline __original_main into main.
Inlining
Inline functions (you probably want inlining-optimizing).
InliningOptimizing
Inline functions and optimizes where we inlined.
IntrinsicLowering
Lower away binaryen intrinsics.
Jspi
Wrap imports and exports for JavaScript promise integration.
LegalizeJsInterface
Legalizes i64 types on the import/export boundary.
LegalizeJsInterfaceMinimally
Legalizes i64 types on the import/export boundary in a minimal manner, only on things only JS will call.
LocalCse
Common subexpression elimination inside basic blocks.
LocalSubtyping
Apply more specific subtypes to locals where possible.
LogExecution
Instrument the build with logging of where execution goes.
I64ToI32Lowering
Lower all uses of i64s to use i32s instead.
InstrumentLocals
Instrument the build with code to intercept all loads and stores.
InstrumentMemory
Instrument the build with code to intercept all loads and stores.
Licm
Loop invariant code motion.
LimitSegments
Attempt to merge segments to fit within web limits.
Memory64Lowering
Lower loads and stores to a 64-bit memory to instead use a 32-bit one.
MemoryPacking
Packs memory into separate segments, skipping zeros.
MergeBlocks
Merges blocks to their parents.
MergeSimilarFunctions
Merges similar functions when benefical.
MergeLocals
Merges locals when beneficial.
Metrics
Reports metrics.
MinifyImports
Minifies import names (only those, and not export names), and emits a mapping to the minified ones.
MinifyImportsAndExports
Minifies both import and export names, and emits a mapping to the minified ones.
MinifyImportsAndExportsAndModules
Minifies both import and export names, and emits a mapping to the minified ones, and minifies the modules as well.
ModAsyncifyAlwaysAndOnlyUnwind
Apply the assumption that asyncify imports always unwind, and we never rewind.
ModAsyncifyNeverUnwind
Apply the assumption that asyncify never unwinds.
Monomorphize
Creates specialized versions of functions.
MonomorphizeAlways
Creates specialized versions of functions (even if unhelpful).
MultiMemoryLowering
Combines multiple memories into a single memory.
MultiMemoryLoweringWithBoundsChecks
Combines multiple memories into a single memory, trapping if the read or write is larger than the length of the memory’s data.
Nm
Name list.
NameTypes
(Re)name all heap types.
OnceReduction
Reduces calls to code that only runs once.
OptimizeAddedConstants
Optimizes added constants into load/store offsets.
OptimizeAddedConstantsPropagate
Optimizes added constants into load/store offsets, propagating them across locals too.
OptimizeCasts
Eliminate and reuse casts.
OptimizeInstructions
Optimizes instruction combinations.
OptimizeStackIr
Optimize Stack IR.
PickLoadSigns
Pick load signs based on their uses.
Poppify
Tranform Binaryen IR into Poppy IR.
PostEmscripten
Miscellaneous optimizations for Emscripten-generated code.
OptimizeForJs
Early optimize of the instruction combinations for js.
Precompute
Computes compile-time evaluatable expressions.
PrecomputePropagate
Computes compile-time evaluatable expressions and propagates.
Print in s-expression format.
PrintMinified
Print in minified s-expression format.
PrintFeatures
Print options for enabled features.
PrintFull
Print in full s-expression format.
PrintCallGraph
Print call graph.
PrintFunctionMap
Print a map of function indexes to names.
Symbolmap
(Alias for print-function-map).
PrintStackIr
Print out Stack IR (useful for internal debugging).
RemoveNonJsOps
Removes operations incompatible with js.
RemoveImports
Removes imports and replaces them with nops.
RemoveMemory
Removes memory segments.
RemoveUnusedBrs
Removes breaks from locations that are not needed.
RemoveUnusedModuleElements
Removes unused module elements.
RemoveUnusedNonfunctionModuleElements
Removes unused module elements that are not functions.
RemoveUnusedNames
Removes names from locations that are never branched to.
RemoveUnusedTypes
Remove unused private GC types.
ReorderFunctionsByName
Sorts functions by name (useful for debugging).
ReorderFunctions
Sorts functions by access frequency.
ReorderGlobals
Sorts globals by access frequency.
RecorderLocals
Sorts locals by access frequency.
Rereloop
Re-optimize control flow using the relooper algorithm.
Rse
Remove redundant local.sets.
Roundtrip
Write the module to binary, then read it.
SafeHeap
Instrument loads and stores to check for invalid behavior.
SetGlobals
Sets specified globals to specified values.
SignaturePruning
Remove params from function signature types where possible.
SignatureRefining
Apply more specific subtypes to signature types where possible.
SignextLowering
Lower sign-ext operations to wasm mvp.
SimplifyGlobals
Miscellaneous globals-related optimizations.
SimplifyGlobalsOptimizing
Miscellaneous globals-related optimizations, and optimizes where we replaced global.gets with constants.
SimplifyLocals
Miscellaneous locals-related optimizations.
SimplifyLocalsNonesting
Miscellaneous locals-related optimizations (no nesting at all; preserves flatness).
SimplifyLocalsNotee
Miscellaneous locals-related optimizations (no tees).
SimplifyLocalsNostructure
Miscellaneous locals-related optimizations (no structure).
SimplifyLocalsNoteeNostructure
Miscellaneous locals-related optimizations (no tees or structure).
Souperify
Emit Souper IR in text form.
SouperifySingleUse
Emit Souper IR in text form (single-use nodes only).
SpillPointers
Spill pointers to the C stack (useful for Boehm-style GC).
StubUnsupportedJs
Stub out unsupported JS operations.
Ssa
Ssa-ify variables so that they have a single assignment.
SsaNomerge
Ssa-ify variables so that they have a single assignment, ignoring merges.
Strip
Deprecated; same as strip-debug.
StackCheck
Enforce limits on llvm’s __stack_pointer global.
StripDebug
Strip debug info (including the names section).
StripDwarf
Strip dwarf debug info.
StripProducers
Strip the wasm producers section.
StripEh
Strip EH instructions.
StripTargetFeatuers
Strip the wasm target features section.
TrapModeClamp
Replace trapping operations with clamping semantics.
TrapModeJs
Replace trapping operations with js semantics.
TypeMerging
Merge types to their supertypes where possible.
TypeSsa
Create new nominal types to help other optimizations.
Untee
Removes local.tees, replacing them with sets and gets.
Vacuum
Removes obviously unneeded code.