@@ -5,7 +5,7 @@ use rustc_macros::HashStable_Generic;
5
5
use rustc_span:: Symbol ;
6
6
7
7
use crate :: abi:: { self , Abi , Align , FieldsShape , HasDataLayout , Size , TyAbiInterface , TyAndLayout } ;
8
- use crate :: spec:: { self , HasTargetSpec , HasWasmCAbiOpt , WasmCAbi } ;
8
+ use crate :: spec:: { self , HasTargetSpec , HasWasmCAbiOpt , HasX86AbiOpt , WasmCAbi } ;
9
9
10
10
mod aarch64;
11
11
mod amdgpu;
@@ -877,7 +877,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
877
877
) -> Result < ( ) , AdjustForForeignAbiError >
878
878
where
879
879
Ty : TyAbiInterface < ' a , C > + Copy ,
880
- C : HasDataLayout + HasTargetSpec + HasWasmCAbiOpt ,
880
+ C : HasDataLayout + HasTargetSpec + HasWasmCAbiOpt + HasX86AbiOpt ,
881
881
{
882
882
if abi == spec:: abi:: Abi :: X86Interrupt {
883
883
if let Some ( arg) = self . args . first_mut ( ) {
@@ -890,14 +890,18 @@ impl<'a, Ty> FnAbi<'a, Ty> {
890
890
let spec = cx. target_spec ( ) ;
891
891
match & spec. arch [ ..] {
892
892
"x86" => {
893
- let flavor = if let spec:: abi:: Abi :: Fastcall { .. }
894
- | spec:: abi:: Abi :: Vectorcall { .. } = abi
895
- {
896
- x86:: Flavor :: FastcallOrVectorcall
897
- } else {
898
- x86:: Flavor :: General
893
+ let ( flavor, regparm) = match abi {
894
+ spec:: abi:: Abi :: Fastcall { .. } | spec:: abi:: Abi :: Vectorcall { .. } => {
895
+ ( x86:: Flavor :: FastcallOrVectorcall , None )
896
+ }
897
+ spec:: abi:: Abi :: C { .. }
898
+ | spec:: abi:: Abi :: Cdecl { .. }
899
+ | spec:: abi:: Abi :: Stdcall { .. } => {
900
+ ( x86:: Flavor :: General , cx. x86_abi_opt ( ) . regparm )
901
+ }
902
+ _ => ( x86:: Flavor :: General , None ) ,
899
903
} ;
900
- x86:: compute_abi_info ( cx, self , flavor) ;
904
+ x86:: compute_abi_info ( cx, self , x86 :: X86Options { flavor, regparm } ) ;
901
905
}
902
906
"x86_64" => match abi {
903
907
spec:: abi:: Abi :: SysV64 { .. } => x86_64:: compute_abi_info ( cx, self ) ,
0 commit comments