miri: binary_op_val -> binary_op_imm

This commit is contained in:
Ralf Jung
2018-11-05 09:10:48 +01:00
parent 0117b42f66
commit c905497766
3 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -140,7 +140,7 @@ pub fn emulate_intrinsic(
"unchecked_shr" => BinOp::Shr,
_ => bug!("Already checked for int ops")
};
let (val, overflowed) = self.binary_op_val(bin_op, l, r)?;
let (val, overflowed) = self.binary_op_imm(bin_op, l, r)?;
if overflowed {
let layout = self.layout_of(substs.type_at(0))?;
let r_val = r.to_scalar()?.to_bits(layout.size)?;
+4 -4
View File
@@ -28,7 +28,7 @@ pub fn binop_with_overflow(
right: ImmTy<'tcx, M::PointerTag>,
dest: PlaceTy<'tcx, M::PointerTag>,
) -> EvalResult<'tcx> {
let (val, overflowed) = self.binary_op_val(op, left, right)?;
let (val, overflowed) = self.binary_op_imm(op, left, right)?;
let val = Immediate::ScalarPair(val.into(), Scalar::from_bool(overflowed).into());
self.write_immediate(val, dest)
}
@@ -42,7 +42,7 @@ pub fn binop_ignore_overflow(
right: ImmTy<'tcx, M::PointerTag>,
dest: PlaceTy<'tcx, M::PointerTag>,
) -> EvalResult<'tcx> {
let (val, _overflowed) = self.binary_op_val(op, left, right)?;
let (val, _overflowed) = self.binary_op_imm(op, left, right)?;
self.write_scalar(val, dest)
}
}
@@ -283,9 +283,9 @@ fn binary_int_op(
}
/// Convenience wrapper that's useful when keeping the layout together with the
/// value.
/// immediate value.
#[inline]
pub fn binary_op_val(
pub fn binary_op_imm(
&self,
bin_op: mir::BinOp,
left: ImmTy<'tcx, M::PointerTag>,
+1 -1
View File
@@ -455,7 +455,7 @@ fn const_prop(
})?;
trace!("const evaluating {:?} for {:?} and {:?}", op, left, right);
let (val, overflow) = self.use_ecx(source_info, |this| {
this.ecx.binary_op_val(op, l, r)
this.ecx.binary_op_imm(op, l, r)
})?;
let val = if let Rvalue::CheckedBinaryOp(..) = *rvalue {
Immediate::ScalarPair(