Skip to main content

Module pass

Module pass 

Source
Expand description

Pass infrastructure for MIR transformations and analyses.

Inspired by LLVM/MLIR pass infrastructure:

  • Analysis passes (AnalysisPass) are read-only and produce a cached result. They take &Function and store their result in AnalysisManager.
  • Module passes (ModulePass) modify the IR at module scope. Function-local passes can implement FunctionPass and are automatically applied to each function.

§Usage

// Read-only analysis pipeline (codegen):
let mut am = AnalysisManager::new();
let liveness = am.get_or_compute(&LivenessAnalysis, &func);

// Transform pipeline:
let mut pm = PassManager::new();
pm.add_pass(Box::new(DcePass));
let changed = pm.run(&mut module).1;

Structs§

AnalysisKey
A key identifying a particular analysis, derived from its result type.
AnalysisManager
Manages cached analysis results for a function.
LivenessAnalysis
Liveness analysis pass.
PassInfo
Registry entry for a MIR transform pass.
PassManager
Orchestrates execution of ModulePasses on a module.
PipelineOptions
Options for running a MIR pass pipeline.

Constants§

ADCE_PASS
Aggressive dead-code elimination for dead control regions.
CFG_SIMPLIFY_PASS
CFG Simplification (fixed-point).
CHECK_ELIM_PASS
Range-based elimination of provably dead overflow-check branches.
CSE_PASS
Common Subexpression Elimination (fixed-point).
DCE_PASS
Dead Code Elimination (fixed-point).
DEFAULT_CLEANUP_PIPELINE
Cleanup passes rerun after the primary pipeline until no pass changes MIR.
DEFAULT_PIPELINE
The canonical MIR optimization pipeline used by EVM codegen.
FRAME_SLOT_PROMOTION_PASS
Promote non-escaping compiler-local slots to SSA values.
FUNCTION_DCE_PASS
Dead internal function elimination.
GVN_PASS
Congruence-class global value numbering.
INDVAR_SIMPLIFY_PASS
Strength-reduce affine induction-variable address expressions.
INLINE_PASS
Internal MIR function inlining.
INST_SIMPLIFY_PASS
Local MIR instruction simplification.
JUMP_THREADING_PASS
Jump Threading (fixed-point).
LICM_PASS
Loop-Invariant Code Motion.
LOAD_PRE_PASS
Availability-dataflow redundancy elimination and PRE for memory-dependent reads.
LOOP_CANONICALIZE_PASS
Canonicalize natural loops with explicit preheaders.
MEMORY_DSE_PASS
Local dead memory-store elimination.
PASS_REGISTRY
All known MIR passes exposed to solar mir-opt.
PRE_PASS
Partial redundancy elimination for pure expressions.
PURE_EVAL_PASS
Bounded evaluator for closed pure MIR loops/functions.
SCCP_PASS
Sparse Conditional Constant Propagation.
STORAGE_DSE_PASS
Eliminate overwritten or repeated storage stores.
STORAGE_LOAD_CSE_PASS
Reuse storage loads across definitely-disjoint stores.
STORAGE_PROMOTION_PASS
Promote simple loop-carried storage updates to memory.

Traits§

AnalysisPass
A read-only analysis pass.
FunctionPass
A transformation pass that mutates one function at a time.
ModulePass
A transformation pass that mutates a MIR module.

Functions§

lookup_pass
Finds a pass in the global MIR pass registry by command-line name.
run_default_pipeline
Runs the canonical MIR optimization pipeline used by EVM codegen.
run_default_pipeline_with_options
Runs the canonical MIR optimization pipeline used by EVM codegen with options.
run_pass
Runs a named MIR pass over a module.
run_pipeline
Runs a named MIR pass pipeline over a module.
run_pipeline_with_options
Runs a named MIR pass pipeline over a module with observer options.