Commit Graph

365 Commits

Author SHA1 Message Date
Eli Friedman
2e8733054e Hack fast implementations of '&&' and '||' into IRGen.
Swift SVN r1699
2012-05-01 02:24:02 +00:00
Eli Friedman
0241d0ec20 Implement IRGen for local function decls. Known limitations at the moment: currying is unimplemented, and capturing the decl is unimplemented.
Swift SVN r1647
2012-04-26 01:16:38 +00:00
Eli Friedman
ae08edf5bb Do a bit of naming cleanup in IRGen. Make sure closure IRgen doesn't get confused when we capture something other than a variable.
Swift SVN r1644
2012-04-25 23:47:57 +00:00
Doug Gregor
6d5f67c790 Implement IR generation for the 'foreach' loop and convert our fractal
examples over to using the 'foreach' loop. Addresses
<rdar://problem/11259997>.


Swift SVN r1606
2012-04-24 21:37:55 +00:00
Doug Gregor
e1b8daa717 Rework 'foreach' AST to reflect how IRgen actually wants it to look,
rather than how I felt like generating it.


Swift SVN r1599
2012-04-24 20:42:17 +00:00
John McCall
85fecab3b1 Reorganize the emission of a call site so that it's abstracted over
exactly how the arguments are emitted.  Introduce a new code path
which emits arguments from existing Explosions (possibly of the wrong
resilience level).  Use that code path to implement getter/setter
code for MemberRefExpr l-values.  This is just a checkpoint for the
latter two parts, but the ApplyExpr path is working correctly in the
new framework, which is worth a commit.

Swift SVN r1589
2012-04-24 08:16:51 +00:00
Eli Friedman
be602fcd05 Get rid of the implicit BraceStmt for the TranslationUnit; instead, have the TranslationUnit directly store a list of decls.
Swift SVN r1521
2012-04-20 00:17:13 +00:00
Chris Lattner
cbc1eac438 irgen parser and sema support for for statements.
Swift SVN r1505
2012-04-19 21:43:46 +00:00
Eli Friedman
dc213bca76 Implement basic REPL under swift -repl. Known demo-blockers: need error recovery, need better brace/paren handling, need to implement the "print" part of REPL.
Swift SVN r1452
2012-04-18 00:52:11 +00:00
John McCall
5ad3782b01 Rework the IR-generation of initialization and teach the
compiler to enter properly-scoped cleanups to destroy local
variables.

Swift SVN r1385
2012-04-11 03:00:08 +00:00
John McCall
0cd849b19c Complete the pattern-matching IR emission logic,
at least for exhaustive patterns.

Swift SVN r1359
2012-04-10 08:28:31 +00:00
John McCall
f3e27d90ff Change IR-generation so that it emits metadata objects for the
heap allocations it makes, and switch swift_alloc over to pass
that pointer in as well as the alignment.  Also, compute
whether a type is POD during its generation and cache that in
the object, and introduce a method on TypeInfo to destroy an
object in memory.

Swift SVN r1356
2012-04-10 06:28:22 +00:00
John McCall
ca9f85d694 Add code for associating cleanups with intermediate
evaluation results and then claiming or forwarding the
ownership of such results.

Swift SVN r1337
2012-04-06 07:07:28 +00:00
John McCall
44677bc117 Fixes and embellishments, and actually make IR-gen properly
emit release cleanups.  And they work!

Swift SVN r1334
2012-04-05 20:36:20 +00:00
John McCall
82ca0e7720 Basic infrastructure for cleanup emission and branches. Totally untested!
Swift SVN r1332
2012-04-05 20:36:19 +00:00
Eli Friedman
94244131f7 Remove ElementRefDecl and DeclVarName. Add the replacement, PatternBindingDecl. Use proper pattern parsing for variable declarations. Uniformly use PatternBindingDecl for variable initialization. Adapt type-checking and IRGen for this new style of variable declaration. <rdar://problem/11124980>.
Swift SVN r1312
2012-04-02 23:49:28 +00:00
Eli Friedman
99b75ce728 Further progress on captures in closures.
Swift SVN r1279
2012-03-28 01:32:46 +00:00
John McCall
7f925de228 Trim stale forward-declarations.
Swift SVN r1268
2012-03-26 06:08:22 +00:00
John McCall
173d750a02 Switch IR-generation to use ASTVisitor, or more precisely, to
use irgen::ASTVisitor, which is a subclass of the AST version
that always looks through some expressions and asserts that
others (the unchecked/error ones) can't happen.  The main
obstacle to that is access control, because it's quite nice to
have the visitor be a non-local class for nesting purposes,
but that makes it impossible to use private methods anymore.
It's nice to give all the type-specific emitters private
interfaces anyway, though;  that ends up being most of the
patch.

I futzed with GenClosure.cpp while I was in there, but
separating it would have been obnoxious.

Swift SVN r1267
2012-03-26 06:08:19 +00:00
John McCall
df7ebcd9e8 Introduce the concept of an 'owned address', i.e. an address with
an owner attached.  Use this to implement [byref(heap)].  Force
locals to the heap if they've been referenced in a way that requires
this.

