@@ -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;
@@ -877,7 +877,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
877877 ) -> Result < ( ) , AdjustForForeignAbiError >
878878 where
879879 Ty : TyAbiInterface < ' a , C > + Copy ,
880- C : HasDataLayout + HasTargetSpec + HasWasmCAbiOpt ,
880+ C : HasDataLayout + HasTargetSpec + HasWasmCAbiOpt + HasX86AbiOpt ,
881881 {
882882 if abi == spec:: abi:: Abi :: X86Interrupt {
883883 if let Some ( arg) = self . args . first_mut ( ) {
@@ -890,14 +890,17 @@ impl<'a, Ty> FnAbi<'a, Ty> {
890890 let spec = cx. target_spec ( ) ;
891891 match & spec. arch [ ..] {
892892 "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 { .. }
895+ | spec:: abi:: Abi :: Vectorcall { .. } =>
896+ ( x86:: Flavor :: FastcallOrVectorcall , None ) ,
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+ _ => ( x86:: Flavor :: General , None )
899902 } ;
900- x86:: compute_abi_info ( cx, self , flavor) ;
903+ x86:: compute_abi_info ( cx, self , x86 :: X86Options { flavor, regparm } ) ;
901904 }
902905 "x86_64" => match abi {
903906 spec:: abi:: Abi :: SysV64 { .. } => x86_64:: compute_abi_info ( cx, self ) ,
0 commit comments