Skip to content

Commit 7bbd9a9

Browse files
committed
SIL: add var Instruction.typeDependentOperands
And simplify the implementation of `var Instruction.definedOperands`
1 parent 810064b commit 7bbd9a9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

SwiftCompilerSources/Sources/SIL/Instruction.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,15 @@ public class Instruction : CustomStringConvertible, Hashable {
5252
// All operands defined by the operation.
5353
// Returns the prefix of `operands` that does not include trailing type dependent operands.
5454
final public var definedOperands: OperandArray {
55-
let operands = bridged.getOperands()
55+
let allOperands = operands
56+
let typeOperands = bridged.getTypeDependentOperands()
57+
return allOperands[0 ..< (allOperands.count - typeOperands.count)]
58+
}
59+
60+
final public var typeDependentOperands: OperandArray {
61+
let allOperands = operands
5662
let typeOperands = bridged.getTypeDependentOperands()
57-
return OperandArray(base: operands.base,
58-
count: operands.count - typeOperands.count)
63+
return allOperands[(allOperands.count - typeOperands.count) ..< allOperands.count]
5964
}
6065

6166
fileprivate var resultCount: Int { 0 }

0 commit comments

Comments
 (0)