};
use super::{
InterpretCx, Machine,
- MemPlace, MPlaceTy, PlaceTy, Place, MemoryKind,
+ MemPlace, MPlaceTy, PlaceTy, Place,
};
pub use rustc::mir::interpret::ScalarMaybeUndef;
Ok(str)
}
- pub fn uninit_operand(
- &mut self,
- layout: TyLayout<'tcx>
- ) -> EvalResult<'tcx, Operand<M::PointerTag>> {
- // This decides which types we will use the Immediate optimization for, and hence should
- // match what `try_read_immediate` and `eval_place_to_op` support.
- if layout.is_zst() {
- return Ok(Operand::Immediate(Immediate::Scalar(Scalar::zst().into())));
- }
-
- Ok(match layout.abi {
- layout::Abi::Scalar(..) =>
- Operand::Immediate(Immediate::Scalar(ScalarMaybeUndef::Undef)),
- layout::Abi::ScalarPair(..) =>
- Operand::Immediate(Immediate::ScalarPair(
- ScalarMaybeUndef::Undef,
- ScalarMaybeUndef::Undef,
- )),
- _ => {
- trace!("Forcing allocation for local of type {:?}", layout.ty);
- Operand::Indirect(
- *self.allocate(layout, MemoryKind::Stack)
- )
- }
- })
- }
-
/// Projection functions
pub fn operand_field(
&self,