Commit Graph

758 Commits

Author SHA1 Message Date
John McCall
e298448e7d Compensate for a trunk LLVM change.
Swift SVN r2983
2012-10-11 20:14:08 +00:00
Eli Friedman
dd299a35af Fix for LLVM TargetData -> DataLayout rename.
Swift SVN r2959
2012-10-09 23:18:24 +00:00
John McCall
34da6d1650 Implement grabbing an external value witness table. I
described this mangling in a previous commit, and the runtime
is already using it for some standard tables.

Swift SVN r2870
2012-09-19 06:33:36 +00:00
John McCall
2c21ee7796 Add the compiler infrastructure for emitting references to tuple and
function metadata.

Swift SVN r2864
2012-09-18 07:23:51 +00:00
John McCall
5b10c5df32 Move emitClassMetadataRef to GenMeta.cpp and make it work for
an arbitrary metadata type.

Swift SVN r2862
2012-09-18 07:23:44 +00:00
John McCall
1529e0ddd4 Arrange for general mangling of type metadata.
Swift SVN r2853
2012-09-13 21:26:07 +00:00
John McCall
8499117b59 The value witnesses for size/alignment/stride can just be size_t's.
This requires us to potentially copy the value witness tables for
generic struct types as part of computing layout, but that's not
the end of the world (although it will rely on a future patch
to split value witnesses out from protocol witness tables).

Oh, and add a value witness for stride, changing Builtin.strideof
to use that.

Swift SVN r2829
2012-09-06 08:23:14 +00:00
John McCall
e7b9ae47fa Defer to the value witness when moving an archetype. This
is really a deficiency in TypeInfo::initializeWithTake, which
is now virtual and not implemented in TypeInfo anymore.  This
fixes rdar://problem/12153619.

While I'm at it, fix an inefficiency in how we were handling
ignored results of generic calls, and add 4 new builtins:
  Builtin.strideof is like sizeof, but guarantees that it
  returns a multiple of the alignment (i.e., like C sizeof,
  it is the appropriate allocation size for members of an
  array).
  Builtin.destroy destroys something "in place";  previously
  this was being simulated by moving and ignoring the result.
  Builtin.allocRaw allocates raw, uninitialized memory, given
  a size and alignment.
  Builtin.deallocRaw deallocates a pointer allocated with
  Builtin.allocRaw;  it must be given the allocated size.

Swift SVN r2720
2012-08-23 05:21:31 +00:00
John McCall
20bfc9c1ec Initial, untested support for uniquing generic class metadata,
which is necessary to embed the value witnesses there.

Swift SVN r2671
2012-08-17 06:47:33 +00:00
Chris Lattner
cd3f362faf revert r2364, which introduced the swift_allocClass entrypoint. The optimization that it was
trying to block has since been reverted, and I think there are other approachs that will work.


Swift SVN r2547
2012-08-03 23:27:15 +00:00
Eli Friedman
29b3994cca Add a new entry point for allocating classes. This API probably isn't really
right, but we need something in the meantime to make the optimizer understand
that there could be non-trivial destructors involved.



Swift SVN r2366
2012-07-17 23:25:02 +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
b35ab5e4df Make the opaque type be a named IR type.
Swift SVN r2248
2012-06-25 20:45:06 +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
John McCall
24a84132ca More CC-related changes.
Swift SVN r2150
2012-06-05 04:51:04 +00:00
Chris Lattner
16cf77644f switch the frontend to generate swift_retain_noresult calls instead of
swift_retain calls.  The pertinent difference is that the former can be
marked nocapture, allowing general LLVM optimizations more flexibility.

With this change, early-cse is able to zap 9 more instructions, and 3
more functions are able to be marked nocapture by functionattrs in the
stdlib.


Swift SVN r2043
2012-05-28 20:20:07 +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
40d1591f89 Some minor tweaks to make our use of the allocation entrypoints
match the actual entrypoints vended by the runtime:
1) there is no swift_slowRawAlloc
2) swift_deallocObject takes two arguments
Also, make all calls to swift_allocObject go through a common
function so that we can easily use optimized entrypoints if the
runtime provides them.

Swift SVN r1993
2012-05-25 17:34:59 +00:00
John McCall
4b562e6b62 Use the actual raw-allocation APIs, including the optimized
allocation entrypoints.

Swift SVN r1976
2012-05-24 19:16:09 +00:00
Dave Zarzycki
94e67cc4e9 Add fast/basic alloc/dealloc APIs
Swift SVN r1908
2012-05-21 17:08:54 +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
d461d72e85 Implement ErasureExpr in IR-gen, at least as far as generating
value witnesses goes.

