@@ -187,7 +187,7 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
187
187
return ;
188
188
}
189
189
let cx = bx. cx ;
190
- if self . is_indirect ( ) {
190
+ if self . is_sized_indirect ( ) {
191
191
OperandValue :: Ref ( val, self . layout . align ) . store ( bx, dst)
192
192
} else if self . is_unsized_indirect ( ) {
193
193
bug ! ( "unsized ArgType must be handled through store_fn_arg" ) ;
@@ -248,10 +248,10 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
248
248
PassMode :: Pair ( ..) => {
249
249
OperandValue :: Pair ( next ( ) , next ( ) ) . store ( bx, dst) ;
250
250
}
251
- PassMode :: UnsizedIndirect ( .. ) => {
251
+ PassMode :: Indirect ( _ , Some ( _ ) ) => {
252
252
OperandValue :: UnsizedRef ( next ( ) , next ( ) ) . store ( bx, dst) ;
253
253
}
254
- PassMode :: Direct ( _) | PassMode :: Indirect ( _) | PassMode :: Cast ( _) => {
254
+ PassMode :: Direct ( _) | PassMode :: Indirect ( _, None ) | PassMode :: Cast ( _) => {
255
255
self . store ( bx, next ( ) , dst) ;
256
256
}
257
257
}
@@ -547,9 +547,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
547
547
}
548
548
549
549
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) {
553
551
arg. make_indirect ( ) ;
554
552
} else {
555
553
// We want to pass small aggregates as immediates, but using
@@ -565,7 +563,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
565
563
for arg in & mut self . args {
566
564
fixup ( arg) ;
567
565
}
568
- if let PassMode :: Indirect ( ref mut attrs) = self . ret . mode {
566
+ if let PassMode :: Indirect ( ref mut attrs, _ ) = self . ret . mode {
569
567
attrs. set ( ArgAttribute :: StructRet ) ;
570
568
}
571
569
return ;
@@ -582,7 +580,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
582
580
if let PassMode :: Pair ( _, _) = arg. mode { 2 } else { 1 }
583
581
) . sum ( ) ;
584
582
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
586
584
) ;
587
585
588
586
let llreturn_ty = match self . ret . mode {
@@ -591,11 +589,10 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
591
589
self . ret . layout . immediate_llvm_type ( cx)
592
590
}
593
591
PassMode :: Cast ( cast) => cast. llvm_type ( cx) ,
594
- PassMode :: Indirect ( _ ) => {
592
+ PassMode :: Indirect ( .. ) => {
595
593
llargument_tys. push ( self . ret . memory_ty ( cx) . ptr_to ( ) ) ;
596
594
Type :: void ( cx)
597
595
}
598
- PassMode :: UnsizedIndirect ( ..) => bug ! ( "return type must be sized" ) ,
599
596
} ;
600
597
601
598
for arg in & self . args {
@@ -612,15 +609,15 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
612
609
llargument_tys. push ( arg. layout . scalar_pair_element_llvm_type ( cx, 1 , true ) ) ;
613
610
continue ;
614
611
}
615
- PassMode :: UnsizedIndirect ( .. ) => {
612
+ PassMode :: Indirect ( _ , Some ( _ ) ) => {
616
613
let ptr_ty = cx. tcx . mk_mut_ptr ( arg. layout . ty ) ;
617
614
let ptr_layout = cx. layout_of ( ptr_ty) ;
618
615
llargument_tys. push ( ptr_layout. scalar_pair_element_llvm_type ( cx, 0 , true ) ) ;
619
616
llargument_tys. push ( ptr_layout. scalar_pair_element_llvm_type ( cx, 1 , true ) ) ;
620
617
continue ;
621
618
}
622
619
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 ( ) ,
624
621
} ;
625
622
llargument_tys. push ( llarg_ty) ;
626
623
}
@@ -659,7 +656,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
659
656
PassMode :: Direct ( ref attrs) => {
660
657
attrs. apply_llfn ( llvm:: AttributePlace :: ReturnValue , llfn) ;
661
658
}
662
- PassMode :: Indirect ( ref attrs) => apply ( attrs) ,
659
+ PassMode :: Indirect ( ref attrs, _ ) => apply ( attrs) ,
663
660
_ => { }
664
661
}
665
662
for arg in & self . args {
@@ -669,8 +666,8 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
669
666
match arg. mode {
670
667
PassMode :: Ignore => { }
671
668
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) ) => {
674
671
apply ( attrs) ;
675
672
apply ( extra_attrs) ;
676
673
}
@@ -693,7 +690,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
693
690
PassMode :: Direct ( ref attrs) => {
694
691
attrs. apply_callsite ( llvm:: AttributePlace :: ReturnValue , callsite) ;
695
692
}
696
- PassMode :: Indirect ( ref attrs) => apply ( attrs) ,
693
+ PassMode :: Indirect ( ref attrs, _ ) => apply ( attrs) ,
697
694
_ => { }
698
695
}
699
696
if let layout:: Abi :: Scalar ( ref scalar) = self . ret . layout . abi {
@@ -717,8 +714,8 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
717
714
match arg. mode {
718
715
PassMode :: Ignore => { }
719
716
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) ) => {
722
719
apply ( attrs) ;
723
720
apply ( extra_attrs) ;
724
721
}
0 commit comments