Commit Graph

12848 Commits

Author SHA1 Message Date
John McCall
03be725a8e Document the qualification-conversion function.
Swift SVN r1244
2012-03-20 19:41:57 +00:00
John McCall
d6b05b38a6 Document the various cached bits of IR on IRGenModule.
Swift SVN r1243
2012-03-20 19:41:54 +00:00
Eli Friedman
d39a7abe36 Implement CapturingExpr. In addition to unifying the hierarchy between FuncExpr and ClosureExpr, this introduces a DeclContext for ClosureExprs. <rdar://problem/11076715>
Swift SVN r1240
2012-03-20 01:08:04 +00:00
John McCall
bd12853be7 Stay conservative about emitting LoadExprs in ignored
contexts.

Swift SVN r1239
2012-03-19 09:01:41 +00:00
John McCall
d699e00390 Teach IR-gen how to efficiently emit a broad range of
expressions when no value is required.  Teach IR-gen
to emit DotSyntaxBaseIgnoredExprs as known function
references with possibly non-trivial semantics.
Undo the change to getSemanticsProvidingExpr().

Swift SVN r1238
2012-03-19 08:59:35 +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
Chris Lattner
ce717d2c7c teach IRGenFunction::emitIgnored to handle expressions of module and metattype type.
Teach Expr::getSemanticsProvidingExpr to look through DotSyntaxBaseIgnoredExpr.
Start generating DotSyntaxBaseIgnoredExpr for all dot syntax exprs where the base is
ignored (e.g. "Builtin.mul_i32"), which preserves a lot more source location information
and is general goodness for the AST.


Swift SVN r1232
2012-03-19 05:33:29 +00:00
Chris Lattner
4e4c1bf417 rename DotSyntaxPlusFuncUseExpr -> DotSyntaxBaseIgnoredExpr
to properly represent its newly generalized role.  It is formed
for things like "swift.print" where swift is a module type and is
evaluated and ignored.


Swift SVN r1230
2012-03-19 05:23:39 +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
4b5fe8fb9b Make Swift's IRBuilder::CreateLoad allow a name to be assigned,
and add a CreateStructGEP for Address.

Swift SVN r1219
2012-03-16 19:02:24 +00:00
John McCall
0a012fc379 Initialize the retain/release function caches.
Swift SVN r1218
2012-03-16 19:02:23 +00:00
John McCall
53de72a7f1 Pull an unnecessary 'Explosion' out of some names.
Swift SVN r1217
2012-03-16 19:02:22 +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
975068c39f Add a simpler walker to find all the variables captured by a closure.
Any suggestions for a better way to find such variables is welcome; I'm not really sure what the correct approach is here.



Swift SVN r1212
2012-03-15 03:06:50 +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
Chris Lattner
3b0db63f85 introduce ImplicitThisTupleElementExpr, progress towards 10682135.
IRGen should really use visitors for expr emission...


Swift SVN r1199
2012-03-11 15:02:16 +00:00
Chris Lattner
d75f76a096 split TupleElementExpr into an abstract TupleElementExpr class and a concrete
SyntacticTupleElementExpr class.  One step towards resolving rdar://10682135.


Swift SVN r1195
2012-03-11 14:48:04 +00:00
John McCall
b8b1694564 Complain about file names that aren't valid identifiers.
When we divide the world into scripts and modules, this
won't matter for the former.  Recognize <stdin> as a
special case;  it should instead just always be a script.
Fixes rdar://problem/10986311.

Swift SVN r1181
2012-03-11 09:15:17 +00:00
Eli Friedman
ddffb633eb Fix build errors with clang-421.
Swift SVN r1167
2012-03-05 19:31:12 +00:00
Chris Lattner
6aac93155d add an AST node to represent explicit closures. Not yet created.
Swift SVN r1154
2012-03-03 12:12:57 +00:00
Chris Lattner
3a6e84f82e Add a new "ImplicitClosureExpr" subclass of ClosureExpr to represent the autoclosure case.
Swift SVN r1152
2012-03-03 11:54:43 +00:00
Chris Lattner
0169b2c764 introduce a new ErrorStmt node to represent invalid code in the AST more
precisely.  Part of rdar://10962837


