Skip to content

Commit b9b05d5

Browse files
committed
Make PlaceRef hold a PlaceValue for the non-layout fields (like OperandRef does)
1 parent 040afd3 commit b9b05d5

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

src/builder.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
974974
&mut self,
975975
place: PlaceRef<'tcx, RValue<'gcc>>,
976976
) -> OperandRef<'tcx, RValue<'gcc>> {
977-
assert_eq!(place.llextra.is_some(), place.layout.is_unsized());
977+
assert_eq!(place.val.llextra.is_some(), place.layout.is_unsized());
978978

979979
if place.layout.is_zst() {
980980
return OperandRef::zero_sized(place.layout);
@@ -999,10 +999,10 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
999999
}
10001000
}
10011001

1002-
let val = if let Some(llextra) = place.llextra {
1003-
OperandValue::Ref(place.llval, Some(llextra), place.align)
1002+
let val = if let Some(llextra) = place.val.llextra {
1003+
OperandValue::Ref(place.val.llval, Some(llextra), place.val.align)
10041004
} else if place.layout.is_gcc_immediate() {
1005-
let load = self.load(place.layout.gcc_type(self), place.llval, place.align);
1005+
let load = self.load(place.layout.gcc_type(self), place.val.llval, place.val.align);
10061006
if let abi::Abi::Scalar(ref scalar) = place.layout.abi {
10071007
scalar_load_metadata(self, load, scalar);
10081008
}
@@ -1012,9 +1012,9 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
10121012

10131013
let mut load = |i, scalar: &abi::Scalar, align| {
10141014
let llptr = if i == 0 {
1015-
place.llval
1015+
place.val.llval
10161016
} else {
1017-
self.inbounds_ptradd(place.llval, self.const_usize(b_offset.bytes()))
1017+
self.inbounds_ptradd(place.val.llval, self.const_usize(b_offset.bytes()))
10181018
};
10191019
let llty = place.layout.scalar_pair_element_gcc_type(self, i);
10201020
let load = self.load(llty, llptr, align);
@@ -1027,11 +1027,11 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
10271027
};
10281028

10291029
OperandValue::Pair(
1030-
load(0, a, place.align),
1031-
load(1, b, place.align.restrict_for_offset(b_offset)),
1030+
load(0, a, place.val.align),
1031+
load(1, b, place.val.align.restrict_for_offset(b_offset)),
10321032
)
10331033
} else {
1034-
OperandValue::Ref(place.llval, None, place.align)
1034+
OperandValue::Ref(place.val.llval, None, place.val.align)
10351035
};
10361036

10371037
OperandRef { val, layout: place.layout }
@@ -1045,8 +1045,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
10451045
) {
10461046
let zero = self.const_usize(0);
10471047
let count = self.const_usize(count);
1048-
let start = dest.project_index(self, zero).llval;
1049-
let end = dest.project_index(self, count).llval;
1048+
let start = dest.project_index(self, zero).val.llval;
1049+
let end = dest.project_index(self, count).val.llval;
10501050

10511051
let header_bb = self.append_sibling_block("repeat_loop_header");
10521052
let body_bb = self.append_sibling_block("repeat_loop_body");
@@ -1064,7 +1064,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
10641064
self.cond_br(keep_going, body_bb, next_bb);
10651065

10661066
self.switch_to_block(body_bb);
1067-
let align = dest.align.restrict_for_offset(dest.layout.field(self.cx(), 0).size);
1067+
let align = dest.val.align.restrict_for_offset(dest.layout.field(self.cx(), 0).size);
10681068
cg_elem.val.store(self, PlaceRef::new_sized_aligned(current_val, cg_elem.layout, align));
10691069

10701070
let next = self.inbounds_gep(

src/intrinsic/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
354354

355355
let block = self.llbb();
356356
let extended_asm = block.add_extended_asm(None, "");
357-
extended_asm.add_input_operand(None, "r", result.llval);
357+
extended_asm.add_input_operand(None, "r", result.val.llval);
358358
extended_asm.add_clobber("memory");
359359
extended_asm.set_volatile_flag(true);
360360

@@ -388,8 +388,8 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
388388
if !fn_abi.ret.is_ignore() {
389389
if let PassMode::Cast { cast: ty, .. } = &fn_abi.ret.mode {
390390
let ptr_llty = self.type_ptr_to(ty.gcc_type(self));
391-
let ptr = self.pointercast(result.llval, ptr_llty);
392-
self.store(llval, ptr, result.align);
391+
let ptr = self.pointercast(result.val.llval, ptr_llty);
392+
self.store(llval, ptr, result.val.align);
393393
} else {
394394
OperandRef::from_immediate_or_packed_pair(self, llval, result.layout)
395395
.val
@@ -511,7 +511,7 @@ impl<'gcc, 'tcx> ArgAbiExt<'gcc, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
511511
let can_store_through_cast_ptr = false;
512512
if can_store_through_cast_ptr {
513513
let cast_ptr_llty = bx.type_ptr_to(cast.gcc_type(bx));
514-
let cast_dst = bx.pointercast(dst.llval, cast_ptr_llty);
514+
let cast_dst = bx.pointercast(dst.val.llval, cast_ptr_llty);
515515
bx.store(val, cast_dst, self.layout.align.abi);
516516
} else {
517517
// The actual return type is a struct, but the ABI
@@ -539,7 +539,7 @@ impl<'gcc, 'tcx> ArgAbiExt<'gcc, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
539539

540540
// ... and then memcpy it to the intended destination.
541541
bx.memcpy(
542-
dst.llval,
542+
dst.val.llval,
543543
self.layout.align.abi,
544544
llscratch,
545545
scratch_align,

src/intrinsic/simd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
8282
let place = PlaceRef::alloca(bx, args[0].layout);
8383
args[0].val.store(bx, place);
8484
let int_ty = bx.type_ix(expected_bytes * 8);
85-
let ptr = bx.pointercast(place.llval, bx.cx.type_ptr_to(int_ty));
85+
let ptr = bx.pointercast(place.val.llval, bx.cx.type_ptr_to(int_ty));
8686
bx.load(int_ty, ptr, Align::ONE)
8787
}
8888
_ => return_error!(InvalidMonomorphization::InvalidBitmask {

0 commit comments

Comments
 (0)