Skip to content

Commit 89f0d18

Browse files
committed
clarify PassMode::Indirect as well
1 parent 90d894e commit 89f0d18

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/abi/pass_mode.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
104104
assert!(!pad_i32, "padding support not yet implemented");
105105
cast_target_to_abi_params(cast)
106106
}
107-
PassMode::Indirect { attrs, extra_attrs: None, on_stack } => {
107+
PassMode::Indirect { attrs, meta_attrs: None, on_stack } => {
108108
if on_stack {
109109
// Abi requires aligning struct size to pointer size
110110
let size = self.layout.size.align_to(tcx.data_layout.pointer_align.abi);
@@ -117,11 +117,11 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
117117
smallvec![apply_arg_attrs_to_abi_param(AbiParam::new(pointer_ty(tcx)), attrs)]
118118
}
119119
}
120-
PassMode::Indirect { attrs, extra_attrs: Some(extra_attrs), on_stack } => {
120+
PassMode::Indirect { attrs, meta_attrs: Some(meta_attrs), on_stack } => {
121121
assert!(!on_stack);
122122
smallvec![
123123
apply_arg_attrs_to_abi_param(AbiParam::new(pointer_ty(tcx)), attrs),
124-
apply_arg_attrs_to_abi_param(AbiParam::new(pointer_ty(tcx)), extra_attrs),
124+
apply_arg_attrs_to_abi_param(AbiParam::new(pointer_ty(tcx)), meta_attrs),
125125
]
126126
}
127127
}
@@ -151,11 +151,11 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
151151
PassMode::Cast(ref cast, _) => {
152152
(None, cast_target_to_abi_params(cast).into_iter().collect())
153153
}
154-
PassMode::Indirect { attrs: _, extra_attrs: None, on_stack } => {
154+
PassMode::Indirect { attrs: _, meta_attrs: None, on_stack } => {
155155
assert!(!on_stack);
156156
(Some(AbiParam::special(pointer_ty(tcx), ArgumentPurpose::StructReturn)), vec![])
157157
}
158-
PassMode::Indirect { attrs: _, extra_attrs: Some(_), on_stack: _ } => {
158+
PassMode::Indirect { attrs: _, meta_attrs: Some(_), on_stack: _ } => {
159159
unreachable!("unsized return value")
160160
}
161161
}
@@ -290,11 +290,11 @@ pub(super) fn cvalue_for_param<'tcx>(
290290
PassMode::Cast(ref cast, _) => {
291291
Some(from_casted_value(fx, &block_params, arg_abi.layout, cast))
292292
}
293-
PassMode::Indirect { attrs: _, extra_attrs: None, on_stack: _ } => {
293+
PassMode::Indirect { attrs: _, meta_attrs: None, on_stack: _ } => {
294294
assert_eq!(block_params.len(), 1, "{:?}", block_params);
295295
Some(CValue::by_ref(Pointer::new(block_params[0]), arg_abi.layout))
296296
}
297-
PassMode::Indirect { attrs: _, extra_attrs: Some(_), on_stack: _ } => {
297+
PassMode::Indirect { attrs: _, meta_attrs: Some(_), on_stack: _ } => {
298298
assert_eq!(block_params.len(), 2, "{:?}", block_params);
299299
Some(CValue::by_ref_unsized(
300300
Pointer::new(block_params[0]),

src/abi/returning.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ pub(super) fn codegen_return_param<'tcx>(
2626
smallvec![],
2727
)
2828
}
29-
PassMode::Indirect { attrs: _, extra_attrs: None, on_stack: _ } => {
29+
PassMode::Indirect { attrs: _, meta_attrs: None, on_stack: _ } => {
3030
let ret_param = block_params_iter.next().unwrap();
3131
assert_eq!(fx.bcx.func.dfg.value_type(ret_param), fx.pointer_type);
3232
(
3333
CPlace::for_ptr(Pointer::new(ret_param), fx.fn_abi.as_ref().unwrap().ret.layout),
3434
smallvec![ret_param],
3535
)
3636
}
37-
PassMode::Indirect { attrs: _, extra_attrs: Some(_), on_stack: _ } => {
37+
PassMode::Indirect { attrs: _, meta_attrs: Some(_), on_stack: _ } => {
3838
unreachable!("unsized return value")
3939
}
4040
};
@@ -62,7 +62,7 @@ pub(super) fn codegen_with_call_return_arg<'tcx>(
6262
) {
6363
let (ret_temp_place, return_ptr) = match ret_arg_abi.mode {
6464
PassMode::Ignore => (None, None),
65-
PassMode::Indirect { attrs: _, extra_attrs: None, on_stack: _ } => {
65+
PassMode::Indirect { attrs: _, meta_attrs: None, on_stack: _ } => {
6666
if let Some(ret_ptr) = ret_place.try_to_ptr() {
6767
// This is an optimization to prevent unnecessary copies of the return value when
6868
// the return place is already a memory place as opposed to a register.
@@ -73,7 +73,7 @@ pub(super) fn codegen_with_call_return_arg<'tcx>(
7373
(Some(place), Some(place.to_ptr().get_addr(fx)))
7474
}
7575
}
76-
PassMode::Indirect { attrs: _, extra_attrs: Some(_), on_stack: _ } => {
76+
PassMode::Indirect { attrs: _, meta_attrs: Some(_), on_stack: _ } => {
7777
unreachable!("unsized return value")
7878
}
7979
PassMode::Direct(_) | PassMode::Pair(_, _) | PassMode::Cast(..) => (None, None),
@@ -100,14 +100,14 @@ pub(super) fn codegen_with_call_return_arg<'tcx>(
100100
super::pass_mode::from_casted_value(fx, &results, ret_place.layout(), cast);
101101
ret_place.write_cvalue(fx, result);
102102
}
103-
PassMode::Indirect { attrs: _, extra_attrs: None, on_stack: _ } => {
103+
PassMode::Indirect { attrs: _, meta_attrs: None, on_stack: _ } => {
104104
if let Some(ret_temp_place) = ret_temp_place {
105105
// If ret_temp_place is None, it is not necessary to copy the return value.
106106
let ret_temp_value = ret_temp_place.to_cvalue(fx);
107107
ret_place.write_cvalue(fx, ret_temp_value);
108108
}
109109
}
110-
PassMode::Indirect { attrs: _, extra_attrs: Some(_), on_stack: _ } => {
110+
PassMode::Indirect { attrs: _, meta_attrs: Some(_), on_stack: _ } => {
111111
unreachable!("unsized return value")
112112
}
113113
}
@@ -116,10 +116,10 @@ pub(super) fn codegen_with_call_return_arg<'tcx>(
116116
/// Codegen a return instruction with the right return value(s) if any.
117117
pub(crate) fn codegen_return(fx: &mut FunctionCx<'_, '_, '_>) {
118118
match fx.fn_abi.as_ref().unwrap().ret.mode {
119-
PassMode::Ignore | PassMode::Indirect { attrs: _, extra_attrs: None, on_stack: _ } => {
119+
PassMode::Ignore | PassMode::Indirect { attrs: _, meta_attrs: None, on_stack: _ } => {
120120
fx.bcx.ins().return_(&[]);
121121
}
122-
PassMode::Indirect { attrs: _, extra_attrs: Some(_), on_stack: _ } => {
122+
PassMode::Indirect { attrs: _, meta_attrs: Some(_), on_stack: _ } => {
123123
unreachable!("unsized return value")
124124
}
125125
PassMode::Direct(_) => {

0 commit comments

Comments
 (0)