|
1 |
| -use rustc_abi::{BackendRepr, Float, Integer, Primitive, RegKind, Size}; |
| 1 | +use rustc_abi::{BackendRepr, Float, Integer, Primitive, RegKind, Size, TyAbiInterface}; |
2 | 2 |
|
3 | 3 | use crate::callconv::{ArgAbi, FnAbi, Reg};
|
4 | 4 | use crate::spec::{HasTargetSpec, RustcAbi};
|
5 | 5 |
|
6 | 6 | // Win64 ABI: https://docs.microsoft.com/en-us/cpp/build/parameter-passing
|
7 | 7 |
|
8 |
| -pub(crate) fn compute_abi_info<Ty>(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) { |
| 8 | +pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'a, Ty>) |
| 9 | +where |
| 10 | + Ty: TyAbiInterface<'a, C> + Copy, |
| 11 | +{ |
9 | 12 | let fixup = |a: &mut ArgAbi<'_, Ty>, is_ret: bool| {
|
10 | 13 | match a.layout.backend_repr {
|
11 | 14 | BackendRepr::Memory { sized: false } => {}
|
@@ -59,6 +62,14 @@ pub(crate) fn compute_abi_info<Ty>(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'
|
59 | 62 | arg.make_indirect_from_ignore();
|
60 | 63 | continue;
|
61 | 64 | }
|
| 65 | + // The `win64` ABI can be used on non-Windows targets which set `PASS_INDIRECTLY` on |
| 66 | + // `VaList`, so that case is handled here. `is_pass_indirectly` is only `true` for the |
| 67 | + // System V `VaList`, which would be passed indirectly by `fixup` anyway, so this is just |
| 68 | + // here to make it explicit that this case is handled. |
| 69 | + if arg.layout.is_pass_indirectly() { |
| 70 | + arg.make_indirect(); |
| 71 | + continue; |
| 72 | + } |
62 | 73 | fixup(arg, false);
|
63 | 74 | }
|
64 | 75 | // FIXME: We should likely also do something about ZST return types, similar to above.
|
|
0 commit comments