message: Start using ArgAbi
diff: use crate::prelude::*;
  +use rustc_target::abi::call::{ArgAbi, ArgAttributes, PassMode as RustcPassMode};
  pub(super) use EmptySinglePair::*;
  #[derive(Copy, Clone, Debug)]
  @@ -83,9 +84,24 @@ pub(super) fn get_pass_mode<'tcx>(tcx: TyCtxt<'tcx>, layout: TyAndLayout<'tcx>)
  // WARNING zst arguments must never be passed, as that will break CastKind::ClosureFnPointer
  PassMode::NoPass
  } else {
  - match &layout.abi {
  - Abi::Uninhabited => PassMode::NoPass,
  + let arg_abi = ArgAbi::new(&tcx, layout, |_, _, _| ArgAttributes::new());
  + match arg_abi.mode {
  + RustcPassMode::Ignore => PassMode::NoPass,
  + RustcPassMode::Direct(_) => match &arg_abi.layout.abi {
  Abi::Scalar(scalar) => PassMode::ByVal(scalar_to_clif_type(tcx, scalar.clone())),
  + // FIXME implement Vector Abi in a cg_llvm compatible way
  + Abi::Vector { .. } => {
  + if let Some(vector_ty) = crate::intrinsics::clif_vector_type(tcx, arg_abi.layout) {
  + PassMode::ByVal(vector_ty)
  + } else {
  + PassMode::ByRef {
  + size: Some(arg_abi.layout.size),
  + }
  + }
  + }
  + _ => unreachable!("{:?}", arg_abi.layout.abi)
  + },
  + RustcPassMode::Pair(_, _) => match &arg_abi.layout.abi {
  Abi::ScalarPair(a, b) => {
  let a = scalar_to_clif_type(tcx, a.clone());
  let b = scalar_to_clif_type(tcx, b.clone());
  @@ -94,28 +110,38 @@ pub(super) fn get_pass_mode<'tcx>(tcx: TyCtxt<'tcx>, layout: TyAndLayout<'tcx>)
  // available on x86_64. Cranelift gets confused when too many return params
  // are used.
  PassMode::ByRef {
  - size: Some(layout.size),
  + size: Some(arg_abi.layout.size),
  }
  } else {
  PassMode::ByValPair(a, b)
  }
  }
  -
  - // FIXME implement Vector Abi in a cg_llvm compatible way
  - Abi::Vector { .. } => {
  - if let Some(vector_ty) = crate::intrinsics::clif_vector_type(tcx, layout) {
  - PassMode::ByVal(vector_ty)
  - } else {
  + _ => unreachable!("{:?}", arg_abi.layout.abi)
  + },
  + RustcPassMode::Cast(_) | RustcPassMode::Indirect {
  + attrs: _,
  + extra_attrs: None,
  + on_stack: false,
  + } => PassMode::ByRef {
  + size: Some(arg_abi.layout.size),
  + },
  + RustcPassMode::Indirect {
  + attrs: _,
  + extra_attrs,
  + on_stack: true,
  + } => {
  + assert!(extra_attrs.is_none());
  PassMode::ByRef {
  - size: Some(layout.size),
  + size: Some(arg_abi.layout.size)
  }
  }
  - }
  -
  - Abi::Aggregate { sized: true } => PassMode::ByRef {
  - size: Some(layout.size),
  + RustcPassMode::Indirect {
  + attrs: _,
  + extra_attrs: Some(_),
  + on_stack: false,
  + } => PassMode::ByRef {
  + size: None,
  },
  - Abi::Aggregate { sized: false } => PassMode::ByRef { size: None },
  }
  }
  }
  