Swift SVN r1142
2012-03-01 22:40:16 +00:00
John McCall
00b97b38af Grab-bag of materialization-related changes:
- introduce the concept of qualifiers on l-value types
  - teach overload resolution and coercion how to drop explicitness
  - require explicitness on normal [byref] arguments
  - make 'this' [byref(implicit)]
  - special-case '&' as a unary operator in the parser to make it
    produce an expression which type-checks as turning implicit l-values
    into explicit ones.

Obvious missing pieces:
  - updating LangRef
  - we should really complain about ever trying to rvalue-convert an
    explicit l-value
  - maybe qualification should play a part in overload resolution
  - we should diagnose attempts to declare unary '&' operators
  - there's a test case in expressions.swift which suggests my logic is
    slightly off

But I am out of time, and these will have to wait.

Swift SVN r1119
2012-02-22 06:43:33 +00:00
John McCall
9038a38ce8 We will need a DiverseStack<T> for cleanups, but a stack is really
the wrong structure for an l-value.  Use a list instead (that is,
something which allows efficient iteration forward through the
collection).

Swift SVN r1117
2012-02-16 06:11:30 +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
a9120cf1bf Stop storing the lvalue-projection bit on TupleElementExpr and
LookThroughOneofExpr.

Swift SVN r1114
2012-02-16 01:57:07 +00:00
John McCall
2b65cf22d1 Make 'this' implicitly [byref] when the container type does
not have reference semantics.  Deciding whether the container
type has reference semantics requires us to perform
some amount of limited name-binding and type-checking first,
which introduces a few complexities.

Also, fix a bug in uncurried call emission.

Methods work now.



Swift SVN r1112
2012-02-11 07:37:57 +00:00
John McCall
7b29a420f6 Design and implement the [byref] attribute, checking that
it doesn't appear in places it shouldn't.  The only limits on
this checking right now is the inadequacy of location information
for types, which is something we ought to fix.

Fix type-checking of byref applications.  Fix IR generation
of byref variables.  Whole lotta fixin' goin' on.

But hey, byref calls work.



Swift SVN r1111
2012-02-10 09:42:50 +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
6ff9afb6f5 Introduce LValueType.
Swift SVN r1105
2012-02-02 00:57:10 +00:00
John McCall
6d8837dc8d Macro metaprogramming for types.
Swift SVN r1104
2012-02-01 22:37:59 +00:00
John McCall
76ad8fff02 Add more parentheses to Types.h.
Swift SVN r1103
2012-01-31 04:32:37 +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
16f8b2e656 Revise the language design for function argument clause syntax.
A function argument clause is now one or more patterns (which
must be parenthesized and explicitly type all positions) not
separated by arrows;  the first arrow then separates off the
return type.

Revisions to language reference forthcoming.



Swift SVN r1099
2012-01-26 01:25:26 +00:00
John McCall
430fbcce6f Set up a simple query which asks whether a type is known to be
a single retainable object pointer.



Swift SVN r1094
2012-01-24 22:25:57 +00:00
John McCall
ea6d6f6f51 Define ResilienceScope, which is used to make optimizations more
aggressive when their ramifications are purely local.



Swift SVN r1093
2012-01-24 22:25:10 +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
883a16710b Extract out struct layout into a separate file. No clients yet.
Swift SVN r1091
2012-01-19 23:28:41 +00:00
John McCall
213d61361a It is no longer necessary to remember all the ArgDecls
in a FuncExpr.  This coincidentally means that we can
create the FuncExpr before we create the ArgDecls and
thus avoid the need to reparent them all.



Swift SVN r1081
2012-01-18 07:45:44 +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
Chris Lattner
584ed537fc introduce a new ErrorExpr to represent a subexpression that is semantically
inconsistent (so it needs to be killed) but that we want to retain source
range information and not kill the entire subtree that contains it.


Swift SVN r1073
2012-01-18 07:18:57 +00:00
John McCall
610e14eeda Use a PrettyStackTraceDecl to note that we're emitting the
body of a particular function.



Swift SVN r1072
2012-01-18 07:15:52 +00:00
John McCall
603f7a13b9 Modify this to not do a direct access to a private member.
I filed Clang PR11793 to track the apparent lapse in access
control.



Swift SVN r1071
2012-01-18 07:08:38 +00:00
Chris Lattner
7d0f7d53f9 improve type safety and specificity a bit, the body of a function is always a FuncExpr.
Swift SVN r1069
2012-01-18 06:56:53 +00:00