@@ -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;
@@ -875,7 +875,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
875
875
) -> Result < ( ) , AdjustForForeignAbiError >
876
876
where
877
877
Ty : TyAbiInterface < ' a , C > + Copy ,
878
- C : HasDataLayout + HasTargetSpec + HasWasmCAbiOpt ,
878
+ C : HasDataLayout + HasTargetSpec + HasWasmCAbiOpt + HasX86AbiOpt ,
879
879
{
880
880
if abi == spec:: abi:: Abi :: X86Interrupt {
881
881
if let Some ( arg) = self . args . first_mut ( ) {
@@ -888,14 +888,18 @@ impl<'a, Ty> FnAbi<'a, Ty> {
888
888
let spec = cx. target_spec ( ) ;
889
889
match & spec. arch [ ..] {
890
890
"x86" => {
891
- let flavor = if let spec:: abi:: Abi :: Fastcall { .. }
892
- | spec:: abi:: Abi :: Vectorcall { .. } = abi
893
- {
894
- x86:: Flavor :: FastcallOrVectorcall
895
- } else {
896
- x86:: Flavor :: General
891
+ let ( flavor, regparm) = match abi {
892
+ spec:: abi:: Abi :: Fastcall { .. } | spec:: abi:: Abi :: Vectorcall { .. } => {
893
+ ( x86:: Flavor :: FastcallOrVectorcall , None )
894
+ }
895
+ spec:: abi:: Abi :: C { .. }
896
+ | spec:: abi:: Abi :: Cdecl { .. }
897
+ | spec:: abi:: Abi :: Stdcall { .. } => {
898
+ ( x86:: Flavor :: General , cx. x86_abi_opt ( ) . regparm )
899
+ }
900
+ _ => ( x86:: Flavor :: General , None ) ,
897
901
} ;
898
- x86:: compute_abi_info ( cx, self , flavor) ;
902
+ x86:: compute_abi_info ( cx, self , x86 :: X86Options { flavor, regparm } ) ;
899
903
}
900
904
"x86_64" => match abi {
901
905
spec:: abi:: Abi :: SysV64 { .. } => x86_64:: compute_abi_info ( cx, self ) ,
0 commit comments