@@ -15,9 +15,9 @@ use tracing::{debug, instrument};
15
15
use super :: place:: { PlaceRef , PlaceValue } ;
16
16
use super :: rvalue:: transmute_immediate;
17
17
use super :: { FunctionCx , LocalRef } ;
18
+ use crate :: MemFlags ;
18
19
use crate :: common:: IntPredicate ;
19
20
use crate :: traits:: * ;
20
- use crate :: { MemFlags , size_of_val} ;
21
21
22
22
/// The representation of a Rust value. The enum variant is in fact
23
23
/// uniquely determined by the value's type, but is kept as a
@@ -771,44 +771,6 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue<V> {
771
771
}
772
772
}
773
773
}
774
-
775
- pub fn store_unsized < Bx : BuilderMethods < ' a , ' tcx , Value = V > > (
776
- self ,
777
- bx : & mut Bx ,
778
- indirect_dest : PlaceRef < ' tcx , V > ,
779
- ) {
780
- debug ! ( "OperandRef::store_unsized: operand={:?}, indirect_dest={:?}" , self , indirect_dest) ;
781
- // `indirect_dest` must have `*mut T` type. We extract `T` out of it.
782
- let unsized_ty = indirect_dest
783
- . layout
784
- . ty
785
- . builtin_deref ( true )
786
- . unwrap_or_else ( || bug ! ( "indirect_dest has non-pointer type: {:?}" , indirect_dest) ) ;
787
-
788
- let OperandValue :: Ref ( PlaceValue { llval : llptr, llextra : Some ( llextra) , .. } ) = self
789
- else {
790
- bug ! ( "store_unsized called with a sized value (or with an extern type)" )
791
- } ;
792
-
793
- // Allocate an appropriate region on the stack, and copy the value into it. Since alloca
794
- // doesn't support dynamic alignment, we allocate an extra align - 1 bytes, and align the
795
- // pointer manually.
796
- let ( size, align) = size_of_val:: size_and_align_of_dst ( bx, unsized_ty, Some ( llextra) ) ;
797
- let one = bx. const_usize ( 1 ) ;
798
- let align_minus_1 = bx. sub ( align, one) ;
799
- let size_extra = bx. add ( size, align_minus_1) ;
800
- let min_align = Align :: ONE ;
801
- let alloca = bx. dynamic_alloca ( size_extra, min_align) ;
802
- let address = bx. ptrtoint ( alloca, bx. type_isize ( ) ) ;
803
- let neg_address = bx. neg ( address) ;
804
- let offset = bx. and ( neg_address, align_minus_1) ;
805
- let dst = bx. inbounds_ptradd ( alloca, offset) ;
806
- bx. memcpy ( dst, min_align, llptr, min_align, size, MemFlags :: empty ( ) ) ;
807
-
808
- // Store the allocated region and the extra to the indirect place.
809
- let indirect_operand = OperandValue :: Pair ( dst, llextra) ;
810
- indirect_operand. store ( bx, indirect_dest) ;
811
- }
812
774
}
813
775
814
776
impl < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > FunctionCx < ' a , ' tcx , Bx > {
0 commit comments