@@ -2822,6 +2822,21 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
2822
2822
" 'MoveOnly' types can only be copied in Raw SIL?!" );
2823
2823
}
2824
2824
2825
+ void checkExplicitCopyAddrInst (ExplicitCopyAddrInst *ecai) {
2826
+ require (F.hasOwnership (), " Only valid in OSSA." );
2827
+ require (ecai->getSrc ()->getType ().isAddress (),
2828
+ " Src value should be lvalue" );
2829
+ require (ecai->getDest ()->getType ().isAddress (),
2830
+ " Dest address should be lvalue" );
2831
+ requireSameType (ecai->getDest ()->getType (), ecai->getSrc ()->getType (),
2832
+ " Store operand type and dest type mismatch" );
2833
+ require (F.isTypeABIAccessible (ecai->getDest ()->getType ()),
2834
+ " cannot directly copy type with inaccessible ABI" );
2835
+ // eventually all types will be allowed with a fully-general copy operator
2836
+ require (ecai->getSrc ()->getType ().isMoveOnly (),
2837
+ " can only explicit-copy a move-only type" );
2838
+ }
2839
+
2825
2840
void checkMarkUnresolvedMoveAddrInst (MarkUnresolvedMoveAddrInst *SI) {
2826
2841
require (F.hasOwnership (), " Only valid in OSSA." );
2827
2842
require (F.getModule ().getStage () == SILStage::Raw, " Only valid in Raw SIL" );
@@ -2861,6 +2876,19 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
2861
2876
" 'MoveOnly' types can only be copied in Raw SIL?!" );
2862
2877
}
2863
2878
2879
+ void checkExplicitCopyValueInst (ExplicitCopyValueInst *I) {
2880
+ require (I->getOperand ()->getType ().isObject (),
2881
+ " Source value should be an object value" );
2882
+ require (!I->getOperand ()->getType ().isTrivial (*I->getFunction ()),
2883
+ " Source value should be non-trivial" );
2884
+ require (!fnConv.useLoweredAddresses () || F.hasOwnership (),
2885
+ " explicit_copy_value is only valid in functions with qualified "
2886
+ " ownership" );
2887
+ // eventually all types will be allowed with a fully-general copy operator
2888
+ require (I->getOperand ()->getType ().isMoveOnly (),
2889
+ " can only explicit-copy a move-only type" );
2890
+ }
2891
+
2864
2892
void checkDestroyValueInst (DestroyValueInst *I) {
2865
2893
require (I->getOperand ()->getType ().isObject (),
2866
2894
" Source value should be an object value" );
0 commit comments