[sil] Add a helper on ApplySite to set the ApplySite's SILValue callee in a generic way.

Just so that people do not have to touch operand numbers and potentially make a
mistake.
This commit is contained in:
Michael Gottesman
2022-07-11 12:23:18 -07:00
parent 9f792bd5dd
commit e9caee90eb

View File

@@ -297,6 +297,11 @@ public:
getArgumentOperands()[i].set(V);
}
void setCallee(SILValue V) const {
unsigned calleeIndex = getCalleeOperand()->getOperandNumber();
getInstruction()->getAllOperands()[calleeIndex].set(V);
}
/// Return the operand index of the first applied argument.
unsigned getOperandIndexOfFirstArgument() const {
FOREACH_IMPL_RETURN(getArgumentOperandNumber());