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&Functionand store their result inAnalysisManager. - Module passes (
ModulePass) modify the IR at module scope. Function-local passes can implementFunctionPassand 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§
- Analysis
Key - A key identifying a particular analysis, derived from its result type.
- Analysis
Manager - Manages cached analysis results for a function.
- Liveness
Analysis - Liveness analysis pass.
- Pass
Info - Registry entry for a MIR transform pass.
- Pass
Manager - Orchestrates execution of
ModulePasses on a module. - Pipeline
Options - 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§
- Analysis
Pass - A read-only analysis pass.
- Function
Pass - A transformation pass that mutates one function at a time.
- Module
Pass - 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.