@@ -16,9 +16,9 @@ use tracing::{debug, instrument};
16
16
use super :: place:: { PlaceRef , PlaceValue } ;
17
17
use super :: rvalue:: transmute_scalar;
18
18
use super :: { FunctionCx , LocalRef } ;
19
+ use crate :: MemFlags ;
19
20
use crate :: common:: IntPredicate ;
20
21
use crate :: traits:: * ;
21
- use crate :: { MemFlags , size_of_val} ;
22
22
23
23
/// The representation of a Rust value. The enum variant is in fact
24
24
/// uniquely determined by the value's type, but is kept as a
@@ -800,44 +800,6 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue<V> {
800
800
}
801
801
}
802
802
}
803
-
804
- pub fn store_unsized < Bx : BuilderMethods < ' a , ' tcx , Value = V > > (
805
- self ,
806
- bx : & mut Bx ,
807
- indirect_dest : PlaceRef < ' tcx , V > ,
808
- ) {
809
- debug ! ( "OperandRef::store_unsized: operand={:?}, indirect_dest={:?}" , self , indirect_dest) ;
810
- // `indirect_dest` must have `*mut T` type. We extract `T` out of it.
811
- let unsized_ty = indirect_dest
812
- . layout
813
- . ty
814
- . builtin_deref ( true )
815
- . unwrap_or_else ( || bug ! ( "indirect_dest has non-pointer type: {:?}" , indirect_dest) ) ;
816
-
817
- let OperandValue :: Ref ( PlaceValue { llval : llptr, llextra : Some ( llextra) , .. } ) = self
818
- else {
819
- bug ! ( "store_unsized called with a sized value (or with an extern type)" )
820
- } ;
821
-
822
- // Allocate an appropriate region on the stack, and copy the value into it. Since alloca
823
- // doesn't support dynamic alignment, we allocate an extra align - 1 bytes, and align the
824
- // pointer manually.
825
- let ( size, align) = size_of_val:: size_and_align_of_dst ( bx, unsized_ty, Some ( llextra) ) ;
826
- let one = bx. const_usize ( 1 ) ;
827
- let align_minus_1 = bx. sub ( align, one) ;
828
- let size_extra = bx. add ( size, align_minus_1) ;
829
- let min_align = Align :: ONE ;
830
- let alloca = bx. dynamic_alloca ( size_extra, min_align) ;
831
- let address = bx. ptrtoint ( alloca, bx. type_isize ( ) ) ;
832
- let neg_address = bx. neg ( address) ;
833
- let offset = bx. and ( neg_address, align_minus_1) ;
834
- let dst = bx. inbounds_ptradd ( alloca, offset) ;
835
- bx. memcpy ( dst, min_align, llptr, min_align, size, MemFlags :: empty ( ) ) ;
836
-
837
- // Store the allocated region and the extra to the indirect place.
838
- let indirect_operand = OperandValue :: Pair ( dst, llextra) ;
839
- indirect_operand. store ( bx, indirect_dest) ;
840
- }
841
803
}
842
804
843
805
impl < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > FunctionCx < ' a , ' tcx , Bx > {
0 commit comments