Skip to content

Commit 910d918

Browse files
authored
Merge pull request #38258 from eeckstein/applysite-addition
2 parents c67a62d + 030e3ef commit 910d918

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

libswift/Sources/SIL/ApplySite.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ extension ApplySite {
3131
}
3232

3333
public protocol FullApplySite : ApplySite {
34+
var singleDirectResult: Value? { get }
3435
}

libswift/Sources/SIL/Instruction.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ final public class PartialApplyInst : SingleValueInstruction, ApplySite {
389389

390390
final public class ApplyInst : SingleValueInstruction, FullApplySite {
391391
public var numArguments: Int { ApplyInst_numArguments(bridged) }
392+
393+
public var singleDirectResult: Value? { self }
392394
}
393395

394396
//===----------------------------------------------------------------------===//
@@ -430,6 +432,8 @@ final public class DestructureTupleInst : MultipleValueInstruction {
430432

431433
final public class BeginApplyInst : MultipleValueInstruction, FullApplySite {
432434
public var numArguments: Int { BeginApplyInst_numArguments(bridged) }
435+
436+
public var singleDirectResult: Value? { nil }
433437
}
434438

435439
//===----------------------------------------------------------------------===//
@@ -459,6 +463,11 @@ final public class UnwindInst : TermInst {
459463

460464
final public class TryApplyInst : TermInst, FullApplySite {
461465
public var numArguments: Int { TryApplyInst_numArguments(bridged) }
466+
467+
public var normalBlock: BasicBlock { successors[0] }
468+
public var errorBlock: BasicBlock { successors[1] }
469+
470+
public var singleDirectResult: Value? { normalBlock.arguments[0] }
462471
}
463472

464473
final public class BranchInst : TermInst {

0 commit comments

Comments
 (0)