Add pass for simple phase change
This commit is contained in:
parent
fd18b45e11
commit
fca642c1c3
2 changed files with 21 additions and 0 deletions
|
@ -61,6 +61,7 @@ mod inline;
|
|||
mod instcombine;
|
||||
mod lower_intrinsics;
|
||||
mod lower_slice_len;
|
||||
mod marker;
|
||||
mod match_branches;
|
||||
mod multiple_return_terminators;
|
||||
mod normalize_array_len;
|
||||
|
|
20
compiler/rustc_mir_transform/src/marker.rs
Normal file
20
compiler/rustc_mir_transform/src/marker.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use crate::MirPass;
|
||||
use rustc_middle::mir::{Body, MirPhase};
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
|
||||
/// Changes the MIR phase without changing the MIR itself.
|
||||
pub struct PhaseChange(pub MirPhase);
|
||||
|
||||
impl<'tcx> MirPass<'tcx> for PhaseChange {
|
||||
fn phase_change(&self) -> Option<MirPhase> {
|
||||
Some(self.0)
|
||||
}
|
||||
|
||||
fn name(&self) -> Cow<'_, str> {
|
||||
Cow::from(format!("PhaseChange-{:?}", self.0))
|
||||
}
|
||||
|
||||
fn run_pass(&self, _: TyCtxt<'tcx>, _body: &mut Body<'tcx>) {}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue