Trait rustc_mir_transform::pass_manager::MirPass

source ·
pub(crate) trait MirPass<'tcx> {
    // Required method
    fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>);

    // Provided methods
    fn name(&self) -> &'static str { ... }
    fn profiler_name(&self) -> &'static str { ... }
    fn is_enabled(&self, _sess: &Session) -> bool { ... }
    fn is_mir_dump_enabled(&self) -> bool { ... }
}
Expand description

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.

Required Methods§

source

fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>)

Provided Methods§

source

fn name(&self) -> &'static str

source

fn profiler_name(&self) -> &'static str

source

fn is_enabled(&self, _sess: &Session) -> bool

Returns true if this pass is enabled with the current combination of compiler flags.

source

fn is_mir_dump_enabled(&self) -> bool

Implementors§

source§

impl MirPass<'_> for UnreachablePropagation

source§

impl<'tcx> MirPass<'tcx> for AddCallGuards

Breaks outgoing critical edges for call terminators in the MIR.

Critical edges are edges that are neither the only edge leaving a block, nor the only edge entering one.

When you want something to happen “along” an edge, you can either do at the end of the predecessor block, or at the start of the successor block. Critical edges have to be broken in order to prevent “edge actions” from affecting other edges. We need this for calls that are codegened to LLVM invoke instructions, because invoke is a block terminator in LLVM so we can’t insert any code to handle the call’s result into the block that performs the call.

This function will break those edges by inserting new blocks along them.

NOTE: Simplify CFG will happily undo most of the work this pass does.

source§

impl<'tcx> MirPass<'tcx> for DeadStoreElimination

source§

impl<'tcx> MirPass<'tcx> for InstSimplify

source§

impl<'tcx> MirPass<'tcx> for SimplifyCfg

source§

impl<'tcx> MirPass<'tcx> for SimplifyLocals

source§

impl<'tcx> MirPass<'tcx> for SimplifyConstCondition

A pass that replaces a branch with a goto when its condition is known.

source§

impl<'tcx> MirPass<'tcx> for AbortUnwindingCalls

source§

impl<'tcx> MirPass<'tcx> for AddMovesForPackedDrops

source§

impl<'tcx> MirPass<'tcx> for AddRetag

source§

impl<'tcx> MirPass<'tcx> for Subtyper

source§

impl<'tcx> MirPass<'tcx> for CheckAlignment

source§

impl<'tcx> MirPass<'tcx> for CleanupPostBorrowck

source§

impl<'tcx> MirPass<'tcx> for CopyProp

source§

impl<'tcx> MirPass<'tcx> for StateTransform

source§

impl<'tcx> MirPass<'tcx> for InstrumentCoverage

source§

impl<'tcx> MirPass<'tcx> for CtfeLimit

source§

impl<'tcx> MirPass<'tcx> for DataflowConstProp

source§

impl<'tcx> MirPass<'tcx> for DeduplicateBlocks

source§

impl<'tcx> MirPass<'tcx> for Derefer

source§

impl<'tcx> MirPass<'tcx> for DestinationPropagation

source§

impl<'tcx> MirPass<'tcx> for Marker

source§

impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch

source§

impl<'tcx> MirPass<'tcx> for ElaborateBoxDerefs

source§

impl<'tcx> MirPass<'tcx> for ElaborateDrops

source§

impl<'tcx> MirPass<'tcx> for GVN

source§

impl<'tcx> MirPass<'tcx> for Inline

source§

impl<'tcx> MirPass<'tcx> for JumpThreading

source§

impl<'tcx> MirPass<'tcx> for EnumSizeOpt

source§

impl<'tcx> MirPass<'tcx> for LowerIntrinsics

source§

impl<'tcx> MirPass<'tcx> for LowerSliceLenCalls

source§

impl<'tcx> MirPass<'tcx> for MatchBranchSimplification

source§

impl<'tcx> MirPass<'tcx> for MentionedItems

source§

impl<'tcx> MirPass<'tcx> for MultipleReturnTerminators

source§

impl<'tcx> MirPass<'tcx> for RenameReturnPlace

source§

impl<'tcx> MirPass<'tcx> for ReorderBasicBlocks

source§

impl<'tcx> MirPass<'tcx> for ReorderLocals

source§

impl<'tcx> MirPass<'tcx> for PromoteTemps<'tcx>

source§

impl<'tcx> MirPass<'tcx> for ReferencePropagation

source§

impl<'tcx> MirPass<'tcx> for RemoveNoopLandingPads

source§

impl<'tcx> MirPass<'tcx> for RemovePlaceMention

source§

impl<'tcx> MirPass<'tcx> for RemoveStorageMarkers

source§

impl<'tcx> MirPass<'tcx> for RemoveUninitDrops

source§

impl<'tcx> MirPass<'tcx> for RemoveUnneededDrops

source§

impl<'tcx> MirPass<'tcx> for RemoveZsts

source§

impl<'tcx> MirPass<'tcx> for RevealAll

source§

impl<'tcx> MirPass<'tcx> for SimplifyComparisonIntegral

source§

impl<'tcx> MirPass<'tcx> for SingleUseConsts

source§

impl<'tcx> MirPass<'tcx> for ScalarReplacementOfAggregates

source§

impl<'tcx> MirPass<'tcx> for UnreachableEnumBranching

source§

impl<'tcx> MirPass<'tcx> for Validator

source§

impl<'tcx, T> MirPass<'tcx> for Lint<T>
where T: MirLint<'tcx>,

source§

impl<'tcx, T> MirPass<'tcx> for WithMinOptLevel<T>
where T: MirPass<'tcx>,