@@ -117,6 +117,9 @@ class SILArgument : public ValueBase {
117
117
// / opposed to a cast or projection.
118
118
bool isPhiArgument () const ;
119
119
120
+ // / Return true if this block argument is a terminator result.
121
+ bool isTerminatorResult () const ;
122
+
120
123
// / If this argument is a phi, return the incoming phi value for the given
121
124
// / predecessor BB. If this argument is not a phi, return an invalid SILValue.
122
125
SILValue getIncomingPhiValue (SILBasicBlock *predBlock) const ;
@@ -208,6 +211,9 @@ class SILPhiArgument : public SILArgument {
208
211
// / opposed to a cast or projection.
209
212
bool isPhiArgument () const ;
210
213
214
+ // / Return true if this block argument is a terminator result.
215
+ bool isTerminatorResult () const { return !isPhiArgument (); }
216
+
211
217
// / If this argument is a phi, return the incoming phi value for the given
212
218
// / predecessor BB. If this argument is not a phi, return an invalid SILValue.
213
219
// /
@@ -283,6 +289,10 @@ class SILPhiArgument : public SILArgument {
283
289
// / terminator has a single operand, return that terminator.
284
290
TermInst *getSingleTerminator () const ;
285
291
292
+ // / Return the terminator instruction of which this argument is a result or
293
+ // / nullptr.
294
+ TermInst *getTransformingTerminator () const ;
295
+
286
296
static bool classof (const SILInstruction *) = delete;
287
297
static bool classof (const SILUndef *) = delete;
288
298
static bool classof (SILNodePointer node) {
@@ -347,6 +357,16 @@ inline bool SILArgument::isPhiArgument() const {
347
357
llvm_unreachable (" Covered switch is not covered?!" );
348
358
}
349
359
360
+ inline bool SILArgument::isTerminatorResult () const {
361
+ switch (getKind ()) {
362
+ case SILArgumentKind::SILPhiArgument:
363
+ return cast<SILPhiArgument>(this )->isTerminatorResult ();
364
+ case SILArgumentKind::SILFunctionArgument:
365
+ return false ;
366
+ }
367
+ llvm_unreachable (" Covered switch is not covered?!" );
368
+ }
369
+
350
370
inline SILValue
351
371
SILArgument::getIncomingPhiValue (SILBasicBlock *predBlock) const {
352
372
switch (getKind ()) {
0 commit comments