Also, change the location of "looping back to head" branch to point to the closing brace of the body, which is a more natural source location than the beginning of the enclosing loop statement.
Swift SVN r7989
Auto generated location should not be a separate location kind since
we might have different kinds of auto generated locations (ex: cleanup,
return). Even though the kind info might not be necessary for diagnostics or
debug info, it allows us to better use type system, for example, only pass
CleanupLocation where expected.
Swift SVN r7816
I've decided to keep only the location of the scope AST node that corresponds to the cleanup. (Currently, there is no user that needs the originator expression, which caused the cleanup. So keeping things simple.)
Added the cleanup location to the Scope and JumpDest classes, which gets assigned on construction of those. The Scope's and JumpDest locations are used when we emit the cleanup instructions.
We now give better location info for 2 existing tests for definitive initialization.
(+ Rather sparse testing of all this.)
Swift SVN r7764
We mark the branch instructions leading into single epilog code with ReturnLocation/ImplicitReturnLocation. If SIL Gen simplifies the code and merges the code representing the return into the epilog block, the terminator of the epilog block (the ReturnInst) will have the return location info on it. Otherwise, the ReturnInst has the RegularLocation, which represents the enclosing FunctionExpr or Constructor/Destructor Decls.
(I've discussed dropping the optimization from SILGen, and keeping the epilog code canonical, with Adrian; but he said that there might not be any wins in doing so, so keeping it for now.)
Added AutoGeneratedLocation to represent segments of code generated by SILGen. This will be used for thunks and other auto-generated segments.
Swift SVN r7634
Added a -v(verbose) option to swift that will trigger verbose printing in SIL
Printer. SIL Printer will print the location info only in the verbose mode.
Here is the example of the format - only the line and colon are displayed for
brevity:
%24 = apply %13(%22) : $[cc(method), thin] ((), [byref] Bool) -> Builtin.Int1 // user: %26 line:46:10
(This will be used to test the validity of SILLocation info.)
Swift SVN r6991
This doubles SILLocation to being two words, since SourceLocations
can't be dumped into a PointerUnion, but it is due for a redesign someday
anyway, so I'm not going to worry about it.
Swift SVN r6989
As per Chris's suggestion (review of r6152), further refactored SILLocation not to derive from PointerUnion3 but to include it as a member.
In addition, added some template magic to make sure we don't have to chain dyn_casts, which I suspect will be/is happening a lot with SILLocation:
Ex:
- if (auto E = Func.dyn_cast<Expr*>()) {
- if (const FuncExpr *FE = dyn_cast<FuncExpr>(E))
- return SILLocation(FE->getBody())
+ if (const FuncExpr *FE = Func.getAs<FuncExpr>())
+ return SILLocation(FE->getBody());
Swift SVN r6283
Introduce an 'RValue' object in SILGen that behaves like a simplified version of IRGen's 'Explosion' object, holding a destructured tuple in a naturally destructured state. This cleans up a bunch of ad-hoc scattered code that destructured tuples in various places. Update SILGenFunction so that the expression visitors all pass around RValues, and update CallEmission to handle argument clauses as RValues instead of a pre-destructured string of arguments. Implement "emit into" optimization of TupleExpr and ScalarToTupleExpr, now that that's easy to do.
Swift SVN r4667
Needed to represent deinitializing a partially-initialized existential in which the value witness table has been populated by alloc_existential but the value has not been initialized yet.
Swift SVN r3565