@@ -141,14 +141,6 @@ static llvm::Constant *getDestroyBoxedOpaqueExistentialBufferFunction(
141
141
IRGenModule &IGM, OpaqueExistentialLayout existLayout,
142
142
llvm::Type *existContainerPointerTy);
143
143
144
- static llvm::Constant *getInitWithTakeBoxedOpaqueExistentialBufferFunction (
145
- IRGenModule &IGM, OpaqueExistentialLayout existLayout,
146
- llvm::Type *existContainerPointerTy);
147
-
148
- static llvm::Constant *getInitWithCopyBoxedOpaqueExistentialBufferFunction (
149
- IRGenModule &IGM, OpaqueExistentialLayout existLayout,
150
- llvm::Type *existContainerPointerTy);
151
-
152
144
static llvm::Constant *
153
145
getProjectBoxedOpaqueExistentialFunction (IRGenFunction &IGF,
154
146
OpenedExistentialAccess accessKind,
@@ -2789,112 +2781,3 @@ static llvm::Constant *getDestroyBoxedOpaqueExistentialBufferFunction(
2789
2781
}
2790
2782
}, true /* noinline*/ );
2791
2783
}
2792
-
2793
- static llvm::Constant *getInitWithTakeBoxedOpaqueExistentialBufferFunction (
2794
- IRGenModule &IGM, OpaqueExistentialLayout existLayout,
2795
- llvm::Type *existContainerPointerTy) {
2796
-
2797
- llvm::Type *argTys[] = {existContainerPointerTy, existContainerPointerTy};
2798
-
2799
- llvm::SmallString<40 > fnName;
2800
- llvm::raw_svector_ostream (fnName)
2801
- << " __swift_initWithTake_boxed_opaque_existential_"
2802
- << existLayout.getNumTables ();
2803
-
2804
- return IGM.getOrCreateHelperFunction (
2805
- fnName, IGM.VoidTy , argTys, [&](IRGenFunction &IGF) {
2806
- auto &Builder = IGF.Builder ;
2807
- auto it = IGF.CurFn ->arg_begin ();
2808
- Address dest (&*(it++), existLayout.getAlignment (IGM));
2809
- Address src (&*(it++), existLayout.getAlignment (IGM));
2810
- auto *metadata = existLayout.loadMetadataRef (IGF, src);
2811
- auto srcBuffer = existLayout.projectExistentialBuffer (IGF, src);
2812
- auto destBuffer = existLayout.projectExistentialBuffer (IGF, dest);
2813
- // Is the value stored inline?
2814
- //
2815
- llvm::Value *isInline, *flags;
2816
- std::tie (isInline, flags) = emitLoadOfIsInline (IGF, metadata);
2817
- auto *inlineBB = IGF.createBasicBlock (" inline" );
2818
- auto *outlineBB = IGF.createBasicBlock (" outline" );
2819
- Builder.CreateCondBr (isInline, inlineBB, outlineBB);
2820
-
2821
- Builder.emitBlock (inlineBB);
2822
- {
2823
- ConditionalDominanceScope domScope (IGF);
2824
- emitInitializeWithTakeCall (IGF, metadata,
2825
- castToOpaquePtr (IGF, destBuffer),
2826
- castToOpaquePtr (IGF, srcBuffer));
2827
- Builder.CreateRetVoid ();
2828
- }
2829
-
2830
- Builder.emitBlock (outlineBB);
2831
- {
2832
- ConditionalDominanceScope domScope (IGF);
2833
-
2834
- // destBuffer[0] = srcBuffer[0]
2835
- auto *srcReferenceAddr = Builder.CreateBitCast (
2836
- srcBuffer.getAddress (), IGM.RefCountedPtrTy ->getPointerTo ());
2837
- auto *reference =
2838
- Builder.CreateLoad (srcReferenceAddr, srcBuffer.getAlignment ());
2839
- auto *destReferenceAddr = Builder.CreateBitCast (
2840
- destBuffer.getAddress (), IGM.RefCountedPtrTy ->getPointerTo ());
2841
- IGF.Builder .CreateStore (
2842
- reference,
2843
- Address (destReferenceAddr, existLayout.getAlignment (IGF.IGM )));
2844
- Builder.CreateRetVoid ();
2845
- }
2846
-
2847
- }, true /* noinline*/ );
2848
- }
2849
-
2850
- static llvm::Constant *getInitWithCopyBoxedOpaqueExistentialBufferFunction (
2851
- IRGenModule &IGM, OpaqueExistentialLayout existLayout,
2852
- llvm::Type *existContainerPointerTy) {
2853
-
2854
- llvm::Type *argTys[] = {existContainerPointerTy, existContainerPointerTy};
2855
-
2856
- llvm::SmallString<40 > fnName;
2857
- llvm::raw_svector_ostream (fnName)
2858
- << " __swift_initWithCopy_boxed_opaque_existential_"
2859
- << existLayout.getNumTables ();
2860
- return IGM.getOrCreateHelperFunction (
2861
- fnName, IGM.VoidTy , argTys,
2862
- [&](IRGenFunction &IGF) {
2863
- auto &Builder = IGF.Builder ;
2864
- auto it = IGF.CurFn ->arg_begin ();
2865
- Address dest (&*(it++), existLayout.getAlignment (IGM));
2866
- Address src (&*(it++), existLayout.getAlignment (IGM));
2867
- auto *metadata = existLayout.loadMetadataRef (IGF, src);
2868
- auto srcBuffer = existLayout.projectExistentialBuffer (IGF, src);
2869
- auto destBuffer = existLayout.projectExistentialBuffer (IGF, dest);
2870
- // Is the value stored inline?
2871
- //
2872
- llvm::Value *isInline, *flags;
2873
- std::tie (isInline, flags) = emitLoadOfIsInline (IGF, metadata);
2874
- auto *inlineBB = IGF.createBasicBlock (" inline" );
2875
- auto *outlineBB = IGF.createBasicBlock (" outline" );
2876
- Builder.CreateCondBr (isInline, inlineBB, outlineBB);
2877
-
2878
- Builder.emitBlock (inlineBB);
2879
- {
2880
- ConditionalDominanceScope domScope (IGF);
2881
- emitInitializeWithCopyCall (IGF, metadata,
2882
- castToOpaquePtr (IGF, destBuffer),
2883
- castToOpaquePtr (IGF, srcBuffer));
2884
- Builder.CreateRetVoid ();
2885
- }
2886
-
2887
- Builder.emitBlock (outlineBB);
2888
- {
2889
- ConditionalDominanceScope domScope (IGF);
2890
-
2891
- // destBuffer[0] = srcBuffer[0]
2892
- // swift_retain(srcBuffer[0])
2893
- initBufferWithCopyOfReference (IGF, existLayout, destBuffer,
2894
- srcBuffer);
2895
- Builder.CreateRetVoid ();
2896
- }
2897
-
2898
- },
2899
- true /* noinline*/ );
2900
- }
0 commit comments