Commit Graph

4421 Commits

Author SHA1 Message Date
Michael Gottesman
1696b0fedf Added code for building swift doxygen documentation.
The doxygen.cfg.in file is based on the clang doxygen.cfg.in file with suitable
name changes.

Swift SVN r7556
2013-08-24 09:02:45 +00:00
Joe Groff
6385b60f72 ABI.rst: Clarify 'bit size' to 'storage size in bits'.
Swift SVN r7540
2013-08-23 23:09:21 +00:00
Chris Lattner
d4a0c16baa revert my r7505 patch to 'assign'. It turns out that changing
assign in this way doesn't actually make things simpler, and the
former model for assign is simpler to work with.


Swift SVN r7537
2013-08-23 22:40:56 +00:00
Joe Groff
af2603fb49 Add a section to ABI.rst describing union layout.
Swift SVN r7532
2013-08-23 22:03:38 +00:00
Joe Groff
2d8a16331d Update union discussion in LangRef and add a section on union element patterns.
Swift SVN r7519
2013-08-23 19:36:52 +00:00
Chris Lattner
f6a5c78df2 Per John's advice (a few weeks ago), rework the 'assign' instruction
to being a semantic assign.  The functional difference here is only
for unowned pointers, where now the conversion from strong to unowned 
is implicit in the assign.

The logic behind this is that 'assign' is really part of SILGen, that
is only moved later to make it easier to make it be flow sensitive.
Since it is part of SILGen and will be using some of the type lowering
functionality used by SILGen, we should play by its rules.

No functionality change.


Swift SVN r7507
2013-08-23 18:15:21 +00:00
Joe Groff
80bec3d955 Give swift.Option a standard mangling substitution.
Swift SVN r7455
2013-08-22 17:36:58 +00:00
John McCall
329a5e47db Permit attribute lists to be split into multiple clauses.
This is particularly convenient for dealing with generated
code (e.g. as produced by the SIL printer), but it's also
quite defensible as a way for users to logically group
related attributes and split unrelated ones out, should
users find themselves using a lot of verbose attributes
(and prior experience with e.g. user-defined attributes
is that they definitely do sometimes turn into walls of
text...).

