Commit Graph

317 Commits

Author SHA1 Message Date
Anna Zaks
16774496fd [SILGen] Emit warnings when SILGen fails to emit unreachable code.
Previously, we just did not emit SIL for unreachable code from these examples.

Swift SVN r9949
2013-11-05 01:17:14 +00:00
Joe Groff
0bda31c02b Switch over to Generator as the 'for' loop protocol.
Rewrite ForEachStmt SILGen to use the Optional intrinsics with the Generator.next method to iterate through sequences, and kill off the Enumerator path in Sema. Cut over 'EnumeratorType.Element' requirements to instead require 'GeneratorType.Element' in the stdlib.

There are a couple of bugs remaining that need follow-up work. There appears to be a bug in nested enum layout (e.g. T??) that's causing test/Interpreter/enum to break; I'll investigate and fix. There's also a lingering type-checker bug with inferred associated types that causes them to fail requirement checks <rdar://problem/15172101>, which I think Doug needs to look into.

Swift SVN r9017
2013-10-08 01:46:51 +00:00
John McCall
916b566fa6 Push and invalidate uninitialized-local cleanups.
No effect currently; just resolves a FIXME.

Swift SVN r8830
2013-10-02 01:27:39 +00:00
John McCall
6f32a8464f Add a convenient method to create a new basic block.
Swift SVN r8326
2013-09-17 07:22:23 +00:00
Anna Zaks
fba35a3421 [SIL] Move condbranch location from if/while/.. stmt to the condition
We should be able to get the parent when necessary after we add the parent map.

Swift SVN r8057
2013-09-09 22:34:07 +00:00
Anna Zaks
c06bd83358 [SIL] Remove the last few uses of SILLocation constructor.
This also removes the constructor itself, which forces future users of
SILLocation to construct a valid location.

Swift SVN r8056
2013-09-09 22:34:05 +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
John McCall
a26584584e Move some basic l-values and address operations into SILGenLValue.cpp.
Swift SVN r7940
2013-09-05 06:44:46 +00:00
John McCall
6aae6402ba Refactor in support of semantic vs. storage type differences.
Swift SVN r7939
2013-09-05 06:44:44 +00:00
Anna Zaks
115a15830b [SIL] Replace empty locations with valid locations in tuple exploding/encoding and pattern gen code.
Tuple exploding happens during RValue construction, so changed the constructor and addElement() method to take the location parameter. The imploding happens on RValue::forwardAsSingleValue and RValue::getAsSingleValue(). Make sure the right SIL locations are passed to all of these

Also, added some missing locations in pattern matching code.

Swift SVN r7916
2013-09-04 21:57:52 +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
Dmitri Hrybenko
d98408425e Remove unused OwningPtr.h includes
Swift is C++11 and uses std::unique_ptr.


Swift SVN r7731
2013-08-29 20:09:49 +00:00
Anna Zaks
b67f3c3552 [SIL] Use the ReturnLocation/ImplicitReturnLocation instead of generic SILLocations.
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
2013-08-27 22:16:24 +00:00
Adrian Prantl
a1c6b653ad Move DebugScopeStack from SILBuilder to SILGenFunction, using the swift new
InsertedInstrs facility.
No functionality change intended.

Swift SVN r7520
2013-08-23 20:11:44 +00:00
John McCall
581cac8d83 Don't carry a type on an Initialization; just pass it down
where needed.

Removes a few more non-Sema uses of getTypeOfReference.

Swift SVN r7412
2013-08-21 18:44:59 +00:00
Dmitri Hrybenko
ce54da3123 Use NullablePtr in ForStmt
ForStmt::Cond is already a NullablePtr<>.  This patch changes
ForStmt::Initializer and ForStmt::Increment to be NullablePtr.  Otherwise it
looks like Cond can be null, while Initializer and Increment can not.


Swift SVN r7265
2013-08-15 17:51:32 +00:00
Stephen Lin
8d90466523 Reorganize SIL source tree: move lib/SIL/SILGen -> lib/SILGen, move lib/SIL/Passes -> lib/SILPasses, add lib/SILPasses/Utils
Swift SVN r7246
2013-08-14 23:47:29 +00:00