John McCall
980f94817c
Abstract out adding the heap header to things.
...
Swift SVN r1650
2012-04-26 07:34:00 +00:00
John McCall
034387b5bb
Fix the definition of Alignment::isOne() and implement a
...
roundUpToAlignment method on Size.
Swift SVN r1649
2012-04-26 07:33:57 +00:00
Eli Friedman
1757b81339
Add support for capturing local FuncDecls.
...
Swift SVN r1648
2012-04-26 01:32:46 +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
Eli Friedman
e33b1aac24
Don't try to synthesize an expression for a return statement which doesn't have one. <rdar://problem/11315114>.
...
Swift SVN r1639
2012-04-25 22:58:06 +00:00
John McCall
b3b71178a5
Fix a pair of bugs with partial updates of logical l-values:
...
first, we weren't registering the cleanup for the temporary
if it needed materialization, and second, we were potentially
double-consuming cleanups associated with the l-value, e.g.
subscript indices.
Swift SVN r1631
2012-04-25 09:39:22 +00:00
John McCall
61b6661392
Support for subscript l-values.
...
Swift SVN r1630
2012-04-25 08:36:35 +00:00
John McCall
fe8de68142
Correctly generate references to property vars.
...
Swift SVN r1629
2012-04-25 08:36:31 +00:00
John McCall
93e02410ef
Move IRGenFunction::getGlobal into the l-value code.
...
Swift SVN r1628
2012-04-25 08:36:28 +00:00
John McCall
edf3dac260
Abstract the logical lvalue emission code so that it works
...
on all the currently-expected kinds of logical lvalues.
Swift SVN r1627
2012-04-25 08:36:24 +00:00
John McCall
ab44ee7921
Don't force PathComponent subclasses to propagate their size
...
upwards; this is very error-prone.
Swift SVN r1626
2012-04-25 08:36:21 +00:00
Eli Friedman
cf14b1a437
Skip an unnecessary release when building a closure.
...
Swift SVN r1621
2012-04-25 03:42:52 +00:00
Eli Friedman
e6865b3b23
Move the implementation of Char printing into swift.swift, and get rid of the old printChar. Fix a bug in IRGen I ran into while working on that.
...
Swift SVN r1620
2012-04-25 03:39:48 +00:00
Eli Friedman
81776635c5
Add an asmname attribute which overrides the default mangling for a swift function. This is a complete hack, and we intend to remove it (along with function declarations which don't include a definition) once we can properly import C modules. <rdar://problem/11306201>.
...
Swift SVN r1617
2012-04-25 01:53:38 +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
Eli Friedman
6604ece872
Fill in "unimplemented" IRGen pieces so we don't subsequently crash.
...
Swift SVN r1602
2012-04-24 21:07:36 +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
Doug Gregor
f997a781bf
Parsing and basic AST representation for 'foreach' statement.
...
Swift SVN r1594
2012-04-24 18:12:44 +00:00
John McCall
c7b7c085bd
Following IR gen's motivated lead, split Builtin.store
...
into Builtin.assign and Builtin.init operations.
Swift SVN r1593
2012-04-24 09:51:05 +00:00
John McCall
113aa3d1ff
Fix the emission of MemberRefExpr l-values and getter/setter
...
pairs in extensions. The AST here is a little wierd; I don't
really get why there needs to be a PatternBindingDecl here.
It's easy enough to ignore.
Swift SVN r1592
2012-04-24 09:36:58 +00:00
John McCall
6cdecc020c
Make all the subscripting getters/setters go down the same path.
...
This intentionally changes the mangling of variable getters and
setters so that we can have a reproducible mangling that doesn't
depend on things like the variables names, which is important
for resilience. It's not currently important for subscripting,
although equally I see no reason to mangle in the subscript
pattern name.
Swift SVN r1590
2012-04-24 09:04:54 +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
John McCall
674c286f15
Make Callee part of the API to GenFunc.
...
Swift SVN r1587
2012-04-24 08:16:41 +00:00
John McCall
9192d39e7a
Here's a nickel, get a real compiler.
...
Swift SVN r1573
2012-04-23 23:55:13 +00:00
John McCall
3e2c295a43
Work around sabre's insistence on using obsolete technology.
...
Swift SVN r1571
2012-04-23 23:43:59 +00:00
John McCall
bc32a8aedb
Fix a bug with returning value that need to be refcounted:
...
we want to do a take-load out of the return address slot
instead of a normal load, or else we'll end up +1'ing an
already +1 value.
Swift SVN r1564
2012-04-23 17:47:07 +00:00
John McCall
d68fee8b41
Perform Builtin.load and Builtin.store using the type
...
info for the result/argument type. This makes them
properly generic over an arbitrary type.
Swift SVN r1563
2012-04-23 17:46:58 +00:00
Chris Lattner
38443224c4
fix typo
...
Swift SVN r1561
2012-04-23 06:41:10 +00:00
Chris Lattner
6e7d1071d6
lshr is a useful builtin to have, just not useful for signed shift right :)
...
Swift SVN r1540
2012-04-21 05:28:04 +00:00
Doug Gregor
0bdca7425f
s/lshr/ashr/g in builtins.
...
Swift SVN r1537
2012-04-20 19:46:29 +00:00
Doug Gregor
8e7902e7a3
Manage objects (of type Builtin.ObjectPointer) loaded or stored via
...
Builtin.load_ObjectPointer/Builtin.store_ObjectPointer.
John, please review!
Swift SVN r1535
2012-04-20 19:41:50 +00:00
Doug Gregor
b237823246
Implement load and store builtins, which we use to provide get() and
...
set() functions for UnsafePointerInt.
Swift SVN r1533
2012-04-20 17:58:23 +00:00
Doug Gregor
e26d552a36
Implement integer shift-left/shift-right in the Swift standard library.
...
Swift SVN r1531
2012-04-20 16:33:38 +00:00
Eli Friedman
372ecb3b6b
Fix Ted's latest fractal testcase. <rdar://problem/11278118>. (There were two issues: an assertion failure in tryEmitTupleElementAsAddress, and a strange runtime failure caused by incorrect refcounting.)
...
Swift SVN r1524
2012-04-20 04:14:22 +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
Doug Gregor
cd43490fb3
Implement semantic analysis for subscript expressions, using overload
...
resolution to pick the best subscript getter/setter pair. Does not yet
allow type coercion to influence overload resolution.
Swift SVN r1515
2012-04-19 23:01:04 +00:00
Doug Gregor
cd7be4edf1
Add an AST for subscript expressions; no real type checking yet.
...
Swift SVN r1512
2012-04-19 22:07:42 +00:00
Eli Friedman
4ab945f192
Fix Ted's currying fractal example. <rdar://problem/11278150>.
...
Swift SVN r1506
2012-04-19 21:52:02 +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
d5e7784010
Get rid of isModuleScope bit, since we don't like scattering bits across the AST; as a replacement, introduce TopLevelCodeDecl, which provides a DeclContext for all expressions and statements at the top level. <rdar://problem/11259941>.
...
Swift SVN r1503
2012-04-19 21:22:12 +00:00
John McCall
50899952e3
Fix a consistency error: just because a value doesn't
...
require reference counting doesn't mean we shouldn't
add it to the explosion when "retaining" it.
Swift SVN r1500
2012-04-19 21:05:26 +00:00
Doug Gregor
8ff3075ce4
Teach getter/setter functions about their corresponding subscript
...
declaration, so they can mangle themselves appropriately.
Swift SVN r1499
2012-04-19 20:56:22 +00:00
Doug Gregor
b6140f3b2c
Teach IR generation that there are no global subscript operations
...
Swift SVN r1498
2012-04-19 20:42:36 +00:00
Doug Gregor
06881faea2
Introduce an AST node for subscript declarations, and verify that the bodies of the getter and setter are being type-checked.
...
Swift SVN r1496
2012-04-19 20:29:48 +00:00
Eli Friedman
4848072285
Add a hack which makes us run the initializers for "true" and "false" in script mode and REPL mode. <rdar://problem/11256886>
...
Swift SVN r1494
2012-04-19 19:04:28 +00:00
Eli Friedman
acc17d69aa
Initial implementation of the "print" part of the REPL.
...
Swift SVN r1484
2012-04-19 01:13:37 +00:00
Doug Gregor
b7b8f171b3
Treat a function application A(b) as a coercion of the expression 'b'
...
to the type named by A (when A is in fact a direct reference to a
type). If that coercion would fail, then fall back to invoking a
constructor. Fixes <rdar://problem/11272190>.
Swift SVN r1472
2012-04-18 17:04:34 +00:00
John McCall
71157c65d5
Add parsing support, but no type-checking or IR-generation,
...
for new expressions.
Swift SVN r1466
2012-04-18 08:09:18 +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