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_packed_ref πŸ”’
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.
deduplicate_blocks πŸ”’
This pass finds basic blocks that are completely equal, and replaces all uses with just one of them.
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_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 πŸ”’
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 πŸ”’