@@ -5,7 +5,7 @@ use rustc_macros::HashStable_Generic;
55use rustc_span:: Symbol ;
66
77use 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 } ;
99
1010mod aarch64;
1111mod amdgpu;
@@ -875,7 +875,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
875875 ) -> Result < ( ) , AdjustForForeignAbiError >
876876 where
877877 Ty : TyAbiInterface < ' a , C > + Copy ,
878- C : HasDataLayout + HasTargetSpec + HasWasmCAbiOpt ,
878+ C : HasDataLayout + HasTargetSpec + HasWasmCAbiOpt + HasX86AbiOpt ,
879879 {
880880 if abi == spec:: abi:: Abi :: X86Interrupt {
881881 if let Some ( arg) = self . args . first_mut ( ) {
@@ -888,14 +888,18 @@ impl<'a, Ty> FnAbi<'a, Ty> {
888888 let spec = cx. target_spec ( ) ;
889889 match & spec. arch [ ..] {
890890 "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 ) ,
897901 } ;
898- x86:: compute_abi_info ( cx, self , flavor) ;
902+ x86:: compute_abi_info ( cx, self , x86 :: X86Options { flavor, regparm } ) ;
899903 }
900904 "x86_64" => match abi {
901905 spec:: abi:: Abi :: SysV64 { .. } => x86_64:: compute_abi_info ( cx, self ) ,
0 commit comments