Commit Graph

797 Commits

Author SHA1 Message Date
Eli Friedman
bd6ff42df2 A couple misc fixes for a testcase John and I were looking at (array new over a generic type). Not committing the testcase because it's still broken.
Swift SVN r2487
2012-07-27 22:20:36 +00:00
John McCall
f21d83aede Fix the standard library to use uitofp instead of sitofp
when turning integer constants into floating-point values.
Teach IR-gen to fold stdlib convertFromIntegerLiteral and
convertFromFloatLiteral calls.
Update a bunch of tests.

Swift SVN r2485
2012-07-27 21:03:17 +00:00
John McCall
011df45944 Fix the emission of member functions on generic types.
Swift SVN r2482
2012-07-27 18:37:09 +00:00
Eli Friedman
5419c62e9f Add missing Scope in logical &&/|| IRGen. <rdar://problem/11959537>.
Swift SVN r2459
2012-07-26 00:21:46 +00:00
Eli Friedman
688138482d Complete the implementation of a basic Vector<T>.
Swift SVN r2457
2012-07-25 22:51:46 +00:00
John McCall
1be602a010 The return type passed to the call emitter needs to be the substituted
return type, not the original.  We were getting away with it
as long as we had a final address, but we won't always have
a final address, as in this test case, where we're ignoring the
result.

Swift SVN r2421
2012-07-24 02:38:57 +00:00
John McCall
ed38caaa04 Support generic return types, as long as they don't differ
by abstraction from the concrete return type.

This basically gets generic calls working totally as long
as there's no remapping required.

Swift SVN r2402
2012-07-23 07:06:28 +00:00
John McCall
555aa807b6 Dig into the formal type of a generic callee for the
call sites, since that's what we want to target for
substitution and witness-argument emission.

Swift SVN r2401
2012-07-22 10:05:24 +00:00
John McCall
a9b9c9c7f0 Collect CallSites in the CalleeSource. Closing in
actually getting a generic call to work.

Swift SVN r2400
2012-07-22 10:05:18 +00:00
John McCall
3950a6af41 Generic calls status code dump activate!
Swift SVN r2386
2012-07-20 21:59:14 +00:00
John McCall
e67466d164 Reorganize how we collect substitutions for callees,
and convert the code that was drilling into function
expressions into an ASTVisitor.

Swift SVN r2385
2012-07-20 21:59:09 +00:00
Eli Friedman
f1f67db652 Big cleanup for how we handle computing types for functions and semantic
analysis for patterns.

Major changes:
1. We no longer try to compute the types of functions in the parser.
2. The type of a function always matches the type of the argument patterns.
3. Every FuncDecl now has a corresponding FuncExpr; that FuncExpr might not
   have a body, though.
4. We now use a new class "ExprHandle" so that both a pattern and a type
   can hold a reference to the same expression.

Hopefully this will be a more reasonable foundation for further changes to
how we compute the types of FuncDecls in generics and for the implementation
of type location information.



Swift SVN r2370
2012-07-19 02:09:04 +00:00
Doug Gregor
d684a74ada Implement builtin 'sizeof' and 'alignof' for everthing except archetypes.
Swift SVN r2330
2012-07-10 18:35:48 +00:00
Eli Friedman
728f948a79 Make Builtin.load, Builtin.init, and Builtin.assign generic functions.
This is most of what is necessary to implement UnsafePointer<T>; we also
will need Builtin.sizeof eventually.



Swift SVN r2325
2012-07-09 23:55:03 +00:00
John McCall
2d998f315d Implement method calls on archetype values.
Swift SVN r2275
2012-06-28 20:56:25 +00:00
John McCall
e53aed65d7 Initial support for IR-genning generic function bodies.
Mangling is still a hack, pending a better type AST.  Fixed
a bug where arguments passed indirectly were not being destroyed
by the callee (when passed by value).  Changed some of the protocol
signatures to use the generic opaque pointer type, making the
types a bit more self-documenting in the IR.

Swift SVN r2274
2012-06-28 08:50:06 +00:00
John McCall
668f674bfa Split off a PolymorphicFunctionType from FunctionType. I am
*positive* that the behavior here is blatantly wrong in a lot
of places, but I'm going to leave it to Doug to clean up after me. :)

Swift SVN r2255
2012-06-27 00:22:15 +00:00
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