Commit Graph

22 Commits

Author SHA1 Message Date
Michael Gottesman
2eb34c35a4 [sil-inliner] Ensure that all special flags are propagated when we create a CleanupLocation, MandatoryInlinedLocation, or InlinedLocation from a SILLocation.
This corresponds to the fix I spoke of in r11595.

Swift SVN r11600
2013-12-23 06:35:38 +00:00
Michael Gottesman
90cbfb2e57 [sil-inliner] Removed invalid assert.
Given a destructor that is not implicit, one will have a decl that is not
autogenerated implying that this assert will always be hit.

I am going to submit an additional patch after this that changes
InlineLocation/MandatoryInlinedLocation/CleanupLocation that ensures that
the special flags on SILLocation are propagated appropriately (which they are
not right now).

Swift SVN r11595
2013-12-23 06:00:54 +00:00
Michael Gottesman
dffa7fe5bf [sil-inliner] Add support for Stmt, Pattern ASTNodes to Inlined/MandatoryInlined Location as per my discussion with Anna.
Swift SVN r11456
2013-12-19 00:16:21 +00:00
Anna Zaks
e5eb77ea6e [SIL] Mark these locations as cleanup.
The empty tuple used for return value when none is supplied does not really correspond to user code. (We don’t have epilog, so mark it as pert of cleanup.)
The destroy_addr instructions are doing the cleanup.

Swift SVN r9765
2013-10-29 22:27:25 +00:00
Anna Zaks
4d50044dd8 Add MandatoryInlinedLocation SIL location type.
This will allow us to differentiate from regular inlined code (as in optimization inlining). Some passes(AllocBocToStack) and debug info would be allowed to be more aggressive/preserve less debug info with mandatory inlined code.

Swift SVN r9339
2013-10-15 00:17:51 +00:00
Anna Zaks
6775516a7c [SIL] Propagate [transparent] from decl to apply inst for constructor.
Swift SVN r8225
2013-09-13 23:21:40 +00:00
Dmitri Hrybenko
796eac4b3f Make SILLocation::dump() more informative
Swift SVN r8130
2013-09-12 00:25:32 +00:00
Anna Zaks
e7e3c10fec [SIL] Add appropriate SILLocations to the inlined code.
The inlined locations should point to the call site.

Swift SVN r8108
2013-09-11 20:54:31 +00:00
Anna Zaks
1ba2554fb2 [SIL] Ensure that all loop branches have valid locations.
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
2013-09-06 17:46:15 +00:00
Anna Zaks
8fae98d5c6 [SIL] Specialize the source locations for ReturnLocation and ImplicitReturnLocation.
Swift SVN r7913
2013-09-04 21:57:44 +00:00
Anna Zaks
781ee9bdab [SIL Loc] Allow CleanupLocations that point to the beginning of the AST node.
Swift SVN r7817
2013-08-30 23:41:36 +00:00
Anna Zaks
fbcf5d458f [SIL Loc] Use a separate bit to represent auto-generated code
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
2013-08-30 23:41:33 +00:00
Anna Zaks
8f3c9002d0 [SIL] Add cleanup locations to SIL instructions.
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
2013-08-29 23:14:22 +00:00
Anna Zaks
b52166a2f3 [SILGen] Propagate location info through InitializeTupleValues
The test displays "<invalid loc>" even though the SIL location is
non-null because the corresponding AST node (Expr) does not have a location.

Swift SVN r7066
2013-08-08 23:59:08 +00:00
Anna Zaks
aaa4b2c332 [SIL Printer] Add optional source location printing.
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
2013-08-07 18:39:48 +00:00
Chris Lattner
e2611273fc extend SILLocation to be able to store locations in SIL files.
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
2013-08-07 18:36:45 +00:00
Chris Lattner
26fda44bc4 make SILLocation tolerate null locations, which is what it gets when parsing .sil files.
Swift SVN r6980
2013-08-07 16:50:45 +00:00
John McCall
eaf693aace Constify SILLocation.
Swift SVN r6965
2013-08-07 00:10:56 +00:00
John McCall
9f6e2bf9bb Permit Patterns in SILLocation as well.
Swift SVN r6798
2013-08-01 01:28:38 +00:00
Anna Zaks
f6d1ec48f0 [SIL] Refactor SILLocation not to derive from PointerUnion3 but to include it as a member
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
2013-07-16 01:50:29 +00:00
Anna Zaks
4078785192 Turn SILLocation out of typedef and into a class.
Swift SVN r6154
2013-07-11 17:12:13 +00:00
Anna Zaks
2e4170e249 Add the first SIL-based waring - "missing return"
Add a warning on a missing return statement.
(This is not yet an error since we need to handle no-return functions.)

Swift SVN r6153
2013-07-11 17:12:12 +00:00