[−][src]Struct rustc_mir::transform::const_prop::ConstPropagator

pub(in transform::const_prop) struct ConstPropagator<'mir, 'tcx> {
    ecx: InterpCx<'mir, 'tcx, ConstPropMachine<'mir, 'tcx>>,
    tcx: TyCtxt<'tcx>,
    param_env: ParamEnv<'tcx>,
    source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>,
    local_decls: IndexVec<Local, LocalDecl<'tcx>>,
    source_info: Option<SourceInfo>,
}

Finds optimization opportunities on the MIR.

Fields

ecx: InterpCx<'mir, 'tcx, ConstPropMachine<'mir, 'tcx>>tcx: TyCtxt<'tcx>param_env: ParamEnv<'tcx>source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>local_decls: IndexVec<Local, LocalDecl<'tcx>>source_info: Option<SourceInfo>

Implementations

impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx>[src]

pub(in transform::const_prop) fn new(
    body: &Body<'tcx>,
    dummy_body: &'mir Body<'tcx>,
    tcx: TyCtxt<'tcx>
) -> ConstPropagator<'mir, 'tcx>
[src]

pub(in transform::const_prop) fn get_const(
    &self,
    place: Place<'tcx>
) -> Option<OpTy<'tcx>>
[src]

pub(in transform::const_prop) fn remove_const(
    ecx: &mut InterpCx<'mir, 'tcx, ConstPropMachine<'mir, 'tcx>>,
    local: Local
)
[src]

Remove local from the pool of Locals. Allows writing to them, but not reading from them anymore.

pub(in transform::const_prop) fn lint_root(
    &self,
    source_info: SourceInfo
) -> Option<HirId>
[src]

pub(in transform::const_prop) fn use_ecx<F, T>(
    &mut self,
    f: F
) -> Option<T> where
    F: FnOnce(&mut Self) -> InterpResult<'tcx, T>, 
[src]

pub(in transform::const_prop) fn eval_constant(
    &mut self,
    c: &Constant<'tcx>,
    source_info: SourceInfo
) -> Option<OpTy<'tcx>>
[src]

Returns the value, if any, of evaluating c.

pub(in transform::const_prop) fn eval_place(
    &mut self,
    place: Place<'tcx>
) -> Option<OpTy<'tcx>>
[src]

Returns the value, if any, of evaluating place.

pub(in transform::const_prop) fn eval_operand(
    &mut self,
    op: &Operand<'tcx>,
    source_info: SourceInfo
) -> Option<OpTy<'tcx>>
[src]

Returns the value, if any, of evaluating op. Calls upon eval_constant or eval_place, depending on the variant of Operand used.

pub(in transform::const_prop) fn report_assert_as_lint(
    &self,
    lint: &'static Lint,
    source_info: SourceInfo,
    message: &'static str,
    panic: AssertKind<impl Debug>
) -> Option<()>
[src]

pub(in transform::const_prop) fn check_unary_op(
    &mut self,
    op: UnOp,
    arg: &Operand<'tcx>,
    source_info: SourceInfo
) -> Option<()>
[src]

pub(in transform::const_prop) fn check_binary_op(
    &mut self,
    op: BinOp,
    left: &Operand<'tcx>,
    right: &Operand<'tcx>,
    source_info: SourceInfo
) -> Option<()>
[src]

pub(in transform::const_prop) fn propagate_operand(
    &mut self,
    operand: &mut Operand<'tcx>
)
[src]

pub(in transform::const_prop) fn const_prop(
    &mut self,
    rvalue: &Rvalue<'tcx>,
    source_info: SourceInfo,
    place: Place<'tcx>
) -> Option<()>
[src]

pub(in transform::const_prop) fn eval_rvalue_with_identities(
    &mut self,
    rvalue: &Rvalue<'tcx>,
    place: Place<'tcx>
) -> Option<()>
[src]

pub(in transform::const_prop) fn operand_from_scalar(
    &self,
    scalar: Scalar,
    ty: Ty<'tcx>,
    span: Span
) -> Operand<'tcx>
[src]

Creates a new Operand::Constant from a Scalar value

pub(in transform::const_prop) fn replace_with_const(
    &mut self,
    rval: &mut Rvalue<'tcx>,
    value: OpTy<'tcx>,
    source_info: SourceInfo
)
[src]

pub(in transform::const_prop) fn should_const_prop(
    &mut self,
    op: OpTy<'tcx>
) -> bool
[src]

Returns true if and only if this op should be const-propagated into.

Trait Implementations

impl<'mir, 'tcx> HasDataLayout for ConstPropagator<'mir, 'tcx>[src]

impl<'mir, 'tcx> HasTyCtxt<'tcx> for ConstPropagator<'mir, 'tcx>[src]

impl<'mir, 'tcx> LayoutOf for ConstPropagator<'mir, 'tcx>[src]

type Ty = Ty<'tcx>

type TyAndLayout = Result<TyAndLayout<'tcx>, LayoutError<'tcx>>

impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx>[src]

Auto Trait Implementations

impl<'mir, 'tcx> !RefUnwindSafe for ConstPropagator<'mir, 'tcx>

impl<'mir, 'tcx> !Send for ConstPropagator<'mir, 'tcx>

impl<'mir, 'tcx> !Sync for ConstPropagator<'mir, 'tcx>

impl<'mir, 'tcx> Unpin for ConstPropagator<'mir, 'tcx> where
    'tcx: 'mir, 

impl<'mir, 'tcx> !UnwindSafe for ConstPropagator<'mir, 'tcx>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> PointerArithmetic for T where
    T: HasDataLayout, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]