Commit Graph

295 Commits

Author SHA1 Message Date
John McCall
65fc2b74f8 Basics of dynamic struct layout.
Swift SVN r4902
2013-04-25 01:39:58 +00:00
Chris Lattner
9ae0cf3bee inline Initialization::emitLocalAllocation into each of its callers and
eliminate the Initialization class and GenInit.h.  GenInit.cpp will stay
around, as it has some other random stuff in it.


Swift SVN r4845
2013-04-21 06:13:59 +00:00
Chris Lattner
0be7bbdddf remove ManagedValue.
Swift SVN r4843
2013-04-21 05:56:02 +00:00
Chris Lattner
abee79b26e remove some Expr stuff.
Swift SVN r4810
2013-04-18 22:32:37 +00:00
John McCall
38b34b7307 Pass #1 at localizing assumptions about fixed layout and
handling non-fixed layouts.

This uncovered a bug where we weren't rounding up the header
size to the element alignment when allocating an array of archetypes.

Writing up a detailed test case for *that* revealed that we were
never initializing the length field of heap arrays.  Fixing that
caused a bunch of tests to crash trying to release stuff.  So...
I've left this in a workaround state right now because I have to
catch a plane.

Swift SVN r4804
2013-04-18 07:58:21 +00:00
Chris Lattner
47e508c24d remove LValue, PathComponent, and LValue.h as a whole.
Swift SVN r4792
2013-04-18 04:50:03 +00:00
Joe Groff
b9bb84c58e SILGen: Emit implicit constructors.
Teach SILGen how to emit the implicit elementwise constructor for structs and the implicit default constructor for classes, and eliminate the now dead IRGen code for them. Add a StructInst SIL instruction to represent constructing a loadable struct value from elements, analogous to TupleInst for tuples.

Swift SVN r4778
2013-04-17 20:51:26 +00:00
Chris Lattner
12a9c88ef1 zap GenLValue.h and supporting logic.
Swift SVN r4771
2013-04-17 05:38:57 +00:00
Chris Lattner
ade66c8b10 Remove the emitIgnored, emitLValue, and tryEmitAsAddress mechanics and
supporting logic.


Swift SVN r4770
2013-04-17 05:33:23 +00:00
Chris Lattner
ea4eca3a95 now that SILGen is on all the time, start removing dead code.
Swift SVN r4762
2013-04-17 03:49:38 +00:00
Joe Groff
d0ed3bfac8 IRGen: We can get BoundGenericStruct fields too.
Not just Struct fields.

Swift SVN r4695
2013-04-11 23:29:41 +00:00
Joe Groff
aeeda4ee12 Parser: Parse operator decls.
At the top level, if 'operator' is followed by 'infix', 'prefix', or 'postfix', consider it a contextual keyword, and parse an operator decl following it that looks like:

  operator {infix|postfix|prefix} <+> {
    attributes…
  }

Prefix and postfix operator decls currently admit no attributes. Infix operators have 'associativity {left|right|none}' and 'precedence <int>' attributes.

This patch implements parsing for operator declarations but does not yet attach the declared attributes to func decls for the operators.

Swift SVN r4596
2013-04-03 23:30:50 +00:00
Joe Groff
b3ae290685 IRGen: Codegen SIL 'extract' from rvalue struct.
Swift SVN r4481
2013-03-25 16:08:08 +00:00
Joe Groff
5852448152 IRGen: Generate SIL ctor and property decls.
Remove the filter that only irgenned SIL functions for FuncDecls so that we emit functions for all SIL decls, and disable the old paths for properties, constructors, and destructors when a SIL module is present. Unfortunately this breaks class constructors because SIL and IRGen don't agree on how initializing constructors should work. I need to sync with John to figure out how to fix that.

Swift SVN r3827
2013-01-22 02:45:27 +00:00
Joe Groff
19d65fede5 IRGen: Visit all SIL Functions in a SILModule.
Make the SIL visitor path a bit less hacky by more cleanly separating the AST walk to find types to codegen from the SIL module walk to find functions to codegen. This way, local functions and other such entry points from SIL actually get generated, and the closures test works.

Swift SVN r3820
2013-01-21 20:17:05 +00:00
John McCall
3713b6a549 Add a framework for distinguishing between deallocating
and non-deallocating destructors and allocating/non-allocating
constructors.

Non-deallocating destructors might not play well with ObjC
classes;  we might have to limit them to pure-swift hierarchies.

No functionality change except that I decided to not force
destructors to have internal linkage unconditionally.

