@@ -187,7 +187,7 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
187187 return ;
188188 }
189189 let cx = bx. cx ;
190- if self . is_indirect ( ) {
190+ if self . is_sized_indirect ( ) {
191191 OperandValue :: Ref ( val, self . layout . align ) . store ( bx, dst)
192192 } else if self . is_unsized_indirect ( ) {
193193 bug ! ( "unsized ArgType must be handled through store_fn_arg" ) ;
@@ -248,10 +248,10 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
248248 PassMode :: Pair ( ..) => {
249249 OperandValue :: Pair ( next ( ) , next ( ) ) . store ( bx, dst) ;
250250 }
251- PassMode :: UnsizedIndirect ( .. ) => {
251+ PassMode :: Indirect ( _ , Some ( _ ) ) => {
252252 OperandValue :: UnsizedRef ( next ( ) , next ( ) ) . store ( bx, dst) ;
253253 }
254- PassMode :: Direct ( _) | PassMode :: Indirect ( _) | PassMode :: Cast ( _) => {
254+ PassMode :: Direct ( _) | PassMode :: Indirect ( _, None ) | PassMode :: Cast ( _) => {
255255 self . store ( bx, next ( ) , dst) ;
256256 }
257257 }
@@ -547,9 +547,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
547547 }
548548
549549 let size = arg. layout . size ;
550- if arg. layout . is_unsized ( ) {
551- arg. make_unsized_indirect ( None ) ;
552- } else if size > layout:: Pointer . size ( cx) {
550+ if arg. layout . is_unsized ( ) || size > layout:: Pointer . size ( cx) {
553551 arg. make_indirect ( ) ;
554552 } else {
555553 // We want to pass small aggregates as immediates, but using
@@ -565,7 +563,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
565563 for arg in & mut self . args {
566564 fixup ( arg) ;
567565 }
568- if let PassMode :: Indirect ( ref mut attrs) = self . ret . mode {
566+ if let PassMode :: Indirect ( ref mut attrs, _ ) = self . ret . mode {
569567 attrs. set ( ArgAttribute :: StructRet ) ;
570568 }
571569 return ;
@@ -582,7 +580,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
582580 if let PassMode :: Pair ( _, _) = arg. mode { 2 } else { 1 }
583581 ) . sum ( ) ;
584582 let mut llargument_tys = Vec :: with_capacity (
585- if let PassMode :: Indirect ( _ ) = self . ret . mode { 1 } else { 0 } + args_capacity
583+ if let PassMode :: Indirect ( .. ) = self . ret . mode { 1 } else { 0 } + args_capacity
586584 ) ;
587585
588586 let llreturn_ty = match self . ret . mode {
@@ -591,11 +589,10 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
591589 self . ret . layout . immediate_llvm_type ( cx)
592590 }
593591 PassMode :: Cast ( cast) => cast. llvm_type ( cx) ,
594- PassMode :: Indirect ( _ ) => {
592+ PassMode :: Indirect ( .. ) => {
595593 llargument_tys. push ( self . ret . memory_ty ( cx) . ptr_to ( ) ) ;
596594 Type :: void ( cx)
597595 }
598- PassMode :: UnsizedIndirect ( ..) => bug ! ( "return type must be sized" ) ,
599596 } ;
600597
601598 for arg in & self . args {
@@ -612,15 +609,15 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
612609 llargument_tys. push ( arg. layout . scalar_pair_element_llvm_type ( cx, 1 , true ) ) ;
613610 continue ;
614611 }
615- PassMode :: UnsizedIndirect ( .. ) => {
612+ PassMode :: Indirect ( _ , Some ( _ ) ) => {
616613 let ptr_ty = cx. tcx . mk_mut_ptr ( arg. layout . ty ) ;
617614 let ptr_layout = cx. layout_of ( ptr_ty) ;
618615 llargument_tys. push ( ptr_layout. scalar_pair_element_llvm_type ( cx, 0 , true ) ) ;
619616 llargument_tys. push ( ptr_layout. scalar_pair_element_llvm_type ( cx, 1 , true ) ) ;
620617 continue ;
621618 }
622619 PassMode :: Cast ( cast) => cast. llvm_type ( cx) ,
623- PassMode :: Indirect ( _) => arg. memory_ty ( cx) . ptr_to ( ) ,
620+ PassMode :: Indirect ( _, None ) => arg. memory_ty ( cx) . ptr_to ( ) ,
624621 } ;
625622 llargument_tys. push ( llarg_ty) ;
626623 }
@@ -659,7 +656,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
659656 PassMode :: Direct ( ref attrs) => {
660657 attrs. apply_llfn ( llvm:: AttributePlace :: ReturnValue , llfn) ;
661658 }
662- PassMode :: Indirect ( ref attrs) => apply ( attrs) ,
659+ PassMode :: Indirect ( ref attrs, _ ) => apply ( attrs) ,
663660 _ => { }
664661 }
665662 for arg in & self . args {
@@ -669,8 +666,8 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
669666 match arg. mode {
670667 PassMode :: Ignore => { }
671668 PassMode :: Direct ( ref attrs) |
672- PassMode :: Indirect ( ref attrs) => apply ( attrs) ,
673- PassMode :: UnsizedIndirect ( ref attrs, ref extra_attrs) => {
669+ PassMode :: Indirect ( ref attrs, None ) => apply ( attrs) ,
670+ PassMode :: Indirect ( ref attrs, Some ( ref extra_attrs) ) => {
674671 apply ( attrs) ;
675672 apply ( extra_attrs) ;
676673 }
@@ -693,7 +690,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
693690 PassMode :: Direct ( ref attrs) => {
694691 attrs. apply_callsite ( llvm:: AttributePlace :: ReturnValue , callsite) ;
695692 }
696- PassMode :: Indirect ( ref attrs) => apply ( attrs) ,
693+ PassMode :: Indirect ( ref attrs, _ ) => apply ( attrs) ,
697694 _ => { }
698695 }
699696 if let layout:: Abi :: Scalar ( ref scalar) = self . ret . layout . abi {
@@ -717,8 +714,8 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
717714 match arg. mode {
718715 PassMode :: Ignore => { }
719716 PassMode :: Direct ( ref attrs) |
720- PassMode :: Indirect ( ref attrs) => apply ( attrs) ,
721- PassMode :: UnsizedIndirect ( ref attrs, ref extra_attrs) => {
717+ PassMode :: Indirect ( ref attrs, None ) => apply ( attrs) ,
718+ PassMode :: Indirect ( ref attrs, Some ( ref extra_attrs) ) => {
722719 apply ( attrs) ;
723720 apply ( extra_attrs) ;
724721 }
0 commit comments