Small change
This commit is contained in:
parent
16593d264c
commit
deeae2fce4
2 changed files with 4 additions and 9 deletions
|
@ -49,12 +49,7 @@ fn clif_sig_from_fn_sig<'tcx>(tcx: TyCtxt<'tcx>, sig: FnSig<'tcx>, is_vtable_fn:
|
||||||
// See https://github.com/rust-lang/rust/blob/37b6a5e5e82497caf5353d9d856e4eb5d14cbe06/src/librustc/ty/layout.rs#L2519-L2572 for more info
|
// See https://github.com/rust-lang/rust/blob/37b6a5e5e82497caf5353d9d856e4eb5d14cbe06/src/librustc/ty/layout.rs#L2519-L2572 for more info
|
||||||
layout = tcx.layout_of(ParamEnv::reveal_all().and(tcx.mk_mut_ptr(tcx.mk_unit()))).unwrap();
|
layout = tcx.layout_of(ParamEnv::reveal_all().and(tcx.mk_mut_ptr(tcx.mk_unit()))).unwrap();
|
||||||
}
|
}
|
||||||
match get_pass_mode(tcx, layout) {
|
get_pass_mode(tcx, layout).get_param_ty(tcx).into_iter()
|
||||||
PassMode::NoPass => Empty,
|
|
||||||
PassMode::ByVal(clif_ty) => Single(clif_ty),
|
|
||||||
PassMode::ByValPair(clif_ty_a, clif_ty_b) => Pair(clif_ty_a, clif_ty_b),
|
|
||||||
PassMode::ByRef => Single(pointer_ty(tcx)),
|
|
||||||
}.into_iter()
|
|
||||||
}).flatten();
|
}).flatten();
|
||||||
|
|
||||||
let (params, returns) = match get_pass_mode(tcx, tcx.layout_of(ParamEnv::reveal_all().and(output)).unwrap()) {
|
let (params, returns) = match get_pass_mode(tcx, tcx.layout_of(ParamEnv::reveal_all().and(output)).unwrap()) {
|
||||||
|
|
|
@ -65,12 +65,12 @@ impl<T: std::fmt::Debug> EmptySinglePair<T> {
|
||||||
pub use EmptySinglePair::*;
|
pub use EmptySinglePair::*;
|
||||||
|
|
||||||
impl PassMode {
|
impl PassMode {
|
||||||
pub fn get_param_ty(self, fx: &FunctionCx<impl Backend>) -> EmptySinglePair<Type> {
|
pub fn get_param_ty(self, tcx: TyCtxt<'_>) -> EmptySinglePair<Type> {
|
||||||
match self {
|
match self {
|
||||||
PassMode::NoPass => Empty,
|
PassMode::NoPass => Empty,
|
||||||
PassMode::ByVal(clif_type) => Single(clif_type),
|
PassMode::ByVal(clif_type) => Single(clif_type),
|
||||||
PassMode::ByValPair(a, b) => Pair(a, b),
|
PassMode::ByValPair(a, b) => Pair(a, b),
|
||||||
PassMode::ByRef => Single(fx.pointer_type),
|
PassMode::ByRef => Single(pointer_ty(tcx)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ pub fn cvalue_for_param<'tcx>(
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let clif_types = pass_mode.get_param_ty(fx);
|
let clif_types = pass_mode.get_param_ty(fx.tcx);
|
||||||
let ebb_params = clif_types.map(|t| fx.bcx.append_ebb_param(start_ebb, t));
|
let ebb_params = clif_types.map(|t| fx.bcx.append_ebb_param(start_ebb, t));
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue