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
Doug Gregor
3243108518
Introduce an new expression, MemberRefExpr, that refers to a
...
member of an object. This expression kind is currently used to refer
to properties within an object, but will eventually be extended to
refer to fields as well (once we make StructDecl real).
Swift SVN r1445
2012-04-17 00:35:06 +00:00
Eli Friedman
9009d294d2
More strictly special-case '..'; making '-.' etc. an operator would be a complete disaster.
...
Swift SVN r1444
2012-04-17 00:34:25 +00:00
Eli Friedman
6a001efbbb
Make "..", "*^.^*", etc. into overloadable operators. Make 1..10 construct a Range.
...
This has the side-effect that you can't explicitly refer to an operator* with "swift.*", etc., but per discussion with Doug, that's probably okay.
Swift SVN r1443
2012-04-17 00:21:38 +00:00
Eli Friedman
37de44a35d
Implement changes to parsing/sema/etc so that we can implement a REPL and the main module parses the same way as a REPL.
...
Next step: implement an actual REPL.
Swift SVN r1441
2012-04-16 23:52:01 +00:00
Chris Lattner
a9d01aaaec
eliminate macro in favor of an old-school static function.
...
Implement irgen of ptrtoint and inttoptr, which are only overloaded
on one type. Patch 1.5/2 of builtin cast support.
Swift SVN r1434
2012-04-14 02:35:39 +00:00
Chris Lattner
4f4c8b1455
add initial support for Builtin cast instructions, patch #1/2.
...
Swift SVN r1433
2012-04-14 00:56:35 +00:00
Doug Gregor
4fc32fd9b4
For a function that is either a getter or setter for a variable,
...
provide a mapping back to that variable. Teach the mangler to provide
a special mangling for such functions (__getVarName,
__setVarName). The mangling will undoubtedly change later, but the
point is that it will need to match the functions generated for
a resilient variable.
Swift SVN r1432
2012-04-14 00:11:04 +00:00
Chris Lattner
868eccff76
implement a new Builtin.gep operation which maps to the LLVM Getelementptr instruction,
...
used for pointer offseting. We can figure out inbounds later. This is to be used by
UnsafePointerInt
Swift SVN r1429
2012-04-13 23:10:42 +00:00
Chris Lattner
c7c61ecc01
remove the unary neg/not builtins. They're not needed and don't match LLVM IR.
...
Swift SVN r1425
2012-04-13 21:59:56 +00:00
Chris Lattner
62522bb7cb
add unary ~ to the stdlib for integer (not bool yet) types. Teach the mangler
...
to mangle it.
Swift SVN r1415
2012-04-13 06:05:49 +00:00
John McCall
af2399cd30
Significantly step up the validity asserting around the cleanup stack.
...
With that in place, fix ~Scope so that it uses the same code for
popping as Scope::pop() does, i.e. the code that modifies InnermostScope
before popping out.
This properly fixes the issue Doug patched over in r1387.
Swift SVN r1393
2012-04-11 18:00:48 +00:00
Doug Gregor
4c97c19a4f
"Fix" a use-after-free when dealing with dead cleanups, where we try
...
to look at the first element of an empty stack. The use-after-free
triggers occasionally for me during normal testing (about 1 failure
per 5 trials), but triggers on IRgen/func.swift regularly when using
guardmalloc.
John, please take a look; this feels more like treating a symptom than
addressing the cause.
Swift SVN r1389
2012-04-11 16:09:45 +00:00
John McCall
0146f895a0
Merge GenRefCount.cpp into GenHeap.cpp.
...
Swift SVN r1387
2012-04-11 03:44:47 +00:00
John McCall
6b1a0a2de4
Merge GenLocal.cpp and GenGlobal.cpp.
...
Swift SVN r1386
2012-04-11 03:39:01 +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
828463aa8d
Pack cleanups a little better.
...
Swift SVN r1384
2012-04-11 03:00:05 +00:00
John McCall
3e59c6484f
Fix a nasty bug when reallocating a DiverseStack.
...
Swift SVN r1383
2012-04-11 03:00:01 +00:00
John McCall
5c23fa7326
Move the initialization code out into its own file.
...
Swift SVN r1381
2012-04-11 02:59:55 +00:00