[sil-devirtualizer] Support devirtualization of try_apply instructions.

rdar://21909405

Swift SVN r30710
This commit is contained in:
Roman Levenstein
2015-07-28 00:11:38 +00:00
parent 85367420bd
commit 696da80ca0
6 changed files with 374 additions and 107 deletions

View File

@@ -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());