Swift SVN r3814
2013-01-20 19:40:12 +00:00
Joe Groff
7e57041393 IRGen: SIL struct manipulation.
Implement ElementRefInst so that struct accessors work. Also extend SILConstant lowering to support constant_refs to constructors, destructors, and property accessors so that constructor and property accessor references work. (Constructors don't yet get visited by IRGenSIL, though.)

Swift SVN r3776
2013-01-16 19:04:08 +00:00
Chris Lattner
47dbc4051c update for mainline LLVM header file moves.
Swift SVN r3634
2013-01-02 14:38:42 +00:00
Joe Groff
83e1e917d1 Update some inaccurate comments in IRGen
Swift SVN r3139
2012-11-07 18:12:51 +00:00
John McCall
ee012c0903 Make IR-gen use canonical types as the basic type currency.
This is kindof a pain in a few places where the type system
doesn't propagate canonicality.  Also, member initializations
are always direct-initializations and so are allowed to use
explicit constructors, which is a hole in our canonicality
tracking.  But overall I like the idea of always working
with canonical types.

Swift SVN r2893
2012-09-21 07:53:08 +00:00
John McCall
32cc48dc84 More restructuring and start emitting struct metadata.
Swift SVN r2892
2012-09-21 07:53:02 +00:00
John McCall
17027b8d8e Basic support for members of generic types.
Swift SVN r2619
2012-08-13 09:03:40 +00:00
Eli Friedman
0bfcfbfb8a Change the type of ConstructorDecls to be of the form metatype<T> -> () -> (). Change a bunch of stuff to compensate. Get rid of ConstructorRefExpr, which is no longer used.
Swift SVN r2526
2012-08-03 03:58:44 +00:00
Eli Friedman
3d0d23b3ce Stop use OneOfElementDecls to represent constructors in structs.
Swift SVN r2518
2012-08-03 00:53:36 +00:00
John McCall
f7aca3f7fb Progress towards generic types.
Swift SVN r2454
2012-07-25 22:42:07 +00:00
Eli Friedman
6b4a248f04 Parsing and AST support for destructors on classes.
Swift SVN r2348
2012-07-12 01:26:02 +00:00
Eli Friedman
2268f7155d Introduce UnresolvedNominalType to represent a generic type without an argument list, and add an argument list to NominalType to represent a generic type including an argument list.
Swift SVN r2299
2012-07-03 22:15:02 +00:00
John McCall
85bdae402e Restructure code to permit protocols to be converted independently
of a ProtocolType.

Swift SVN r2242
2012-06-25 20:45:00 +00:00
John McCall
770ce0fde7 Refactor to make it easier to keep common information in
the type converter.

Swift SVN r2241
2012-06-25 20:44:59 +00:00
Eli Friedman
f1ffa870a3 A few adjustments to AST/Sema for ConstructorDecls, and starting IRGen.
Swift SVN r2160
2012-06-06 00:53:44 +00:00
Eli Friedman
75907029f1 Add parsing and semantic analysis for a basic ConstructorDecl. Still missing: no IRGen, and semantic analysis to actually call them.
Swift SVN r2159
2012-06-05 23:51:19 +00:00
Eli Friedman
8eeeb361ad IRGen support for member functions on local types.
Swift SVN r2085
2012-05-31 00:16:46 +00:00
Eli Friedman
6abcbcde33 Allow using LinkEntity for members of/witnesses for local types. As a simple test to start using them, get rid of getAddrOfLocalInjectionFunction.
Swift SVN r2084
2012-05-30 23:53:58 +00:00
Eli Friedman
10f94cabc3 Fix missing "continue" in StructDecl IRGen.
Swift SVN r2067
2012-05-30 01:26:53 +00:00
Eli Friedman
e63eb3003a Some minor cleanups to decl IRGen.
Swift SVN r2065
2012-05-30 00:33:18 +00:00
Eli Friedman
9895a11be8 Get rid of some unnecessary handling for ExtensionDecls.
Swift SVN r2063
2012-05-30 00:27:32 +00:00
Eli Friedman
b788bad8e6 A couple missing pieces for classes. Also, a few fixes for local types.
Swift SVN r1873
2012-05-16 19:21:07 +00:00
Eli Friedman
79c3276b07 AST representation for ClassDecls.
Swift SVN r1858
2012-05-15 21:53:38 +00:00
Eli Friedman
6f045aad2f Throw the switch to use "var" syntax to declare members of structs. This also means we no longer build an implicit extension for every struct decl. Everything seems to be working, but please yell if this breaks anything.
Swift SVN r1851
2012-05-15 03:27:13 +00:00
John McCall
8617d1733d Change the IR translation of struct types to just require a single
level of IR struct type.  At first we were emitting two layers
because structs were secretly tuples, and then more recently
we were emitting two layers to avoid having to adjust a bunch
of tests.  Just bite the bullet now;  it makes the IR a lot
cleaner, and it's never going to be easier.

Swift SVN r1824
2012-05-12 07:19:48 +00:00
Eli Friedman
120f6deb6b Add GenStruct.h, which I meant to commit with r1806.
Swift SVN r1815
2012-05-11 21:45:22 +00:00
Doug Gregor
9e55349172 r1805 and r1806 collided and left Swift in a broken state; fix in the
most obvious way.


Swift SVN r1809
2012-05-11 14:32:34 +00:00
Eli Friedman
01a18f6c7a Use VarDecls to represent struct members, and MemberRefExprs to represent member access in structs. Eliminate the horrible hack which was LookThroughOneOfExpr.
Swift SVN r1808
2012-05-11 03:08:15 +00:00
Chris Lattner
a5030c00cb minor pedantic tidying up.
Swift SVN r1783
2012-05-09 00:53:46 +00:00
Eli Friedman
77fa49ec2b Introduce StructDecl and StructType; use them for structs instead of OneOfDecl/OneOfType. To keep this patch small, I'm leaving in LookThroughOneOf etc. for the moment, but that's next on the agenda.
Swift SVN r1780
2012-05-09 00:27:44 +00:00