Commit Graph

430 Commits

Author SHA1 Message Date
Dmitri Hrybenko
1e23c936e0 Rename FuncDecl::getBody() to FuncDecl::getFuncExpr()
ConstructorDecl::getBody() and DestructorDecl::getBody() return 'BraceStmt *'.
After changing the AST representation for functions, FuncDecl::getBody() will
return 'BraceStmt *' and FuncDecl::getFuncExpr() will be gone.


Swift SVN r8050
2013-09-09 19:57:27 +00:00
Chris Lattner
e48b3a4702 Rework how capture lists work in CaptureExpr: now we record
global variables used by functions in the capture list as well.

SILGen and other things that don't care about these (i.e., all 
current current clients) filter the list to get what they want.

This is needed for future definite init improvements, and unblocked
by Doug's patch in r8039 (thanks! :)

No functionality change.



Swift SVN r8045
2013-09-09 18:15:07 +00:00
Doug Gregor
4cfb77b52a Don't emit Objective-C thunks for protocol members.
For now, this simply ensures that we don't blow up in the mangler due
to our inability to mangle the names of protocol members.


Swift SVN r8036
2013-09-09 16:07:18 +00:00
Anna Zaks
369a948248 [SIL] Minor auto-generated SILLocation API rename/refactor.
Swift SVN r8018
2013-09-06 23:57:27 +00:00
Chris Lattner
9b53417e5f remove Initialization::defaultInitialize, which is dead now.
Swift SVN r7957
2013-09-05 20:41:57 +00:00
Chris Lattner
dea8213ef9 remove the -enable-definite-init command line option. Definite init
seems to have stuck.


Swift SVN r7956
2013-09-05 20:37:41 +00:00
John McCall
b9dea7f458 Remove the emitSemantic* methods from TypeLowering and
move the corresponding functionality into SILGen.

I've switched around 'assign' so that it's no longer a
semantic assignment --- that is, so that it expects a properly
lowered value as its operand, not an r-value of the semantic
type.  This actually simplifies quite a lot of code and removes
some ugly special-casing from MemoryPromotion.

Swift SVN r7942
2013-09-05 06:44:50 +00:00
John McCall
215ffa5381 Make SILGenFunction methods for stores as well.
Swift SVN r7941
2013-09-05 06:44:48 +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
2ea48d3d52 [SIL] Assign SIL location info for tuple initialization code.
Swift SVN r7915
2013-09-04 21:57:50 +00:00
Doug Gregor
7a0ce11980 Replace ProtocolConformanceWitness with ConcreteDeclRef.
The latter is more efficient and should eventually be more common.


Swift SVN r7840
2013-09-03 15:15:13 +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
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
Dmitri Hrybenko
1593632d7b More 'this' -> 'self' replacements
Swift SVN r7659
2013-08-28 03:08:07 +00:00
Dmitri Hrybenko
69cfa73640 More 'this' -> 'self' replacements
Swift SVN r7657
2013-08-28 02:57:21 +00:00
Anna Zaks
d0823de723 [SIL] Use AutoGenerated location when generating thunk bodies.
Swift SVN r7649
2013-08-27 23:50:43 +00:00
Anna Zaks
d71c70d73e [SIL] Refactor to make it explicit which location is used + add FIXMES
We should decide which locations should be used for auto generated thunk code to simplify debugging.

Swift SVN r7633
2013-08-27 22:16:21 +00:00
Anna Zaks
440631f86a [SIL] Add the SILLocation hierarchy.
Now we should be ready to start using these.

Swift SVN r7632
2013-08-27 22:16:18 +00:00
Ted Kremenek
8f5b8ccb02 Rename "This" to "Self" and "this" to "self".
This was not likely an error-free change.  Where you see problems
please correct them.  This went through a fairly tedious audit
before committing, but comments might have been changed incorrectly,
not changed at all, etc.

Swift SVN r7631
2013-08-27 21:58:27 +00:00
Michael Gottesman
d41b871b3a At Joe's suggestion added the prefix strong to instructions Retain,Release,RetainAutoreleased,RetainUnowned to prevent confusion in between RetainUnowned and UnownedRetain.
This is was a very mechanical patch where I basically first renamed SILNodes.def
and then just kept fixing things until everything compiled, so even though it is
large patch I feel ok(ish) with committing it.

If anyone has any concerns/etc, please email me and I will revert in 1 second.

Swift SVN r7604
2013-08-26 23:32:16 +00:00
Chris Lattner
803f5dc551 Rearrange the careful dance that is Initialization finalization.
We had a weird (and problematic for me) situation before where
tuple initializations would not recursively finalize their tuple
elements when they were finalized.  Making them do so runs afoul
of the poorly named Initialization::getSubInitializations(x,y,z)
method, which had nothing to do with the
Initialization::getSubInitializations() method.  Rename the former
to "getSubInitializationsForTuple" to make it more clear what is
going on, and make it handle the finalization of the SingleElement
initialization when it explodes it.

No functionality change, this unblocks some cases definite init was
tripping over.



Swift SVN r7600
2013-08-26 23:01:48 +00:00
Joe Groff
bb8b42260b SILGen/IRGen: Move union constructor generation to SILGen.
Generate union constructors as SIL functions using the new 'union' instruction. Change UnionTypeInfo::emitInjectionFunctionBody into UnionTypeInfo::emitInjection, which emits the union value to an explosion rather than emitting the scalar return directly, and use it to implement IRGen lowering of the 'union' instruction.

This breaks a few serialization tests because of mangler bugs handling generic unions, which I'll fix next.

Swift SVN r7559
2013-08-25 18:31:07 +00:00
John McCall
7df930b86e Remove some more uses of getTypeOfReference.
Swift SVN r7417
2013-08-21 19:27:23 +00:00
John McCall
004cc0c49a Remove some invalid or unnecessary uses of getTypeOfReference
from SIL-generation and type lowering.

Swift SVN r7416
2013-08-21 19:27:14 +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
Doug Gregor
6ff6ec9df8 Reduce the reliance of PolymorphicFunctionType on GenericParamList.
This is a baby step toward eliminating GenericParamList from
PolymorphicFunctionType, fixing up the easy callers. No functionality
change.


Swift SVN r7370
2013-08-20 21:18:11 +00:00
Doug Gregor
1ddb34fb71 Factor generic parameters and associated types into their own decl nodes.
Previously, TypeAliasDecl was used for typealiases, generic
parameters, and assocaited types, which is hideous and the source of
much confusion. Factor the latter two out into their own decl nodes,
with a common abstract base for "type parameters", and push these
nodes throughout the frontend.

No real functionality change, but this is a step toward uniquing
polymorphic types, among other things.


Swift SVN r7345
2013-08-19 23:36:58 +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