There are three major remaining things to do to support protocols:
  - laying out the actual protocol members
  - emitting witnesse for the actual protocol members
  - detecting uses of the actual protocol members and funnelling
    them through the witnesses as appropriate
All this work was just to let us treat protocol types as
first-class values.

Swift SVN r1899
2012-05-18 10:02:01 +00:00
John McCall
85acda32bb Implement basic functionality for protocol types, with the
exception of assign.

Swift SVN r1895
2012-05-18 10:01:46 +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
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
f3e27d90ff Change IR-generation so that it emits metadata objects for the
heap allocations it makes, and switch swift_alloc over to pass
that pointer in as well as the alignment.  Also, compute
whether a type is POD during its generation and cache that in
the object, and introduce a method on TypeInfo to destroy an
object in memory.

Swift SVN r1356
2012-04-10 06:28:22 +00:00
Eli Friedman
29f3fca950 First iteration of CaptureAnalysis.
Swift SVN r1284
2012-03-29 00:24:03 +00:00
John McCall
aafaae22bc Properly include the heap header when laying out structures
for the heap.

Swift SVN r1275
2012-03-27 23:54:10 +00:00
John McCall
b0aca874c7 Switch the compiler's internal definition of struct SwiftHeapObject
to match the header (by adding the refcount field).

Swift SVN r1274
2012-03-27 23:16:19 +00:00
John McCall
5a4dfb6624 Beginnings of support for heap-allocated locals.
Swift SVN r1246
2012-03-20 19:42:03 +00:00
John McCall
99a6c4ccf1 Cache %refcounted* null. This will be particularly important
for heap l-values.

Swift SVN r1245
2012-03-20 19:42:00 +00:00
John McCall
0a012fc379 Initialize the retain/release function caches.
Swift SVN r1218
2012-03-16 19:02:23 +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
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
6bb1b947d8 Emit initializers of global variables as global constructors.
This isn't the actor model for globals, but is certainly still a
valid model.



Swift SVN r975
2011-12-22 23:35:41 +00:00
John McCall
6b935588e5 On second thought, components need to be known in the AST.
Swift SVN r918
2011-12-07 03:57:41 +00:00
John McCall
c756d37afd Basic Component interface.
Swift SVN r911
2011-12-06 21:48:27 +00:00
John McCall
6c559b2ce1 More missing tuple functionality.
Swift SVN r877
2011-11-17 10:12:21 +00:00
Chris Lattner
9298082ebb move Diagnostics header to include/swift/AST to match .cpp files.
Swift SVN r782
2011-10-22 00:47:35 +00:00
Chris Lattner
dfd529ce3a rename diags::foo to diag::foo
Swift SVN r779
2011-10-22 00:36:19 +00:00
Chris Lattner
60afdf4842 switch irgen to new diags
Swift SVN r769
2011-10-20 21:29:50 +00:00
Chris Lattner
a7c7d64fa0 Switch swift to use SourceLoc instead of SMLoc.
Also use the new getAdvancedLoc() method instead of hacking
on SMLoc directly.

Also fix the warning/note/error methods to forward through ASTContext
instead of being replicated everywhere.



Swift SVN r750
2011-10-18 01:22:29 +00:00
Chris Lattner
2d43b8812f update for mainline API changes.
Swift SVN r745
2011-10-16 06:17:27 +00:00
John McCall
b2facdae4b Getterize Stmt.h.
Swift SVN r720
2011-09-20 07:07:53 +00:00
John McCall
54ff2ccf4a Lop the last word off ModuleDecl and TranslationUnitDecl.
Swift SVN r693
2011-09-06 21:43:46 +00:00
John McCall
066719530c Implement rudimentary l-value and r-value emission for DeclRefExpr.
Swift's ASTs are lacking the extremely useful concept of a DeclContext,
without which it's probably possible to make this work, but it'll be
extremely awkward.  Anyway, these hacks are good enough to get the
test passing again.



Swift SVN r620
2011-08-25 10:33:05 +00:00
John McCall
2ac244ec7f unimplemented() should flag an error to cause the process to fail.
XFAIL func.swift again until return statements are implemented.



Swift SVN r615
2011-08-25 08:37:31 +00:00
John McCall
9baf355000 Add a method for reporting unimplemented errors.
Swift SVN r608
2011-08-25 07:38:25 +00:00