@@ -4,9 +4,9 @@ mod simd;
44#[ cfg( feature = "master" ) ]
55use std:: iter;
66
7- use gccjit:: { ComparisonOp , Function , FunctionType , RValue , ToRValue , UnaryOp } ;
87#[ cfg( feature = "master" ) ]
9- use gccjit:: { FnAttribute , Type } ;
8+ use gccjit:: Type ;
9+ use gccjit:: { ComparisonOp , Function , FunctionType , RValue , ToRValue , UnaryOp } ;
1010#[ cfg( feature = "master" ) ]
1111use rustc_abi:: ExternAbi ;
1212use rustc_abi:: { BackendRepr , HasDataLayout , WrappingRange } ;
@@ -24,16 +24,16 @@ use rustc_codegen_ssa::traits::{
2424} ;
2525use rustc_data_structures:: fx:: FxHashSet ;
2626use rustc_middle:: bug;
27- use rustc_middle:: ty:: layout:: { FnAbiOf , LayoutOf } ;
28- use rustc_middle:: ty:: { self , Instance , Ty } ;
2927#[ cfg( feature = "master" ) ]
30- use rustc_session:: config;
28+ use rustc_middle:: ty:: layout:: FnAbiOf ;
29+ use rustc_middle:: ty:: layout:: LayoutOf ;
30+ use rustc_middle:: ty:: { self , Instance , Ty } ;
3131use rustc_span:: { Span , Symbol , sym} ;
32- #[ cfg( feature = "master" ) ]
33- use rustc_target:: callconv:: ArgAttributes ;
3432use rustc_target:: callconv:: { ArgAbi , PassMode } ;
3533
36- use crate :: abi:: { FnAbiGcc , FnAbiGccExt , GccType } ;
34+ #[ cfg( feature = "master" ) ]
35+ use crate :: abi:: FnAbiGccExt ;
36+ use crate :: abi:: GccType ;
3737use crate :: builder:: Builder ;
3838use crate :: common:: { SignType , TypeReflection } ;
3939use crate :: context:: CodegenCx ;
@@ -625,83 +625,6 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
625625 * func
626626 } else {
627627 self . linkage . set ( FunctionType :: Extern ) ;
628- let fn_abi = self . fn_abi_of_instance ( instance, ty:: List :: empty ( ) ) ;
629- assert ! ( !fn_abi. ret. is_indirect( ) ) ;
630- assert ! ( !fn_abi. c_variadic) ;
631-
632- let return_type = match fn_abi. ret . mode {
633- PassMode :: Ignore => self . type_void ( ) ,
634- PassMode :: Direct ( _) | PassMode :: Pair ( ..) => {
635- fn_abi. ret . layout . immediate_gcc_type ( self )
636- }
637- PassMode :: Cast { .. } | PassMode :: Indirect { .. } => {
638- unreachable ! ( )
639- }
640- } ;
641-
642- #[ cfg( feature = "master" ) ]
643- let mut non_null_args = Vec :: new ( ) ;
644-
645- #[ cfg( feature = "master" ) ]
646- let mut apply_attrs =
647- |mut ty : Type < ' gcc > , attrs : & ArgAttributes , arg_index : usize | {
648- if self . sess ( ) . opts . optimize == config:: OptLevel :: No {
649- return ty;
650- }
651- if attrs. regular . contains ( rustc_target:: callconv:: ArgAttribute :: NoAlias ) {
652- ty = ty. make_restrict ( )
653- }
654- if attrs. regular . contains ( rustc_target:: callconv:: ArgAttribute :: NonNull ) {
655- non_null_args. push ( arg_index as i32 + 1 ) ;
656- }
657- ty
658- } ;
659- #[ cfg( not( feature = "master" ) ) ]
660- let apply_attrs = |ty : Type < ' gcc > , _attrs : & ArgAttributes , _arg_index : usize | ty;
661-
662- let mut argument_tys = Vec :: with_capacity ( fn_abi. args . len ( ) ) ;
663- for arg in fn_abi. args . iter ( ) {
664- match arg. mode {
665- PassMode :: Ignore => { }
666- PassMode :: Pair ( a, b) => {
667- let arg_pos = argument_tys. len ( ) ;
668- argument_tys. push ( apply_attrs (
669- arg. layout . scalar_pair_element_gcc_type ( self , 0 ) ,
670- & a,
671- arg_pos,
672- ) ) ;
673- argument_tys. push ( apply_attrs (
674- arg. layout . scalar_pair_element_gcc_type ( self , 1 ) ,
675- & b,
676- arg_pos + 1 ,
677- ) ) ;
678- }
679- PassMode :: Direct ( attrs) => argument_tys. push ( apply_attrs (
680- arg. layout . immediate_gcc_type ( self ) ,
681- & attrs,
682- argument_tys. len ( ) ,
683- ) ) ,
684- PassMode :: Indirect { .. } | PassMode :: Cast { .. } => {
685- unreachable ! ( )
686- }
687- }
688- }
689-
690- #[ cfg( feature = "master" ) ]
691- let fn_attrs = if non_null_args. is_empty ( ) {
692- Vec :: new ( )
693- } else {
694- vec ! [ FnAttribute :: NonNull ( non_null_args) ]
695- } ;
696-
697- let fn_ty = FnAbiGcc {
698- return_type,
699- arguments_type : argument_tys,
700- is_c_variadic : false ,
701- on_stack_param_indices : FxHashSet :: default ( ) ,
702- #[ cfg( feature = "master" ) ]
703- fn_attributes : fn_attrs,
704- } ;
705628
706629 let func = match sym {
707630 "llvm.fma.f16" => {
@@ -714,13 +637,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
714637
715638 self . intrinsics . borrow_mut ( ) . insert ( sym. to_string ( ) , func) ;
716639
717- self . on_stack_function_params
718- . borrow_mut ( )
719- . insert ( func, fn_ty. on_stack_param_indices ) ;
720- #[ cfg( feature = "master" ) ]
721- for fn_attr in fn_ty. fn_attributes {
722- func. add_attribute ( fn_attr) ;
723- }
640+ self . on_stack_function_params . borrow_mut ( ) . insert ( func, FxHashSet :: default ( ) ) ;
724641
725642 crate :: attributes:: from_fn_attrs ( self , func, instance) ;
726643
0 commit comments