Chris Lattner
90fc3c35bb
split the 3 "arithmetic" binary operations into fp vs integer variants.
...
Swift SVN r1838
2012-05-14 18:45:33 +00:00
Chris Lattner
dd63c83ecc
rework compare builtins to use the new-school way of
...
IRGen'ing them.
Swift SVN r1837
2012-05-14 17:53:19 +00:00
Chris Lattner
5dc60f4252
pull hard-coded builtins out of the switch.
...
Swift SVN r1836
2012-05-14 17:39:02 +00:00
Chris Lattner
fd38dab6e2
switch cast builtins IRGen to use a different approach.
...
Swift SVN r1835
2012-05-14 17:37:07 +00:00
Chris Lattner
f1478aa81c
regularize cast processing in IRGen
...
Swift SVN r1834
2012-05-14 17:32:57 +00:00
Doug Gregor
59db25658a
Ban the use of SuperConversionExpr to produce lvalues, since that is,
...
in general, not sound. For the limited cases where we did use this
expression kind on lvalues (member access or instance method
invocations on a superprotocol), leave the conversion to the client of
their respective AST nodes (MemberRefExpr, DotSyntaxCallExpr). We may
decide to enrich these ASTs in the future with more information about
the conversion path, but it's not clear that it's actually useful
information for, e.g., IRgen.
Swift SVN r1830
2012-05-14 15:38:27 +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
John McCall
48cd78cfef
Allow an opaque struct type to be specified as the struct
...
to perform struct-layout into.
Swift SVN r1823
2012-05-12 07:19:43 +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
a49d6c88c8
Introduce a conversion-to-supertype expression to capture conversions
...
from a protocol to a protocol it inherits. This is a far simpler
operation that the general type-erasure expression, so generate this
AST when we can.
Swift SVN r1813
2012-05-11 17:25:14 +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
John McCall
875d914c77
Extract the layout logic out of GenTuple.cpp into a template header.
...
It does seem silly for this to all be templated, but I couldn't
really see a very elegant solution given how I wanted things to
be genericized.
...interestingly, a ?t.t[] type would have done nicely for some
of this.
Swift SVN r1807
2012-05-11 01:34:56 +00:00
Doug Gregor
70bfc235b8
Implement protocol inheritance, e.g.,
...
protocol Document { var title : String }
protocol Versioning { func bumpVersion() }
protocol VersionedDocument : Document, Versioning { }
This commit covers the basic functionality of protocol inheritance, including:
- Parsing & AST representation
- Conforming to a protocol also requires conforming to its inherited
protocols
- Member lookup into a protocol also looks into its inherited
protocols (results are aggregated; there is no name hiding)
- Teach ErasureExpr to maintain lvalueness, so we don't end up
performing a silly load/erase/materialize dance when accessing
members from an inherited protocol.
Swift SVN r1804
2012-05-11 00:00:50 +00:00
Eli Friedman
28cddd1b90
Make sure we use the right IR generation options for the IRGen standard library hack.
...
Swift SVN r1801
2012-05-10 22:22:18 +00:00
Eli Friedman
ed63824918
Fix a minor logic issue with swift::irgen::IRBuilder::insertBlockAnywhere. Fixes the rest of <rdar://problem/11425939>.
...
Swift SVN r1800
2012-05-10 21:52:04 +00:00
Eli Friedman
8d58b9f6f6
Make sure we destroy the element variable in a for-each loop in the right place. Part of <rdar://problem/11425939>.
...
Swift SVN r1799
2012-05-10 21:32:18 +00:00
Doug Gregor
3e7b52d025
Implement support for coercing a value of a given type T to a protocol
...
P, so long as T conforms to the protocol P.
Swift SVN r1797
2012-05-10 18:55:30 +00:00
Doug Gregor
88b214d020
Revert r1792; it's missing a file :(
...
Swift SVN r1795
2012-05-10 17:13:44 +00:00
Doug Gregor
f4f2f9f570
Implement support for coercing a value of a given type T to a protocol
...
P, so long as T conforms to the protocol P.
Swift SVN r1794
2012-05-10 16:15:34 +00:00
Eli Friedman
8f290b63a8
Extend the ugly standard library hack so it works for static compilation. We should be inlining from the standard library now everywhere except the REPL.
...
Swift SVN r1792
2012-05-10 01:14:56 +00:00
Chris Lattner
a5030c00cb
minor pedantic tidying up.
...
Swift SVN r1783
2012-05-09 00:53:46 +00:00
Doug Gregor
169dd225bf
Switch Parser::parseProtocolBody() over to use parseDecl(), with a
...
giant list of "you can't do that" restrictions. Update grammar
accordingly, killing off decl-var-simple.
Swift SVN r1781
2012-05-09 00:35:53 +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
Doug Gregor
5f2344afe0
Introduce ProtocolDecl, which describes (*gasp*) a protocol. Move the
...
guts of ProtocolType over to ProtocolDecl.
Swift SVN r1778
2012-05-08 23:28:55 +00:00
Eli Friedman
d9f8ab5084
Get rid of unused functions.
...
Swift SVN r1776
2012-05-08 21:14:07 +00:00
Eli Friedman
4ca443d0f5
Add OneOfDecl; use it as a DeclContext for OneOfElementDecls instead of OneOfType, and get rid of the implicit TypeAliasDecl. Add TypeDecl as a base class for OneOfDecl and TypeAliasDecl (and StructDecl, once we have it). Adjust a whole bunch of stuff to this new scheme.
...
Swift SVN r1774
2012-05-08 21:09:42 +00:00
Doug Gregor
302de6632d
Switch the for-each loop informal protocol from getFirst()/dropFirst()
...
to the more input-iterator-centric getFirstAndAdvance(). Fixes
<rdar://problem/11401273>.
Swift SVN r1766
2012-05-08 00:37:01 +00:00
Chris Lattner
204b416229
raw_fd_ostream doesn't set the "has_error" bit in its ctor if it failed to open the file, it returns the error through the string reference error argument. This is half of fixing rdar://11388418.
...
The other half is on the llvm side.
Swift SVN r1761
2012-05-06 16:19:26 +00:00
Eli Friedman
ca1f3270bc
A couple minor tweaks to IRGen: turn on inlining when we're optimizing, and turn off non-leaf frame pointer elimination when we're generating an object file.
...
Swift SVN r1749
2012-05-05 02:16:07 +00:00
Eli Friedman
f75e305a20
Add ScalarToTupleExpr to represent an implicit conversion from a scalar to a tuple, with or without default arguments. Make Sema and IRGen work with them.
...
I'm not completely sure this is the representation we want, but it isn't much code to rip out if we decide to represent it some other way.
While I'm in the area, also fix a case where tuple->tuple conversion wasn't working.
Swift SVN r1748
2012-05-05 00:50:06 +00:00
Eli Friedman
c2868d6d0a
Make local oneofs not crash in IRGen. <rdar://problem/11292678>.
...
Swift SVN r1743
2012-05-04 18:20:51 +00:00
Chris Lattner
2f44c0038c
Initial stab at implementing string literal interpolation for simple expressions,
...
e.g. "foo is \(i+j)". This implements rdar://11223686
Doug implemented all the hard parts of this. I ripped out support for nested string
literals (i.e. string literals within an interpolated string), which simplified the
approach and defined away some problems with his patch in progress. I plan a few refinements
on top of this basic patch.
Swift SVN r1738
2012-05-04 05:53:50 +00:00
Chris Lattner
774a557e5c
Merge NamedDecl into ValueDecl, rdar://11379147.
...
Swift SVN r1737
2012-05-04 04:50:53 +00:00
Eli Friedman
b45d97bbe4
Don't crash trying to generate an LLVM type for a local oneof. Part of <rdar://problem/11292678>.
...
Swift SVN r1736
2012-05-04 01:28:41 +00:00
John McCall
6461b20a25
When reallocating a DiverseList, make sure the new end()
...
includes the size of the component we're growing for;
otherwise, it just gets silently lost. This is actually
the only thing apparently blocking two-level subscripting
from working.
Swift SVN r1727
2012-05-03 22:44:28 +00:00
John McCall
53d52f6d7d
Switch from std::vector back to SmallVector, now that SmallVector
...
supports move-only types.
Swift SVN r1715
2012-05-02 05:51:32 +00:00
Chris Lattner
de73b6d2ea
add IRGen support for var decls in for 'init' clauses, really finishing
...
off 11360347
Swift SVN r1714
2012-05-02 05:47:32 +00:00
Chris Lattner
c895535767
remove another turd required to support obsolete compilers.
...
Swift SVN r1707
2012-05-02 00:03:46 +00:00
Chris Lattner
5df64dd895
revert r1700 now that clang-421.0.27 is our baseline :)
...
Swift SVN r1706
2012-05-02 00:02:03 +00:00
Chris Lattner
cf1314ad2b
fix catastrophic errors when built with Xcode 4.3, apparently that clang
...
doesn't copy Path with a defaulted copy ctor.
Swift SVN r1702
2012-05-01 17:55:27 +00:00
Eli Friedman
a684be9af7
Per John's comments on r1696, use IGM.getPointerSize(), and add a bit to CapturingExpr for whether the function is captured.
...
Swift SVN r1700
2012-05-01 02:43:12 +00:00
Eli Friedman
2e8733054e
Hack fast implementations of '&&' and '||' into IRGen.
...
Swift SVN r1699
2012-05-01 02:24:02 +00:00
Eli Friedman
0b946658a7
A small experiment with the potential benefits of nocapture. Avoiding the heap allocation helps substantially, but there's still overhead because the LLVM optimizers can't see through swift_release.
...
Swift SVN r1698
2012-05-01 02:21:11 +00:00
Eli Friedman
9f50c09fb1
Add a couple hacks to make code using Bools optimize better.
...
Swift SVN r1696
2012-05-01 00:40:44 +00:00
Eli Friedman
daa531d0e4
Make sure we correctly restrict the scope of the FullExpr in IRGenFunction::emitCondition to the actual expression emission, so the branch comes after any cleanups. Found while experimenting with bools.
...
Swift SVN r1695
2012-04-30 23:17:48 +00:00
Eli Friedman
48c1cbbe6b
Make the type of VarDecls match the declared type of the variable/parameter/etc. <rdar://problem/11125010>.
...
Swift SVN r1680
2012-04-28 01:26:19 +00:00
Chris Lattner
615ca4a360
implement the rest of character literal support, and enhance Char to be character literal
...
compatible. This wraps up rdar://11305635, though some cleanup of the testsuite can now be done.
Swift SVN r1672
2012-04-27 06:18:30 +00:00
John McCall
be2bfa9eb7
Don't emit the begin/end pointers in an array destructor if
...
the element type is trivial, and test that we correctly emit
loops when the element type is not trivial.
Swift SVN r1653
2012-04-26 08:07:35 +00:00
John McCall
ee61610563
Implement IR generation for NewArrayExpr.
...
Swift SVN r1651
2012-04-26 07:34:04 +00:00