Skip to content

Commit d1fcc52

Browse files
committed
[SIL] ApplySite: Get args by callee index.
Added convenience functions to ApplySite to access argument and argument operand by index into the callee's argument list (rather than by index into the arguments used by the apply instruction).
1 parent 113bfc7 commit d1fcc52

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

include/swift/SIL/ApplySite.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,20 @@ class ApplySite {
295295
/// Return the apply operand for the given applied argument index.
296296
Operand &getArgumentRef(unsigned i) const { return getArgumentOperands()[i]; }
297297

298+
// The apply operand at the given index into the callee's function's
299+
// arguments.
300+
Operand &getArgumentRefAtCalleeArgIndex(unsigned i) const {
301+
return getArgumentRef(i - getCalleeArgIndexOfFirstAppliedArg());
302+
}
303+
298304
/// Return the ith applied argument.
299305
SILValue getArgument(unsigned i) const { return getArguments()[i]; }
300306

307+
// The argument at the given index into the callee's function's arguments.
308+
SILValue getArgumentAtCalleeArgIndex(unsigned i) const {
309+
return getArgument(i - getCalleeArgIndexOfFirstAppliedArg());
310+
}
311+
301312
/// Set the ith applied argument.
302313
void setArgument(unsigned i, SILValue V) const {
303314
getArgumentOperands()[i].set(V);

0 commit comments

Comments
 (0)