Swift SVN r7376
2013-08-20 22:37:38 +00:00
Joe Groff
0cf7dc8dbe Update syntax in Pattern Matching doc.
Swift SVN r7364
2013-08-20 17:08:18 +00:00
Chris Lattner
b2e75c5d07 add a readme to proposals. Remove PublicNSStringAPIs.html (it looks
like a collection of someone's random notes) and move NSString.rst to
proposals (also a collection of notes).


Swift SVN r7360
2013-08-20 05:41:53 +00:00
Chris Lattner
21e63ae8c2 actually, just remove the "simple user defined datatypes" stuff. The pattern matching
description subsumes most of it.  It was amusing that I thought (back in the day) as
structs as a special case of unions, but this isn't pertinent any more.

Rename the expressions.rst file.  It does have some useful stuff, but it should be merged
into other docs at some point.


Swift SVN r7359
2013-08-20 05:36:42 +00:00
Chris Lattner
80d7edb4c3 remove "Memory and Ownership Model" which is really really really old, out
of date, and not useful anymore.

Update some of the "simple user defined datatypes" stuff and remove some 
obsolete parts.



Swift SVN r7358
2013-08-20 05:35:01 +00:00
Chris Lattner
91ccedcbaa remove an old spreadsheet that has lost its utility and move another proposal out.
Swift SVN r7357
2013-08-20 05:28:22 +00:00
Chris Lattner
7bcd9ff49f move a bunch of proposals out to a new proposals subdir to avoid confusion of what is planned for swift and what is just blue sky concepts.
Swift SVN r7356
2013-08-20 05:26:16 +00:00
Jordan Rose
6f5d463d18 LangRef: include "T?" syntax.
This documents the current state of affairs, where "Int?[]" is allowed but
"Int[]?" is not. I'll update this again if/when we reach a new decision.

Swift SVN r7269
2013-08-15 18:59:06 +00:00
Dave Abrahams
03cd1b91a7 [stdlib] TextFormatting.*: formatForDebugging => debugFormat
Now that we don't have formatForPrinting anymore, a terser name for
debugFormat makes more sense.  Also, the new name isn't freighted with
so much implication about the end-user's activity.

Swift SVN r7256
2013-08-15 16:16:03 +00:00
Dave Abrahams
c72f07f867 [stdlib] TextFormatting.*: formatForPrinting => format
Jordan pointed out that we already have these multi-parameter
format(...)  functions that also return Streamables; it doesn't make
much sense to spell them differently.

Swift SVN r7255
2013-08-15 16:13:36 +00:00
Dmitri Hrybenko
19298233af Update grammar for stmt-for-c-style: add optional parentheses
Swift SVN r7253
2013-08-15 01:59:08 +00:00
Joe Groff
a94489473c IRGen: Add ValueWitness enumerators for union layout and access.
These value witness table entries will be conditionally available for types that support specialized union representation through extra inhabitants and/or spare bits and for union value witnesses:

- storeExtraInhabitant, to store an extra inhabitant representation;
- getExtraInhabitantIndex, to recognize an extra inhabitant representation;
- getUnionTag, to get a union's discriminator; and
- inplaceProjectUnionData, to extract the value in place from a union.

This just sets up the enumerators and related IR types and mangling; nothing emits these witnesses yet.

Swift SVN r7234
2013-08-14 21:01:21 +00:00
Joe Groff
fcbefd0c38 SIL: Don't allow switch_union to work with address-only unions.
In designing the runtime model for generic unions with John, we decided we're going to need very different SIL semantics for destructuring address-only unions, so I don't think trying to stretch switch_union to cover all unions makes any sense anymore.

Swift SVN r7225
2013-08-14 02:56:05 +00:00
John McCall
6794921f1d Describe operations on [weak] and [unowned] values.
Swift SVN r7221
2013-08-14 00:56:16 +00:00
John McCall
ab7d9e024a Describe local-storage types and the changes to alloc_stack.
Swift SVN r7220
2013-08-14 00:56:14 +00:00
Dave Abrahams
128e69d934 [docs] Revise TextFormatting.* to reflect posted proposal
Swift SVN r7178
2013-08-12 21:13:03 +00:00
Dave Abrahams
acc96c56a2 [docs] Rename "printf.*" documentation as "TextFormatting.*"
We are proposing to remove printf; remove latent references to it

Swift SVN r7176
2013-08-12 21:13:00 +00:00
Doug Gregor
f4e9c17032 [Constraint solver] Eliminate rvalue equality constraints.
We were only using these constraints in one place, where they had no
value.


Swift SVN r7166
2013-08-12 18:00:55 +00:00
Chris Lattner
c8f01a0bf3 Introduce a new SIL "assign" instruction to represent assignments in SIL when
SILGen doesn't know whether they are initializations or stores.


Swift SVN r7146
2013-08-12 14:24:52 +00:00
Jordan Rose
35f84dfbee Remove "import foo, bar" syntax.
We never really discussed this and it doesn't really buy us much. If we
want to have a compact way to import many things, it may not even end
up looking like this.

Swift SVN r7015
2013-08-07 22:56:58 +00:00
John McCall
e9b913fb5b Remove LocalStorageType, make it a kind of SILType.
Swift SVN r6968
2013-08-07 00:22:26 +00:00
John McCall
36aa6c2645 alloc_stack needs to return two values like alloc_box.
The current implementation of dealloc_stack in IR-gen is a
no-op, but that's very much wrong for types with non-trivial
local allocation requirements, e.g. archetypes.  So we need
to be able to do non-trivial code here.  However, that means
modeling both the buffer pointer and the allocated address
in SIL.

To make this more type-safe, introduce a SIL-specific
'[local_storage] T' type that represents the required
allocation for locally storing a T.  alloc_stack now returns
one of those in additon to a *T, and dealloc_stack expects
the former.

IR-gen still implements dealloc_stack as a no-op, but
that's now easy to fix.

Swift SVN r6937
2013-08-06 07:31:41 +00:00
Ted Kremenek
4a211bcb9a Change docs version to "1.0" to match "Swift 1.0". Copyright is also to Apple.
Swift SVN r6934
2013-08-06 06:08:54 +00:00
Doug Gregor
135ca5abcd Introduce some discussion of locators, as used in the type checker.
Swift SVN r6933
2013-08-06 05:17:06 +00:00
John McCall
268a947044 Update the SIL docs for dealloc_box.
Swift SVN r6932
2013-08-06 01:31:21 +00:00
Joe Groff
4316239f5d Kill Builtin.OpaquePointer.
It's not needed by SIL anymore.

Swift SVN r6873
2013-08-03 01:56:06 +00:00
Joe Groff
5a2128bc77 SIL: Model project_existential using an address.
Have project_existential return $*This instead of $Builtin.OpaquePointer, and have protocol_method do the same for methods of opaque protocols. This makes it easier for passes to reason about the semantics of the projected address, since it's restricted by the semantics of SIL addresses.

Swift SVN r6872
2013-08-03 01:48:15 +00:00
Joe Groff
3503ffe4fa IRGen: Set up LinkEntities for protocol witness tables.
We need to handle three cases:

- If a protocol conformance has no associated types, or the associated type witnesses all have statically resolvable metadata, we can expose a *direct* witness table symbol.
- If a protocol conformance has associated types with runtime-instantiated metadata, we need to gate the witness table behind a *lazy* initializer function to fill in the metadata fields.
- If a protocol conformance has associated types where the type or one of its conformances are *dependent* on its parent's generic parameters, we need to instantiate multiple witness tables at runtime.

Swift SVN r6805
2013-08-01 05:25:32 +00:00
Joe Groff
ba774364f1 SIL: Have SILModules track their SILStage.
Modules can be in either 'Raw' or 'Canonical' form, with different invariants on each. We don't actually distinguish those invariants yet, but this patch adds the field to SILModule and adds a "sil_stage" declaration to SIL printer/parser syntax.

Swift SVN r6793
2013-08-01 00:58:31 +00:00
Jordan Rose
757cf9826f Add Parse and AST support for the new import syntax.
Also, update LangRef.

Note that an explicit "import module" has been left out for now, since
it's not strictly necessary and "module" isn't a keyword yet.

Swift SVN r6786
2013-07-31 23:23:26 +00:00
Jordan Rose
43e9cd7bb4 LangRef: Update union grammar and code examples.
Note: the new grammar allows the multiple-case syntax "case A, B".
This is <rdar://problem/14595749>.

Swift SVN r6784
2013-07-31 21:33:46 +00:00
Jordan Rose
674a03b085 Replace "oneof" with "union"...everywhere.
We haven't fully updated references to union cases, and enums still are not
their own thing yet, but "oneof" is gone. Long live "union"!

Swift SVN r6783
2013-07-31 21:33:33 +00:00
Joe Groff
3727c550ff Import.rst: Fix a couple of typos.
Swift SVN r6781
2013-07-31 20:55:25 +00:00
Joe Groff
09cdd40c77 Revise import design per 2013-07-30 meeting.
Swift SVN r6769
2013-07-31 01:03:38 +00:00
Joe Groff
26c00fd429 SIL: Add a switch_int instruction.
This will help represent cleanup blocks in the grown-up Clang way instead of the childish SILGen way, e.g.:

  retain %x
  retain %y
  ...
break_branch:
  %1 = int_literal 1 : $Builtin.Int64
  br cleanup(%1)
return_branch:
  %2 = int_literal 2 : $Builtin.Int64
  br cleanup(%2)
cleanup(%dest : $Builtin.Int64):
  release %z
  release %y
  switch %dest, case 1: break_dest, case 2: return_dest

Swift SVN r6753
2013-07-30 21:32:23 +00:00
Adrian Prantl
5b5ba6d78a Name mangling: Add a "_Tt" prefix to all type names that are output in
the debug info, to aid the debugger in figuring out the implementation
language of a given type in multi-language environments.
FYI, where applicable, we also emit the
DW_AT_APPLE_runtime_class(DW_AT_lang_Swift) attribute.
The demangler accepts type names with the "_Tt" prefix without the --type
switch.

Swift SVN r6714
2013-07-29 22:03:15 +00:00
Anna Zaks
fd52b193ec [SIL.rst] Minor edit to the Intro.
Swift SVN r6712
2013-07-29 21:55:04 +00:00
Doug Gregor
0842fb5cf8 Rename "base class" to "superclass" and "derived class" to "subclass".
Standardize on the more-common "superclass" and "subclass" terminology
throughout the compiler, rather than the odd mix of base/derived and
super/sub. 

Also, have ClassDecl only store the Type of the superclass. Location
information will be part of the inheritance clause for parsed classes.




Swift SVN r6687
2013-07-29 15:48:34 +00:00
Joe Groff
69d3392191 Accept underscore separators in numeric literals.
This makes long literals like 1_000_000_000 or 0x7FFF_FFFF_FFFF_FFFF much easier to read, and has precedent in Perl, OCaml, Python, Ruby, Rust, ... Fixes <rdar://problem/14247571>.

Swift SVN r6681
2013-07-28 18:56:30 +00:00
Joe Groff
3e6092db80 SIL.rst: Fill in details about how function context is consumed.
Swift SVN r6678
2013-07-27 17:03:15 +00:00
Joe Groff
24dc1cfad7 SIL: Remove the redundant associated_metatype instruction.
Its behavior was exactly the same in IRGen as 'metatype' on the associated type. Managing type metadata should be IRGen's job.

Swift SVN r6677
2013-07-27 04:13:59 +00:00
Joe Groff
1300efb8fb SIL: Represent float_literal values with bitwise representations.
This way we don't need to deal with the inaccuracy of decimal float literals. While we're here, modify the in-memory representation of IntegerLiteralInst and FloatLiteralInst to save the word array of the APInt instead of round-tripping through plain text.

Swift SVN r6676
2013-07-27 03:57:14 +00:00
Anna Zaks
abf9c1f99a [SIL.rst] Document an extra check we now perform on noreturn.
Swift SVN r6668
2013-07-27 00:30:11 +00:00