Commit Graph

641 Commits

Author SHA1 Message Date
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
Doug Gregor
bf71eeb26d Include the generic parameter list of a function declaration in the
FuncDecl AST, and use it for local name lookup.


Swift SVN r2198
2012-06-18 23:49:40 +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
Chris Lattner
e65472637d update for mainline api change, much nicer interface now.
Swift SVN r2020
2012-05-27 18:29:53 +00:00
Doug Gregor
130a72c611 Fix typo of GET_INTRINSIC_GENERATOR_GLOBAL
Swift SVN r1952
2012-05-23 14:32:58 +00:00
Chris Lattner
d689beecc1 avoid a warning with llvm r157312
Swift SVN r1951
2012-05-23 05:20:45 +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
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
4c5c948ab7 inline isBuiltinValue into its only caller and simplify it.
Swift SVN r1855
2012-05-15 04:38:01 +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
18530ed142 change BuiltinValueKind and isBuiltinValue to be private to Builtins.cpp.
Swift SVN r1853
2012-05-15 04:17:38 +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
c168af44e8 split the Builtin name parsing logic out to its own function.
Swift SVN r1832
2012-05-14 17:23:18 +00:00
Doug Gregor
86cf79a746 Add a range subscript operation for SliceInt64 that produces a slice, e.g.,
a[5..9]

will return a 4-element slice of the array a. Addresses
<rdar://problem/11329415>.


Swift SVN r1665
2012-04-27 00:07:52 +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
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
Eli Friedman
d5e7784010 Get rid of isModuleScope bit, since we don't like scattering bits across the AST; as a replacement, introduce TopLevelCodeDecl, which provides a DeclContext for all expressions and statements at the top level. <rdar://problem/11259941>.
Swift SVN r1503
2012-04-19 21:22:12 +00:00
Chris Lattner
3584b0aea5 implement the rest of support for casts that I care about.
Swift SVN r1435
2012-04-14 02:43:35 +00:00
Chris Lattner
4f4c8b1455 add initial support for Builtin cast instructions, patch #1/2.
Swift SVN r1433
2012-04-14 00:56:35 +00:00
Chris Lattner
868eccff76 implement a new Builtin.gep operation which maps to the LLVM Getelementptr instruction,
used for pointer offseting.  We can figure out inbounds later.  This is to be used by
UnsafePointerInt


Swift SVN r1429
2012-04-13 23:10:42 +00:00
Eli Friedman
361481835c Introduce a notion of module scope declarations; use it where appropriate instead of checking for a local declcontext.
Swift SVN r1380
2012-04-11 02:52:40 +00:00
Chris Lattner
65b400e30d introduce a new "Builtin.RawPointer" type, which corresponds to LLVM's "i8*" type,
and is just an unmanaged pointer.  Also, introduce a basic swift.string type.

This is progress towards rdar://10923403 and strings.  Review welcome.



Swift SVN r1349
2012-04-10 00:52:52 +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
b2a2027a43 Revert r1144, r1145, and r1146. These changes (which removed ParenType
in favor of a single-element non-canonical TupleType) broke the type
system, in that supposed sugar (the TupleType) supported a different
set of operations from the canonical type.  For example, a
single-element unlabelled tuple type supports elementwise projection
(foo.$0), but the underlying element does not (or supports it
differently).

The IR-gen failure was due to a very related problem:  IR-gen
was not updated to reflect that a single unlabelled tuple element
is the same type as its element type, and therefore it was giving
different representations to these types ({ %foo } and %foo,
respectively), which broke widespread assumptions.

The removal of ParenType was done in pursuit of an AST invariant
that's not actually particularly interesting in the first place
and which, furthermore, is problematic to attain.

Swift SVN r1182
2012-03-11 09:15:21 +00:00
Chris Lattner
2d7babaf43 clean up some stuff around function argument types.
Swift SVN r1148
2012-03-02 00:25:31 +00:00
Chris Lattner
d3d724cab9 rename Builtin.int -> Builtin.Int
Swift SVN r1133
2012-03-01 17:48:38 +00:00
Chris Lattner
81ed1061eb change the builtin fp types to be FPIEEE32 instead of FP_IEEE32. They're completely private and this simplifies buildin processing, which wants to use _ for overloading.
Swift SVN r1122
2012-02-26 16:55:19 +00:00
Chris Lattner
1d6d89af1d implement support for overloaded builtins with floating point operands.
Use that to implement operator* for doubles in swift.swift, remove the implementation
from stdlib.cpp.


Swift SVN r1121
2012-02-26 16:53:24 +00:00
John McCall
4477b90156 Require creators of initialized TupleTypeElts to provide
both of the semantically-important fields.  Make the
default constructor trivial, or at least closer to trivial.
Provide a space in TupleTypeElt for the parser to drop in
the ArgDecl corresponding to this element.



Swift SVN r1068
2012-01-18 06:54:53 +00:00
Chris Lattner
19b7a934a1 rename BuiltinFloatingPointType to BuiltinFloatType.
Swift SVN r980
2011-12-23 00:07:58 +00:00
Chris Lattner
c91c1d9db1 generalize builtin floating point types to support all of the FP types
that LLVM supports.  The standard library still only exports float and double,
but the swift core should be more general.  Yay for PPC128 :)


Swift SVN r973
2011-12-22 22:01:07 +00:00
Chris Lattner
33f784d48e zap some #if 0 code accidentally left in
Swift SVN r970
2011-12-22 07:45:45 +00:00
Chris Lattner
d525ba5fda simplify builtin type processing by eliminating BuiltinTypeKind.
Swift SVN r967
2011-12-22 07:38:17 +00:00
Chris Lattner
6a51dbba34 Remove hard coded list of integer types from ASTContext, making BuiltinIntegerType have a "plus" factory method to create them like other types.
Swift SVN r966
2011-12-22 07:07:01 +00:00
Chris Lattner
17b11e9bbd implement parsing, AST, and LangRef support for 'plus' methods. Dot syntax will need some work though to actually use them.
Swift SVN r949
2011-12-21 23:21:58 +00:00
John McCall
a1f7eefba3 Extract out decl attributes into a separately-allocated structure.
Swift SVN r920
2011-12-10 00:39:10 +00:00
Chris Lattner
0ca79b1075 rename ASTContext::BuiltinModule -> TheBuiltinModule for consistency with
the other ASTContext members.


Swift SVN r799
2011-11-01 04:18:23 +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
8e369b34da make builtins.cpp include its header first (exposing that it isn't actually self-contained),
and switch to AST.h


Swift SVN r699
2011-09-09 04:58:39 +00:00
John McCall
37b07c8691 Add builtin bindings for a bunch of primitive LLVM instructions.
Swift SVN r698
2011-09-08 00:21:11 +00:00