cleanup op_to_const a bit; rename ConstValue::ByRef → Indirect

This commit is contained in:
Ralf Jung
2023-09-12 07:49:25 +02:00
parent 551f481ffb
commit 0f8908da27
14 changed files with 40 additions and 47 deletions

View File

@@ -116,7 +116,7 @@ pub(crate) fn codegen_const_value<'tcx>(
}
match const_val {
ConstValue::ZeroSized => unreachable!(), // we already handles ZST above
ConstValue::ZeroSized => unreachable!(), // we already handled ZST above
ConstValue::Scalar(x) => match x {
Scalar::Int(int) => {
if fx.clif_type(layout.ty).is_some() {
@@ -200,7 +200,7 @@ pub(crate) fn codegen_const_value<'tcx>(
CValue::by_val(val, layout)
}
},
ConstValue::ByRef { alloc_id, offset } => {
ConstValue::Indirect { alloc_id, offset } => {
let alloc = fx.tcx.global_alloc(alloc_id).unwrap_memory();
// FIXME: avoid creating multiple allocations for the same AllocId?
CValue::by_ref(