mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add a nothrow flag to the SIL apply_inst.
If the compiler can prove that a throwing function actually does not throw it can replace a try_apply with an "apply [nothrow]". Such an apply_inst calls a function with an error result but does not have the overhead of checking for the error case. Currently this flag is not set, yet. Swift SVN r31151
This commit is contained in:
@@ -180,10 +180,12 @@ ApplyInst::ApplyInst(SILLocation Loc, SILValue Callee,
|
||||
SILType SubstCalleeTy,
|
||||
SILType Result,
|
||||
ArrayRef<Substitution> Subs,
|
||||
ArrayRef<SILValue> Args)
|
||||
ArrayRef<SILValue> Args,
|
||||
bool isNonThrowing)
|
||||
: ApplyInstBase(ValueKind::ApplyInst, Loc, Callee, SubstCalleeTy,
|
||||
Subs, Args, Result)
|
||||
{
|
||||
setNonThrowing(isNonThrowing);
|
||||
}
|
||||
|
||||
ApplyInst *ApplyInst::create(SILLocation Loc, SILValue Callee,
|
||||
@@ -191,10 +193,11 @@ ApplyInst *ApplyInst::create(SILLocation Loc, SILValue Callee,
|
||||
SILType Result,
|
||||
ArrayRef<Substitution> Subs,
|
||||
ArrayRef<SILValue> Args,
|
||||
bool isNonThrowing,
|
||||
SILFunction &F) {
|
||||
void *Buffer = allocate(F, Subs, Args);
|
||||
return ::new(Buffer) ApplyInst(Loc, Callee, SubstCalleeTy,
|
||||
Result, Subs, Args);
|
||||
Result, Subs, Args, isNonThrowing);
|
||||
}
|
||||
|
||||
bool swift::doesApplyCalleeHaveSemantics(SILValue callee, StringRef semantics) {
|
||||
|
||||
Reference in New Issue
Block a user