Skip to content

Commit 93191f6

Browse files
committed
Box CastTarget within PassMode.
Because `PassMode::Cast` is by far the largest variant, but is relatively rare. This requires making `PassMode` not impl `Copy`, and `Clone` is no longer necessary. This causes lots of sigil adjusting, but nothing very notable.
1 parent 928ef37 commit 93191f6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/abi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<'gcc, 'tcx> FnAbiGccExt<'gcc, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
133133
match self.ret.mode {
134134
PassMode::Ignore => cx.type_void(),
135135
PassMode::Direct(_) | PassMode::Pair(..) => self.ret.layout.immediate_gcc_type(cx),
136-
PassMode::Cast(cast) => cast.gcc_type(cx),
136+
PassMode::Cast(ref cast) => cast.gcc_type(cx),
137137
PassMode::Indirect { .. } => {
138138
argument_tys.push(cx.type_ptr_to(self.ret.memory_ty(cx)));
139139
cx.type_void()
@@ -157,7 +157,7 @@ impl<'gcc, 'tcx> FnAbiGccExt<'gcc, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
157157
PassMode::Indirect { extra_attrs: Some(_), .. } => {
158158
unimplemented!();
159159
}
160-
PassMode::Cast(cast) => cast.gcc_type(cx),
160+
PassMode::Cast(ref cast) => cast.gcc_type(cx),
161161
PassMode::Indirect { extra_attrs: None, on_stack: true, .. } => {
162162
on_stack_param_indices.insert(argument_tys.len());
163163
arg.memory_ty(cx)

src/intrinsic/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
130130
sym::volatile_load | sym::unaligned_volatile_load => {
131131
let tp_ty = substs.type_at(0);
132132
let mut ptr = args[0].immediate();
133-
if let PassMode::Cast(ty) = fn_abi.ret.mode {
133+
if let PassMode::Cast(ty) = &fn_abi.ret.mode {
134134
ptr = self.pointercast(ptr, self.type_ptr_to(ty.gcc_type(self)));
135135
}
136136
let load = self.volatile_load(ptr.get_type(), ptr);
@@ -320,7 +320,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
320320
};
321321

322322
if !fn_abi.ret.is_ignore() {
323-
if let PassMode::Cast(ty) = fn_abi.ret.mode {
323+
if let PassMode::Cast(ty) = &fn_abi.ret.mode {
324324
let ptr_llty = self.type_ptr_to(ty.gcc_type(self));
325325
let ptr = self.pointercast(result.llval, ptr_llty);
326326
self.store(llval, ptr, result.align);
@@ -416,7 +416,7 @@ impl<'gcc, 'tcx> ArgAbiExt<'gcc, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
416416
else if self.is_unsized_indirect() {
417417
bug!("unsized `ArgAbi` must be handled through `store_fn_arg`");
418418
}
419-
else if let PassMode::Cast(cast) = self.mode {
419+
else if let PassMode::Cast(ref cast) = self.mode {
420420
// FIXME(eddyb): Figure out when the simpler Store is safe, clang
421421
// uses it for i16 -> {i8, i8}, but not for i24 -> {i8, i8, i8}.
422422
let can_store_through_cast_ptr = false;

0 commit comments

Comments
 (0)