mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[sil-devirtualizer] Support devirtualization of try_apply instructions.
rdar://21909405 Swift SVN r30710
This commit is contained in:
@@ -3902,6 +3902,11 @@ public:
|
||||
FOREACH_IMPL_RETURN(getCallee());
|
||||
}
|
||||
|
||||
/// Return the type.
|
||||
SILType getType() const {
|
||||
FOREACH_IMPL_RETURN(getSubstCalleeType()->getResult().getSILType());
|
||||
}
|
||||
|
||||
/// Get the type of the callee without the applied substitutions.
|
||||
CanSILFunctionType getOrigCalleeType() const {
|
||||
return getCallee().getType().castTo<SILFunctionType>();
|
||||
@@ -3939,6 +3944,17 @@ public:
|
||||
FOREACH_IMPL_RETURN(getSubstitutions());
|
||||
}
|
||||
|
||||
ArrayRef<Substitution> getSubstitutionsWithoutSelfSubstitution() const {
|
||||
switch (Inst->getKind()) {
|
||||
case ValueKind::ApplyInst:
|
||||
return cast<ApplyInst>(Inst)->getSubstitutionsWithoutSelfSubstitution();
|
||||
case ValueKind::TryApplyInst:
|
||||
return cast<TryApplyInst>(Inst)->getSubstitutionsWithoutSelfSubstitution();
|
||||
default:
|
||||
llvm_unreachable("not implemented for this instruction!");
|
||||
}
|
||||
}
|
||||
|
||||
/// The arguments passed to this instruction.
|
||||
MutableArrayRef<Operand> getArgumentOperands() const {
|
||||
FOREACH_IMPL_RETURN(getArgumentOperands());
|
||||
|
||||
Reference in New Issue
Block a user