Replace Rvalue::NullaryOp by a variant in mir::ConstValue.
This commit is contained in:
parent
956134622e
commit
a0de5ae5a1
2 changed files with 6 additions and 12 deletions
13
src/base.rs
13
src/base.rs
|
|
@ -10,7 +10,7 @@ use rustc_data_structures::profiling::SelfProfilerRef;
|
|||
use rustc_index::IndexVec;
|
||||
use rustc_middle::ty::TypeVisitableExt;
|
||||
use rustc_middle::ty::adjustment::PointerCoercion;
|
||||
use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv};
|
||||
use rustc_middle::ty::layout::FnAbiOf;
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_session::config::OutputFilenames;
|
||||
use rustc_span::Symbol;
|
||||
|
|
@ -853,17 +853,6 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
|
|||
fx.bcx.ins().nop();
|
||||
}
|
||||
}
|
||||
Rvalue::NullaryOp(ref null_op) => {
|
||||
assert!(lval.layout().ty.is_sized(fx.tcx, fx.typing_env()));
|
||||
let val = match null_op {
|
||||
NullOp::RuntimeChecks(kind) => kind.value(fx.tcx.sess),
|
||||
};
|
||||
let val = CValue::by_val(
|
||||
fx.bcx.ins().iconst(types::I8, i64::from(val)),
|
||||
fx.layout_of(fx.tcx.types.bool),
|
||||
);
|
||||
lval.write_cvalue(fx, val);
|
||||
}
|
||||
Rvalue::Aggregate(ref kind, ref operands)
|
||||
if matches!(**kind, AggregateKind::RawPtr(..)) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -215,6 +215,11 @@ pub(crate) fn codegen_const_value<'tcx>(
|
|||
CValue::by_val(val, layout)
|
||||
}
|
||||
},
|
||||
ConstValue::RuntimeChecks(checks) => {
|
||||
let int = checks.value(fx.tcx.sess);
|
||||
let int = ScalarInt::try_from_uint(int, Size::from_bits(1)).unwrap();
|
||||
return CValue::const_val(fx, layout, int);
|
||||
}
|
||||
ConstValue::Indirect { alloc_id, offset } => CValue::by_ref(
|
||||
Pointer::new(pointer_for_allocation(fx, alloc_id))
|
||||
.offset_i64(fx, i64::try_from(offset.bytes()).unwrap()),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue