Crate rustc_mir_transform

Source

Modules§

abort_unwinding_calls 🔒
add_call_guards 🔒
add_moves_for_packed_drops 🔒
add_retag 🔒
This pass adds validation calls (AcquireValid, ReleaseValid) where appropriate. It has to be run really early, before transformations like inlining, because introducing these calls adds UB – so, conceptually, this pass is actually part of MIR building, and only after this pass we think of the program has having the normal MIR semantics.
add_subtyping_projections 🔒
check_alignment 🔒
check_call_recursion 🔒
check_const_item_mutation 🔒
check_inline 🔒
Check that a body annotated with #[rustc_force_inline] will not fail to inline based on its definition alone (irrespective of any specific caller).
check_null 🔒
check_packed_ref 🔒
check_pointers 🔒
check_undefined_transmutes 🔒
cleanup_post_borrowck
This module provides a pass that removes parts of MIR that are no longer relevant after analysis phase and borrowck. In particular, it removes false edges, user type annotations and replaces following statements with Nops:
copy_prop 🔒
coroutine 🔒
This is the implementation of the pass which transforms coroutines into state machines.
cost_checker 🔒
coverage 🔒
cross_crate_inline 🔒
ctfe_limit 🔒
A pass that inserts the ConstEvalCounter instruction into any blocks that have a back edge (thus indicating there is a loop in the CFG), or whose terminator is a function call.
dataflow_const_prop 🔒
A constant propagation optimization pass based on dataflow analysis.
dead_store_elimination 🔒
This module implements a dead store elimination (DSE) routine.
deduce_param_attrs 🔒
Deduces supplementary parameter attributes from MIR.
deref_separator 🔒
dest_prop 🔒
Propagates assignment destinations backwards in the CFG to eliminate redundant assignments.
dump_mir
This pass just dumps MIR at a specified point.
early_otherwise_branch 🔒
elaborate_box_derefs 🔒
This pass transforms derefs of Box into a deref of the pointer inside Box.
elaborate_drop 🔒
elaborate_drops 🔒
errors 🔒
ffi_unwind_calls 🔒
function_item_references 🔒
gvn 🔒
Global value numbering.
impossible_predicates 🔒
Check if it’s even possible to satisfy the ‘where’ clauses for this item.
inline
Inlining pass for MIR functions.
instsimplify 🔒
Performs various peephole optimizations.
jump_threading 🔒
A jump threading optimization.
known_panics_lint 🔒
A lint that checks for known panics like overflows, division by zero, out-of-bound access etc. Uses const propagation to determine the values of operands during checks.
large_enums 🔒
lint 🔒
This pass statically detects code which has undefined behaviour or is likely to be erroneous. It can be used to locate problems in MIR building or optimizations. It assumes that all code can be executed, so it has false positives.
lint_tail_expr_drop_order 🔒
lower_intrinsics 🔒
Lowers intrinsic calls
lower_slice_len 🔒
This pass lowers calls to core::slice::len to just PtrMetadata op. It should run before inlining!
match_branches 🔒
mentioned_items 🔒
multiple_return_terminators 🔒
This pass removes jumps to basic blocks containing only a return, and replaces them with a return instead.
nrvo 🔒
See the docs for RenameReturnPlace.
pass_manager 🔒
patch 🔒
post_analysis_normalize 🔒
Normalizes MIR in TypingMode::PostAnalysis mode, most notably revealing its opaques. We also only normalize specializable associated items once in PostAnalysis mode.
post_drop_elaboration 🔒
prettify 🔒
These two passes provide no value to the compiler, so are off at every level.
promote_consts 🔒
A pass that promotes borrows of constant rvalues.
ref_prop 🔒
remove_noop_landing_pads 🔒
remove_place_mention 🔒
This pass removes PlaceMention statement, which has no effect at codegen.
remove_storage_markers 🔒
This pass removes storage markers if they won’t be emitted during codegen.
remove_uninit_drops 🔒
remove_unneeded_drops 🔒
This pass replaces a drop of a type that does not need dropping, with a goto.
remove_zsts 🔒
Removes operations on ZST places, and convert ZST operands to constants.
required_consts 🔒
sanity_check 🔒
shim 🔒
simplify
A number of passes which remove various redundancies in the CFG.
simplify_branches 🔒
simplify_comparison_integral 🔒
single_use_consts 🔒
sroa 🔒
ssa 🔒
We denote as “SSA” the set of locals that verify the following properties: 1/ They are only assigned-to once, either as a function parameter, or in an assign statement; 2/ This single assignment dominates all uses;
strip_debuginfo 🔒
unreachable_enum_branching 🔒
A pass that eliminates branches on uninhabited or unreachable enum variants.
unreachable_prop 🔒
A pass that propagates the unreachable terminator of a block to its predecessors when all of their successors are unreachable. This is achieved through a post-order traversal of the blocks.
validate 🔒
Validates the MIR to ensure that invariants are upheld.

Macros§

declare_passes 🔒
We import passes via this macro so that we can have a static list of pass names (used to verify CLI arguments). It takes a list of modules, followed by the passes declared within them.

Statics§

DEFAULT_LOCALE_RESOURCE
Raw content of Fluent resource for this crate, generated by fluent_messages macro, imported by rustc_driver to include all crates’ resources in one bundle.
PASS_NAMES 🔒

Functions§

inner_mir_for_ctfe 🔒
inner_optimized_mir 🔒
is_mir_available 🔒
mir_built 🔒
mir_const_qualif 🔒
mir_drops_elaborated_and_const_checked 🔒
Obtain just the main MIR (no promoteds) and run some cleanups on it. This also runs mir borrowck before doing so in order to ensure that borrowck can be run and doesn’t end up missing the source MIR due to stealing happening.
mir_for_ctfe 🔒
Compute the MIR that is used during CTFE (and thus has no optimizations run on it)
mir_keys 🔒
Finds the full set of DefIds within the current crate that have MIR associated with them.
mir_promoted 🔒
Compute the main MIR body and the list of MIR bodies of the promoteds.
optimized_mir 🔒
Optimize the MIR and prepare it for codegen.
promoted_mir 🔒
Fetch all the promoteds of an item and prepare their MIR bodies to be ready for constant evaluation once all generic parameters become known.
provide
remap_mir_for_const_eval_select 🔒
run_analysis_cleanup_passes 🔒
After this series of passes, no lifetime analysis based on borrowing can be done.
run_analysis_to_runtime_passes
run_optimization_passes 🔒
run_runtime_cleanup_passes 🔒
Returns the sequence of passes that do the initial cleanup of runtime MIR.
run_runtime_lowering_passes 🔒
Returns the sequence of passes that lowers analysis to runtime MIR.
take_array 🔒