Swift SVN r1265
2012-03-26 03:26:21 +00:00
Eli Friedman
ea17adc3ec Completely switch over IRGen for closures to use the standard prologue/epilogue emission.
Swift SVN r1250
2012-03-22 01:04:05 +00:00
John McCall
5a4dfb6624 Beginnings of support for heap-allocated locals.
Swift SVN r1246
2012-03-20 19:42:03 +00:00
John McCall
2fd608ae4d Add basic parsing and type-system support for the byref(heap)
qualifier, making sure that variables end up so-qualified by
default.  Add a RequalifyExpr to capture the act of adding
qualifiers (to form a supertype) to an l-value.

Swift SVN r1236
2012-03-19 06:55:23 +00:00
John McCall
52598e0e91 Kill more unnecessary 'Exploded's from method names, and do
a minor reorganization with CallPlan.

Swift SVN r1223
2012-03-17 00:44:58 +00:00
John McCall
e020724c3d Distinguish between assignment and initialization, and fix
some problems with the data pointer of function types.

Swift SVN r1220
2012-03-16 19:02:25 +00:00
John McCall
d76aaea2b6 Remove the outdated RValue concept; no functionality change.
Swift SVN r1216
2012-03-16 09:26:39 +00:00
John McCall
8831d35de1 The data pointer is also reference-counted.
Swift SVN r1215
2012-03-16 09:26:36 +00:00
John McCall
1f118dbda6 Basic support for Builtin.ObjectPointer as a completely
opaque type.  Also some rudimentary support for retain/release.

Swift SVN r1214
2012-03-16 09:26:32 +00:00
Eli Friedman
2c4cc01fee Make sure we consistently assign LLVM IR names to both function parameters and allocas created for those parameters. <rdar://problem/10934320>.
Swift SVN r1211
2012-03-15 00:04:07 +00:00
Eli Friedman
d466059220 Add support for IRGen for $0 etc.
Swift SVN r1210
2012-03-14 23:00:07 +00:00
Eli Friedman
a6a27d8cf3 Very basic support for closures in IRGen. Support for closures with arguments is next.
Swift SVN r1209
2012-03-14 00:10:37 +00:00
John McCall
803cff8113 Correctly emit references to oneof elements that carry no data.
These translate to implicit calls to the injection function.

Swift SVN r1116
2012-02-16 03:01:08 +00:00
John McCall
cd4c7f7818 Implement the emission of oneof injection functions. As always,
oneofs other than enums and singletons are not really implemented.

Swift SVN r1115
2012-02-16 01:57:08 +00:00
John McCall
d0f4d86f3e Use LValueType everywhere instead of the l-value value kind.
Kill off TypeJudgement.  Various fixes and improvements.



Swift SVN r1107
2012-02-06 22:47:08 +00:00
John McCall
ce7780af04 I don't think we're really getting anything out of ArgDecl
at the moment.  We can put it back if I'm wrong.



Swift SVN r1100
2012-01-26 02:08:52 +00:00
John McCall
b85ddcb34a IR generation for curried functions. For now, parameters
are stored in a malloc'ed buffer that gets leaked.



Swift SVN r1092
2012-01-19 23:29:49 +00:00
John McCall
b7e0b0ee06 Now that TupleTypeElts tell us directly what ArgDecls
are bound, bind ArgDecls correctly in uncurried functions.



Swift SVN r1080
2012-01-18 07:39:57 +00:00
John McCall
9c63d1e7e6 Fix a bug with curried function emission and teach the mangler
to differentiate uncurried and curried function types.



Swift SVN r1059
2012-01-17 08:08:47 +00:00
John McCall
0e638a02ea IR generation for plus func references. I'm not convinced
that we should permit these references, really.



Swift SVN r1025
2012-01-12 21:27:26 +00:00
John McCall
286abfc5f7 Mostly kill off RValue. More tomorrow. :)
Swift SVN r1020
2012-01-12 10:18:40 +00:00
John McCall
885783ab76 Start switching things over to using explosions.
Swift SVN r1014
2012-01-12 07:05:49 +00:00
John McCall
c7bcadf450 On further reflection and use, the concept of an RValue is not actually
very useful;  it is much more interesting to divide r-value emission
into "to arguments" and "to memory" models.  To that end, introduce a
new structure for holding an "exploded" r-value.



Swift SVN r1006
2012-01-11 23:59:57 +00:00
John McCall
632b979188 Skeletal IR gen support for ExtensionDecl.
Swift SVN r981
2011-12-23 00:30:24 +00:00
John McCall
6bb1b947d8 Emit initializers of global variables as global constructors.
This isn't the actor model for globals, but is certainly still a
valid model.



Swift SVN r975
2011-12-22 23:35:41 +00:00
John McCall
9b7fb0c227 New l-value representation.
Swift SVN r956
2011-12-22 05:28:33 +00:00
John McCall
b69d5f95cd Implement tuple shuffles.
Swift SVN r890
2011-11-18 10:10:21 +00:00
John McCall
de3c3ff04d Build an implicit expression to record the conversion
of a oneof to its underlying type.  Much better.



Swift SVN r881
2011-11-17 11:38:05 +00:00
John McCall
6c559b2ce1 More missing tuple functionality.
Swift SVN r877
2011-11-17 10:12:21 +00:00
John McCall
c21b11eb28 Add a method for conditionally trying to evaluate an expression
as its underlying l-value.  Often more efficient than evaluating
it fully into an r-value and only then transforming it.



Swift SVN r875
2011-11-17 09:32:06 +00:00
Chris Lattner
60afdf4842 switch irgen to new diags
Swift SVN r769
2011-10-20 21:29:50 +00:00