Use Operand::constant() in a couple of places
Also reduce visibility of a function
This commit is contained in:
parent
7988b8c0b3
commit
30c48bcb55
3 changed files with 9 additions and 7 deletions
|
|
@ -228,7 +228,7 @@ fn pointer_for_allocation<'tcx>(
|
|||
crate::pointer::Pointer::new(global_ptr)
|
||||
}
|
||||
|
||||
pub(crate) fn data_id_for_alloc_id(
|
||||
fn data_id_for_alloc_id(
|
||||
cx: &mut ConstantCx,
|
||||
module: &mut dyn Module,
|
||||
alloc_id: AllocId,
|
||||
|
|
|
|||
|
|
@ -202,9 +202,10 @@ pub(super) fn codegen_x86_llvm_intrinsic_call<'tcx>(
|
|||
};
|
||||
let x = codegen_operand(fx, &x.node);
|
||||
let y = codegen_operand(fx, &y.node);
|
||||
let kind = match &kind.node {
|
||||
Operand::Constant(const_) => crate::constant::eval_mir_constant(fx, const_).0,
|
||||
Operand::Copy(_) | Operand::Move(_) => unreachable!("{kind:?}"),
|
||||
let kind = if let Some(const_) = kind.node.constant() {
|
||||
crate::constant::eval_mir_constant(fx, const_).0
|
||||
} else {
|
||||
unreachable!("{kind:?}")
|
||||
};
|
||||
|
||||
let flt_cc = match kind
|
||||
|
|
|
|||
|
|
@ -205,9 +205,10 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
|
|||
// Find a way to reuse `immediate_const_vector` from `codegen_ssa` instead.
|
||||
let indexes = {
|
||||
use rustc_middle::mir::interpret::*;
|
||||
let idx_const = match &idx.node {
|
||||
Operand::Constant(const_) => crate::constant::eval_mir_constant(fx, const_).0,
|
||||
Operand::Copy(_) | Operand::Move(_) => unreachable!("{idx:?}"),
|
||||
let idx_const = if let Some(const_) = idx.node.constant() {
|
||||
crate::constant::eval_mir_constant(fx, const_).0
|
||||
} else {
|
||||
unreachable!("{idx:?}")
|
||||
};
|
||||
|
||||
let idx_bytes = match idx_const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue