@@ -495,12 +495,12 @@ namespace {
495
495
void emitDestroyAddress (SILBuilder &B, SILLocation loc,
496
496
SILValue addr) const override {
497
497
SILValue value = B.createLoad (loc, addr);
498
- emitReleaseValue (B, loc, value);
498
+ emitDestroyValue (B, loc, value);
499
499
}
500
500
501
501
void emitDestroyRValue (SILBuilder &B, SILLocation loc,
502
502
SILValue value) const override {
503
- emitReleaseValue (B, loc, value);
503
+ emitDestroyValue (B, loc, value);
504
504
}
505
505
506
506
void emitCopyInto (SILBuilder &B, SILLocation loc,
@@ -533,24 +533,22 @@ namespace {
533
533
// Trivial
534
534
}
535
535
536
- void emitLoweredReleaseValue (SILBuilder &B, SILLocation loc,
537
- SILValue value,
536
+ void emitLoweredDestroyValue (SILBuilder &B, SILLocation loc, SILValue value,
538
537
LoweringStyle loweringStyle) const override {
539
538
// Trivial
540
539
}
541
540
542
- void emitLoweredRetainValue (SILBuilder &B, SILLocation loc,
543
- SILValue value,
541
+ void emitLoweredCopyValue (SILBuilder &B, SILLocation loc, SILValue value,
544
542
LoweringStyle style) const override {
545
543
// Trivial
546
544
}
547
545
548
- void emitRetainValue (SILBuilder &B, SILLocation loc,
546
+ void emitCopyValue (SILBuilder &B, SILLocation loc,
549
547
SILValue value) const override {
550
548
// Trivial
551
549
}
552
550
553
- void emitReleaseValue (SILBuilder &B, SILLocation loc,
551
+ void emitDestroyValue (SILBuilder &B, SILLocation loc,
554
552
SILValue value) const override {
555
553
// Trivial
556
554
}
@@ -565,7 +563,8 @@ namespace {
565
563
SILValue emitLoadOfCopy (SILBuilder &B, SILLocation loc,
566
564
SILValue addr, IsTake_t isTake) const override {
567
565
SILValue value = B.createLoad (loc, addr);
568
- if (!isTake) emitRetainValue (B, loc, value);
566
+ if (!isTake)
567
+ emitCopyValue (B, loc, value);
569
568
return value;
570
569
}
571
570
@@ -575,7 +574,8 @@ namespace {
575
574
SILValue oldValue;
576
575
if (!isInit) oldValue = B.createLoad (loc, addr);
577
576
B.createStore (loc, newValue, addr);
578
- if (!isInit) emitReleaseValue (B, loc, oldValue);
577
+ if (!isInit)
578
+ emitDestroyValue (B, loc, oldValue);
579
579
}
580
580
};
581
581
@@ -657,13 +657,12 @@ namespace {
657
657
});
658
658
}
659
659
660
- void emitRetainValue (SILBuilder &B, SILLocation loc,
660
+ void emitCopyValue (SILBuilder &B, SILLocation loc,
661
661
SILValue aggValue) const override {
662
662
B.createRetainValue (loc, aggValue, Atomicity::Atomic);
663
663
}
664
664
665
- void emitLoweredRetainValue (SILBuilder &B, SILLocation loc,
666
- SILValue aggValue,
665
+ void emitLoweredCopyValue (SILBuilder &B, SILLocation loc, SILValue aggValue,
667
666
LoweringStyle style) const override {
668
667
for (auto &child : getChildren (B.getModule ())) {
669
668
auto &childLowering = child.getLowering ();
@@ -676,22 +675,22 @@ namespace {
676
675
}
677
676
}
678
677
679
- void emitReleaseValue (SILBuilder &B, SILLocation loc,
678
+ void emitDestroyValue (SILBuilder &B, SILLocation loc,
680
679
SILValue aggValue) const override {
681
680
B.emitReleaseValueAndFold (loc, aggValue);
682
681
}
683
682
684
- void emitLoweredReleaseValue (SILBuilder &B, SILLocation loc,
683
+ void emitLoweredDestroyValue (SILBuilder &B, SILLocation loc,
685
684
SILValue aggValue,
686
685
LoweringStyle loweringStyle) const override {
687
686
SimpleOperationTy Fn;
688
687
689
688
switch (loweringStyle) {
690
689
case LoweringStyle::Shallow:
691
- Fn = &TypeLowering::emitReleaseValue ;
690
+ Fn = &TypeLowering::emitDestroyValue ;
692
691
break ;
693
692
case LoweringStyle::DeepNoEnum:
694
- Fn = &TypeLowering::emitLoweredReleaseValueDeepNoEnum ;
693
+ Fn = &TypeLowering::emitLoweredDestroyValueDeepNoEnum ;
695
694
break ;
696
695
}
697
696
@@ -774,24 +773,22 @@ namespace {
774
773
: NonTrivialLoadableTypeLowering(SILType::getPrimitiveObjectType(type),
775
774
IsNotReferenceCounted) {}
776
775
777
- void emitRetainValue (SILBuilder &B, SILLocation loc,
776
+ void emitCopyValue (SILBuilder &B, SILLocation loc,
778
777
SILValue value) const override {
779
778
B.createRetainValue (loc, value, Atomicity::Atomic);
780
779
}
781
780
782
- void emitLoweredRetainValue (SILBuilder &B, SILLocation loc,
783
- SILValue value,
781
+ void emitLoweredCopyValue (SILBuilder &B, SILLocation loc, SILValue value,
784
782
LoweringStyle style) const override {
785
783
B.createRetainValue (loc, value, Atomicity::Atomic);
786
784
}
787
-
788
- void emitReleaseValue (SILBuilder &B, SILLocation loc,
785
+
786
+ void emitDestroyValue (SILBuilder &B, SILLocation loc,
789
787
SILValue value) const override {
790
788
B.emitReleaseValueAndFold (loc, value);
791
789
}
792
790
793
- void emitLoweredReleaseValue (SILBuilder &B, SILLocation loc,
794
- SILValue value,
791
+ void emitLoweredDestroyValue (SILBuilder &B, SILLocation loc, SILValue value,
795
792
LoweringStyle style) const override {
796
793
assert (style != LoweringStyle::Shallow &&
797
794
" This method should never be called when performing a shallow "
@@ -805,16 +802,14 @@ namespace {
805
802
LeafLoadableTypeLowering (SILType type, IsReferenceCounted_t isRefCounted)
806
803
: NonTrivialLoadableTypeLowering(type, isRefCounted) {}
807
804
808
- void emitLoweredRetainValue (SILBuilder &B, SILLocation loc,
809
- SILValue value,
805
+ void emitLoweredCopyValue (SILBuilder &B, SILLocation loc, SILValue value,
810
806
LoweringStyle style) const override {
811
- emitRetainValue (B, loc, value);
807
+ emitCopyValue (B, loc, value);
812
808
}
813
809
814
- void emitLoweredReleaseValue (SILBuilder &B, SILLocation loc,
815
- SILValue value,
810
+ void emitLoweredDestroyValue (SILBuilder &B, SILLocation loc, SILValue value,
816
811
LoweringStyle style) const override {
817
- emitReleaseValue (B, loc, value);
812
+ emitDestroyValue (B, loc, value);
818
813
}
819
814
};
820
815
@@ -825,13 +820,13 @@ namespace {
825
820
ReferenceTypeLowering (SILType type)
826
821
: LeafLoadableTypeLowering(type, IsReferenceCounted) {}
827
822
828
- void emitRetainValue (SILBuilder &B, SILLocation loc,
823
+ void emitCopyValue (SILBuilder &B, SILLocation loc,
829
824
SILValue value) const override {
830
825
if (!isa<FunctionRefInst>(value))
831
826
B.createStrongRetain (loc, value, Atomicity::Atomic);
832
827
}
833
828
834
- void emitReleaseValue (SILBuilder &B, SILLocation loc,
829
+ void emitDestroyValue (SILBuilder &B, SILLocation loc,
835
830
SILValue value) const override {
836
831
B.emitStrongReleaseAndFold (loc, value);
837
832
}
@@ -843,12 +838,12 @@ namespace {
843
838
LoadableUnownedTypeLowering (SILType type)
844
839
: LeafLoadableTypeLowering(type, IsReferenceCounted) {}
845
840
846
- void emitRetainValue (SILBuilder &B, SILLocation loc,
841
+ void emitCopyValue (SILBuilder &B, SILLocation loc,
847
842
SILValue value) const override {
848
843
B.createUnownedRetain (loc, value, Atomicity::Atomic);
849
844
}
850
845
851
- void emitReleaseValue (SILBuilder &B, SILLocation loc,
846
+ void emitDestroyValue (SILBuilder &B, SILLocation loc,
852
847
SILValue value) const override {
853
848
B.createUnownedRelease (loc, value, Atomicity::Atomic);
854
849
}
@@ -888,24 +883,22 @@ namespace {
888
883
B.emitDestroyAddrAndFold (loc, value);
889
884
}
890
885
891
- void emitRetainValue (SILBuilder &B, SILLocation loc,
886
+ void emitCopyValue (SILBuilder &B, SILLocation loc,
892
887
SILValue value) const override {
893
888
llvm_unreachable (" type is not loadable!" );
894
889
}
895
890
896
- void emitLoweredRetainValue (SILBuilder &B, SILLocation loc,
897
- SILValue value,
891
+ void emitLoweredCopyValue (SILBuilder &B, SILLocation loc, SILValue value,
898
892
LoweringStyle style) const override {
899
893
llvm_unreachable (" type is not loadable!" );
900
894
}
901
895
902
- void emitReleaseValue (SILBuilder &B, SILLocation loc,
896
+ void emitDestroyValue (SILBuilder &B, SILLocation loc,
903
897
SILValue value) const override {
904
898
llvm_unreachable (" type is not loadable!" );
905
899
}
906
900
907
- void emitLoweredReleaseValue (SILBuilder &B, SILLocation loc,
908
- SILValue value,
901
+ void emitLoweredDestroyValue (SILBuilder &B, SILLocation loc, SILValue value,
909
902
LoweringStyle style) const override {
910
903
llvm_unreachable (" type is not loadable!" );
911
904
}
0 commit comments