[][src]Module rustc_mir::transform

Modules

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.

check_const_item_mutation
check_consts

Check the bodies of consts, statics and const fns for illegal operations.

check_packed_ref
check_unsafety
cleanup_post_borrowck

This module provides a pass to replacing the following statements with Nops

const_prop

Propagates constants for early reporting of statically known assertion failures

deaggregator
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_drops
generator

This is the implementation of the pass which transforms generators into state machines.

inline

Inlining pass for MIR functions

instcombine

Performs various peephole optimizations.

instrument_coverage
match_branches
multiple_return_terminators

This pass removes jumps to basic blocks containing only a return, and replaces them with a return instead.

no_landing_pads

This pass removes the unwind branch of all the terminators when the no-landing-pads option is specified.

nrvo
promote_consts

A pass that promotes borrows of constant rvalues.

remove_noop_landing_pads
remove_unneeded_drops

This pass replaces a drop of a type that does not need dropping, with a goto

required_consts
rustc_peek
simplify

A number of passes which remove various redundancies in the CFG.

simplify_branches

A pass that simplifies branches when their condition is known.

simplify_comparison_integral
simplify_try

The general point of the optimizations provided here is to simplify something like:

uninhabited_enum_branching

A pass that eliminates branches on uninhabited 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.

Structs

MirSource

Where a specific mir::Body comes from.

Traits

MirPass

A streamlined trait that you can implement to create a pass; the pass will be named after the type, and it will consist of a main loop that goes over each available MIR and applies run_pass.

Functions

default_name

Generates a default name for the pass based on the name of the type T.

inner_optimized_mir
is_mir_available
mir_const

Make MIR ready for const evaluation. This is run on all MIR, not just on consts!

mir_const_qualif
mir_drops_elaborated_and_const_checked
mir_keys

Finds the full set of DefIds within the current crate that have MIR associated with them.

mir_promoted
optimized_mir
optimized_mir_of_const_arg
promoted_mir
provide
run_optimization_passes
run_passes
run_post_borrowck_cleanup_passes

After this series of passes, no lifetime analysis based on borrowing can be done.