Commit Graph

680 Commits

Author SHA1 Message Date
John McCall
6c821ddc1b Support allocating local objects of archetype type, at least in
theory.

Swift SVN r2245
2012-06-25 20:45:04 +00:00
John McCall
8203b795ef Trivial refactor in preparation for making Initialization part
of the TypeInfo API.

Swift SVN r2244
2012-06-25 20:45:03 +00:00
John McCall
770ce0fde7 Refactor to make it easier to keep common information in
the type converter.

Swift SVN r2241
2012-06-25 20:44:59 +00:00
Eli Friedman
d85f426693 Initial implementation of static functions on protocols. <rdar://problem/11448251>.
There are currently two places where you can use a static function defined on a protocol:
on an object with the type of the protocol (discarding the base), and on an archetype in a generic function.  The AST for the protocol object case is probably okay;
the AST for the generic case is almost certainly wrong, but that whole area isn't really stable at the moment anyway.  The proposal in rdar://problem/11448251 will
add a third way: operators on protocols will be found by overload resolution.  (Having static functions on protocols opens up the possibility of metaprotocols,
but I don't think I need to worry about that for the moment.)



Swift SVN r2211
2012-06-20 02:49:54 +00:00
John McCall
53646ccfc8 Better support for mangling, emitting, and using local
functions.

Swift SVN r2152
2012-06-05 04:51:21 +00:00
John McCall
24a84132ca More CC-related changes.
Swift SVN r2150
2012-06-05 04:51:04 +00:00
John McCall
5064f39024 Refactor towards the goal of using different CCs when
passing this pointers or data arguments.

Swift SVN r2149
2012-06-05 04:50:58 +00:00
Eli Friedman
ae86d64644 Rename Decl::getLocStart() to Decl::getStartLoc(). Add Decl::getLoc(), which is essentially the location which should be used for diagnostics.
Swift SVN r2105
2012-05-31 23:56:30 +00:00
Eli Friedman
26bebcfd61 IRGen for break/continue.
Swift SVN r2089
2012-05-31 02:45:18 +00:00
Chris Lattner
4f4636db31 adjust to mainline API change, and implement rdar://11542870 - @swift_release should be marked nocapture
Swift SVN r2031
2012-05-28 01:52:47 +00:00
John McCall
3bab069ed1 Fix a think-o where I was adding the callee-determined arguments
after the normal arguments instead of before.

Swift SVN r1970
2012-05-24 16:43:19 +00:00
John McCall
30244a2f0d Do all the dancing necessary to get method calls through
protocols working.

Swift SVN r1969
2012-05-24 12:16:51 +00:00
John McCall
6a16a5aae4 Prepare some abstractions for calling through an existential type.
Swift SVN r1968
2012-05-24 12:16:47 +00:00
John McCall
06992eec7a Introduce helper templates to make it easier to define
type infos that can be efficiently scalarized.

Swift SVN r1904
2012-05-19 03:16:08 +00:00
John McCall
38bac7c706 Add Builtin.ObjCPointer with accompanying IR-gen support and
wrap it in an 'id' type in the standard library.

Also fix a bug noticed by inspection where initWithTake for
function types wasn't entering a cleanup for the taken value.
This probably doesn't matter for existing possibilities, but
it's potentially important under exceptions.

Swift SVN r1902
2012-05-18 23:40:17 +00:00
John McCall
675ec2234c Teach IRGen how to emit a call or load directly as the initializer for
some hunk of memory.

Swift SVN r1893
2012-05-18 10:01:38 +00:00
Chris Lattner
065614c8ac Add support for working with IR intrinsics that return multiple values, like the
overflow stuff.


Swift SVN r1891
2012-05-17 20:42:38 +00:00
Chris Lattner
b2fb91fba6 rip out my previous hack for Builtin.trap() and put in general code that
allows access to any LLVM IR intrinsic that has types that can be mapped
to swift types.  Notably, this excludes vector stuff, but there is a lot
of other goodness that can now be poked at.



Swift SVN r1890
2012-05-17 20:31:17 +00:00
Chris Lattner
5163b40020 Hack in support for Builtin.trap(), resolving rdar://11442881. a more
general solution to get access to arbitrary intrinsics will follow.


Swift SVN r1857
2012-05-15 17:40:46 +00:00
Chris Lattner
f3c3ad086f Remove OverloadedBuiltinKind::Arithmetic, replacing it with OverloadedBuiltinKind::Special
and simplifying Builtins.def.


Swift SVN r1854
2012-05-15 04:29:47 +00:00
Chris Lattner
6faa726012 switch binops builtin irgen to the new world order.
Swift SVN r1852
2012-05-15 04:15:54 +00:00
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
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
Eli Friedman
2e8733054e Hack fast implementations of '&&' and '||' into IRGen.
Swift SVN r1699
2012-05-01 02:24:02 +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
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
John McCall
ee61610563 Implement IR generation for NewArrayExpr.
Swift SVN r1651
2012-04-26 07:34:04 +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
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
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
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
4ab945f192 Fix Ted's currying fractal example. <rdar://problem/11278150>.
Swift SVN r1506
2012-04-19 21:52:02 +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