rustc_mir_transform::pass_manager

Trait 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 PostAnalysisNormalize

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 SimplifyComparisonIntegral

Source§

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

Source§

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

Source§

impl<'tcx> MirPass<'tcx> for StripDebugInfo

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>,