@@ -40,8 +40,12 @@ class SILArgument : public ValueBase {
4040
4141 SILBasicBlock *ParentBB;
4242 const ValueDecl *Decl;
43+ ValueOwnershipKind OwnershipKind;
4344
4445public:
46+ ValueOwnershipKind getOwnershipKind () const { return OwnershipKind; }
47+ void setOwnershipKind (ValueOwnershipKind NewKind) { OwnershipKind = NewKind; }
48+
4549 SILBasicBlock *getParent () { return ParentBB; }
4650 const SILBasicBlock *getParent () const { return ParentBB; }
4751
@@ -103,28 +107,26 @@ class SILArgument : public ValueBase {
103107
104108protected:
105109 SILArgument (ValueKind SubClassKind, SILBasicBlock *ParentBB, SILType Ty,
110+ ValueOwnershipKind OwnershipKind,
106111 const ValueDecl *D = nullptr );
107112 SILArgument (ValueKind SubClassKind, SILBasicBlock *ParentBB,
108113 SILBasicBlock::arg_iterator Pos, SILType Ty,
114+ ValueOwnershipKind OwnershipKind,
109115 const ValueDecl *D = nullptr );
110116
111117 // A special constructor, only intended for use in
112- // SILBasicBlock::replaceBBArg .
118+ // SILBasicBlock::replacePHIArg .
113119 explicit SILArgument (ValueKind SubClassKind, SILType Ty,
120+ ValueOwnershipKind OwnershipKind,
114121 const ValueDecl *D = nullptr )
115- : ValueBase(SubClassKind, Ty), ParentBB(nullptr ), Decl(D) {}
122+ : ValueBase(SubClassKind, Ty), ParentBB(nullptr ), Decl(D), OwnershipKind(OwnershipKind) {}
116123 void setParent (SILBasicBlock *P) { ParentBB = P; }
117124
118125 friend SILBasicBlock;
119126};
120127
121128class SILPHIArgument : public SILArgument {
122- ValueOwnershipKind Kind;
123-
124129public:
125- // / Return the static ownership kind associated with this SILPHIArgument.
126- ValueOwnershipKind getOwnershipKind () const { return Kind; }
127-
128130 // / Returns the incoming SILValue from the \p BBIndex predecessor of this
129131 // / argument's parent BB. If the routine fails, it returns an empty SILValue.
130132 // / Note that for some predecessor terminators the incoming value is not
@@ -167,20 +169,19 @@ class SILPHIArgument : public SILArgument {
167169
168170private:
169171 friend SILBasicBlock;
170- SILPHIArgument (SILBasicBlock *ParentBB, SILType Ty, ValueOwnershipKind Kind ,
172+ SILPHIArgument (SILBasicBlock *ParentBB, SILType Ty, ValueOwnershipKind OwnershipKind ,
171173 const ValueDecl *D = nullptr )
172- : SILArgument(ValueKind::SILPHIArgument, ParentBB, Ty, D), Kind(Kind ) {}
174+ : SILArgument(ValueKind::SILPHIArgument, ParentBB, Ty, OwnershipKind, D ) {}
173175 SILPHIArgument (SILBasicBlock *ParentBB, SILBasicBlock::arg_iterator Pos,
174- SILType Ty, ValueOwnershipKind Kind ,
176+ SILType Ty, ValueOwnershipKind OwnershipKind ,
175177 const ValueDecl *D = nullptr )
176- : SILArgument(ValueKind::SILPHIArgument, ParentBB, Pos, Ty, D),
177- Kind (Kind) {}
178+ : SILArgument(ValueKind::SILPHIArgument, ParentBB, Pos, Ty, OwnershipKind, D) {}
178179
179180 // A special constructor, only intended for use in
180- // SILBasicBlock::replaceBBArg .
181- explicit SILPHIArgument (SILType Ty, ValueOwnershipKind Kind ,
181+ // SILBasicBlock::replacePHIArg .
182+ explicit SILPHIArgument (SILType Ty, ValueOwnershipKind OwnershipKind ,
182183 const ValueDecl *D = nullptr )
183- : SILArgument(ValueKind::SILPHIArgument, Ty, D), Kind(Kind ) {}
184+ : SILArgument(ValueKind::SILPHIArgument, Ty, OwnershipKind, D ) {}
184185};
185186
186187class SILFunctionArgument : public SILArgument {
@@ -226,16 +227,12 @@ class SILFunctionArgument : public SILArgument {
226227private:
227228 friend SILBasicBlock;
228229
229- SILFunctionArgument (SILBasicBlock *ParentBB, SILType Ty,
230+ SILFunctionArgument (SILBasicBlock *ParentBB, SILType Ty, ValueOwnershipKind OwnershipKind,
230231 const ValueDecl *D = nullptr )
231- : SILArgument(ValueKind::SILFunctionArgument, ParentBB, Ty, D) {}
232+ : SILArgument(ValueKind::SILFunctionArgument, ParentBB, Ty, OwnershipKind, D) {}
232233 SILFunctionArgument (SILBasicBlock *ParentBB, SILBasicBlock::arg_iterator Pos,
233- SILType Ty, const ValueDecl *D = nullptr )
234- : SILArgument(ValueKind::SILFunctionArgument, ParentBB, Pos, Ty, D) {}
235-
236- // A special constructor, only intended for use in SILBasicBlock::replaceBBArg.
237- explicit SILFunctionArgument (SILType Ty, const ValueDecl *D = nullptr )
238- : SILArgument(ValueKind::SILFunctionArgument, Ty, D) {}
234+ SILType Ty, ValueOwnershipKind OwnershipKind, const ValueDecl *D = nullptr )
235+ : SILArgument(ValueKind::SILFunctionArgument, ParentBB, Pos, Ty, OwnershipKind, D) {}
239236};
240237
241238// ===----------------------------------------------------------------------===//
0 commit comments