Commit Graph

1207 Commits

Author SHA1 Message Date
Erik Eckstein
31dd17a49f Add array.uninitialized semantics to ArrayCallKind, ArraySemanticsCall and the docs.
For completeness. NFC.



Swift SVN r23955
2014-12-16 13:28:18 +00:00
Dave Abrahams
65a7108ccf [proposal] In-place operations update
Changes from previous version:

* Support classes
* Support protocols and generics
* Make the obvious extensions to cover assignment operator pairs

Swift SVN r23954
2014-12-16 06:51:44 +00:00
Dmitri Hrybenko
b15c4db750 Document stdlib's @testable and SPI(X) comments
Swift SVN r23930
2014-12-15 03:36:00 +00:00
Chris Lattner
74bd5e2b42 fix "title underline too short" build failures.
Swift SVN r23911
2014-12-13 06:27:58 +00:00
John McCall
169e4fe319 Add Builtin.UnsafeValueBuffer, which provides opaque
storage for arbitrary values.

A buffer doesn't provide any way to identify the type of
value it stores, and so it cannot be copied, moved, or
destroyed independently; thus it's not available as a
first-class type in Swift, which is why I've labelled
it Unsafe.  But it does allow an efficient means of
opaquely preserving information between two cooperating
functions.  This will be useful for the adjustments I
need to make to materializeForSet to support safe
addressors.

I considered making this a SIL type category instead,
like $@value_buffer T.  This is an attractive idea because
it's generally better-typed.  The disadvantages are that:
- it would need its own address_to_pointer equivalents and
- alloc_stack doesn't know what type will be stored in
  any particular buffer, so there still needs to be
  something opaque.

This representation is a bit gross, but it'll do.

Swift SVN r23903
2014-12-13 01:27:12 +00:00
Joe Groff
2e5faa7c79 Ramble about KVO2-related stuff
Swift SVN r23891
2014-12-12 19:19:30 +00:00
Chris Lattner
b85e5df770 change the SIL mangling of @in_guaranteed to be 'G' at John's request.
Swift SVN r23870
2014-12-11 22:27:27 +00:00
Chris Lattner
af1ea0b8f1 document @in_guaranteed.
Swift SVN r23868
2014-12-11 21:16:27 +00:00
Erik Eckstein
3b9805b246 Disallow cond_br with identical destinations.
It avoids generation of llvm phi nodes with identical predecessors and differing values.
This change replaces my previous fix of this problem in r23580, where I handled it in IRGen.

There were some discussions about it with the conclusion that it's better to just disallow such cond_br instructions in SIL.
It makes the life easier for some SIL optimizations which can't deal with cond_br with identical destinations.

The original radar is <rdar://problem/18568272> Swift compiler fails with "PHI node has multiple entries for the same basic block with different incoming values!"



Swift SVN r23861
2014-12-11 15:03:49 +00:00
Michael Gottesman
1e63e0e22d [mangle] Add support for mangling dead, owned2guaranteed, and sroa args. Wire up function sig opts.
Now all SIL function specialization passes use the new mangling infrastructure.
Lets keep it that way for future passes as well. = ).

Implements:
<rdar://problem/18831609>

Fixes:
<rdar://problem/19065735>
<rdar://problem/18906781>
<rdar://problem/18956916>

Swift SVN r23859
2014-12-11 05:51:26 +00:00
Michael Gottesman
185d9aaafd [mangle] Add support for mangling constant propagated specializations and wire CapturePropagation to use it.
I also fixed a few bugs in the mangling that this exposed.

Swift SVN r23858
2014-12-11 03:22:07 +00:00
Michael Gottesman
5e11e9aa81 Remove extra '_' that snuck in.
Swift SVN r23818
2014-12-09 23:40:04 +00:00
Michael Gottesman
355f791621 [mangle] Add support for function signature specialization mangling and teach closure specialization how to use it.
Swift SVN r23816
2014-12-09 23:21:08 +00:00
Michael Gottesman
2a119d4e0e [mangle] Update ABI.rst to reflect shortened specialization kind.
I forgot to update this when I changed the specialization kind from _generic => _g.

Swift SVN r23802
2014-12-09 03:00:32 +00:00
Michael Gottesman
4d48d2aaae [mangle] Add initial code for SIL specializations manglings and refactor Generic Specialization mangling code to there from the pass itself.
This is apart of creating the infrastructure for creating special manglings for
all of the passes that we specialize. The main motiviations for this
infrastructure is:

1. Create an easy method with examples on how to create these manglings.
2. Support multiple specializations. This is important once we allow for partial
specialization and can already occur if we perform function signature
optimizations on specialized functions.

The overall scheme is as follows:

_TTS<MANGLINGINFO>__<FUNCNAME>

Thus if we specialize twice, the first specialization will just be treated as
the function name for the second specialization.

<MANGLINGINFO> is defined as:

_<SPECIALIZATIONKINDID>_<SPECIALIZATIONUNIQUEINFO>

Where specialization kind is an enum that specifies the specific sort of
specialization we are performing and specialization unique info is enough
information to ensure that the identity of the function is appropriately
preserved.

Swift SVN r23801
2014-12-09 02:53:05 +00:00
Joe Groff
755e629c65 Update description of existential container layout in ABI.rst.
Swift SVN r23795
2014-12-08 23:54:45 +00:00
Doug Gregor
5119580d5c Fix broken reST in SIL document.
Swift SVN r23726
2014-12-05 05:28:15 +00:00
John McCall
dd07c8ca10 Add 'mark_dependence', which indicates that an address
or pointer depends on another for validity in a
non-obvious way.

Also, document some basic value-propagation rules
based roughly on the optimization rules for ARC.

Swift SVN r23695
2014-12-04 22:38:09 +00:00
Arnold Schwaighofer
404ce8c599 ArraySemantics: Add support for the upcoming array.props semantic calls
"array.props.isCocoa/needsElementTypeCheck" semantic calls will mark calls that
return array properties: isCocoa and needsElementTypeCheck. We know that said
states can only transfer in certain directions (a native swift array that does
not need an element type check stays in this state) enabling us to version loops
based on the state of said array array properties.

rdar://17955309

Swift SVN r23688
2014-12-04 19:24:39 +00:00
Mark Lacey
1b2d617157 Fix typo.
Swift SVN r23644
2014-12-03 06:08:04 +00:00
Dave Abrahams
d63e8e02d4 [proposal] Inplace.rst fixup
s/let/var/

Swift SVN r23617
2014-12-02 18:10:02 +00:00
Dave Abrahams
747c279bb3 [proposal] Rewrite Inplace.rst
The basic proposal is newly-relevant; this is a first revision to
prepare it for discussion.

Swift SVN r23614
2014-12-02 17:34:58 +00:00
Erik Eckstein
8c715aa04a docs: diagram of current Array implementation in stdlib.
(Not yet embedded in the Array doc)



Swift SVN r23592
2014-12-01 11:21:33 +00:00
David Farler
3c4428dd78 Emit unique metadata for functions with inout
References to functions that take inout parameters crash the compiler
because InOutType isn't a "real" type in itself and has no special type
metadata to emit. It merely further qualifies the function's input
types.

For example, we would like to have a unique entry in the cache for:

var f: (T, T) -> ()

and

var f2: (inout T, T) -> ()

For each argument type metadata pointer in the function's input, take
advantage of pointer alignment and mark the lowest bit if it is inout.
Since the metadata cache uses pointers to create the key, this creates a
unique entry while still being able to extract the actual pointer.

This fixes <rdar://problem/17655125>, and a couple of other similar
crashes.

Swift SVN r23557
2014-11-22 22:01:23 +00:00
John McCall
3cd28b9e62 Document the rules for formal accesses to ? and ! l-values.
! is obvious, but ? raises a more fundamental difficulty.

Swift SVN r23491
2014-11-20 23:01:13 +00:00
Chris Willmore
0867e2e59b [docs] Fix linked list definition in Generics.rst
Swift SVN r23471
2014-11-20 05:22:19 +00:00
Jordan Rose
0606251fc4 [docs] Use the same theme as our internal docs.
In particular, this uses normal HTML bullets instead of images so that
rich text copy/paste works correctly.

Swift SVN r23376
2014-11-17 19:42:00 +00:00
Dave Abrahams
e455dec9fa Accessors: various ReST fixups
Swift SVN r23349
2014-11-15 02:13:11 +00:00
Andrew Trick
70fe4a3065 Accessors.rst:879: ERROR: Unexpected indentation.
Swift SVN r23347
2014-11-15 01:10:28 +00:00
John McCall
26b7dd190a Edits to the accessor proposal in response to Dave's feedback.
The main change here is a total restructuring of the
unspecified behavior rule.  (Note that the rule has not
changed; I'm simply specifying it differently, hopefully
better.)

I still owe some examples for the unspecified behavior rule.

Swift SVN r23344
2014-11-15 00:50:37 +00:00
Andrew Trick
06bfed16f6 Make Accessors doc an orphan so it doesn't break my build.
Swift SVN r23343
2014-11-15 00:37:36 +00:00
John McCall
ca59995032 The most recent accessors proposal, with a few editorial
changes that Dave pointed out.

Swift SVN r23338
2014-11-14 22:32:46 +00:00
Dmitri Hrybenko
e2b974d3d6 docs: fix ReST warnings
Swift SVN r23051
2014-11-01 00:51:34 +00:00
Roman Levenstein
c8d180e660 Generalize the switch_int instruction into switch_value instruction, which may switch on arguments of builtin integer types or function types. The later is required for implementing a more efficient speculative devirtualizaiton implementation. Implement lowering of switch_value into LLVM code. In case of integer operands, it reuses LLVM's switch optimizations. Support for switching on function types is not yet bullet-proof and will be refined in the subsequent patches.
rdar://18508812

Swift SVN r23042
2014-10-31 22:55:56 +00:00
Roman Levenstein
f016754ef9 Add a new select_value instruction. This instruction should be the equivalent of select_enum, just for builtin int types. Such an instruction is needed e.g. to efficiently implement conversions of Int raw values to C-like enums.
rdar://18812325

Swift SVN r23036
2014-10-31 20:44:11 +00:00
Joe Groff
bf3ddb4c59 SIL.rst: Fix up some omissions in the calling convention section.
Explain how @cc(witness_method) is different from @cc(method), and fix a typo.

Swift SVN r23021
2014-10-30 22:04:24 +00:00
Joe Groff
7bbf6daf3d SIL.rst: Document instructions added for working with BridgeObject.
Swift SVN r23020
2014-10-30 21:50:03 +00:00
Joe Groff
24570fecc9 De-intrinsify and remove the _does*OptionalHaveValue functions.
Swift SVN r22955
2014-10-26 22:34:31 +00:00
Joe Groff
5266a0da17 Fix documented nominal type descriptor offsets in ABI.rst.
Swift SVN r22901
2014-10-23 22:39:08 +00:00
Joe Groff
f761fc03e6 IRGen/Runtime: Put a reference to the metadata pattern in the nominal type descriptor.
We want to use the reserved space in the metadata pattern for protocol conformance caching, and this link lets us find the metadata pattern from an instance of the generic type.

Swift SVN r22898
2014-10-23 21:33:38 +00:00
Dave Abrahams
8b9772d64e Revert "De-intrinsify and remove the _does*OptionalHaveValue functions."
This reverts commit r22829, because reverting r22828 depends on it.
Reverting r22828 because it
was apparently causing an assertion on the bot:

Swift SVN r22830
2014-10-19 19:54:34 +00:00
Joe Groff
7a24c85ed8 De-intrinsify and remove the _does*OptionalHaveValue functions.
Swift SVN r22829
2014-10-19 00:08:30 +00:00
Joe Groff
3f23b82e6d SIL: Rename SILGlobalAddr to GlobalAddr.
All globals are SIL globals now.

Swift SVN r22827
2014-10-18 17:08:28 +00:00
Arnold Schwaighofer
329fa51d3f Reapply "Verifier: Cannonical SIL should have split critical edges for non cond_br
terminators"

This is an assumption that the SSAUpdater makes. Verify that we preserve this
property.

With changes to the test cases, SIL documentation and add a critical edge (non
cond_br only) splitting pass to the mandatory pipeline.

This reapplies commit 22775.

Swift SVN r22803
2014-10-16 21:16:24 +00:00
Joe Groff
ea65d1e60b SIL: Remove the builtin_function_ref instruction.
Swift SVN r22797
2014-10-16 16:18:40 +00:00
Joe Groff
bb46f4bbd9 SIL: Remove the global_addr instruction.
It's no longer needed now that we always lower to SIL globals.

Swift SVN r22693
2014-10-12 17:19:06 +00:00
Joe Groff
9205bf64cf SIL: Remove enum_is_tag.
Swift SVN r22616
2014-10-09 05:03:43 +00:00
Joe Groff
ca8b168188 SIL: Add select_enum and select_enum_addr insns.
Similar to LLVM's "select" instruction, the instruction picks one of its operands based on the case tag of an enum value.

Swift SVN r22578
2014-10-07 21:45:08 +00:00
Joe Groff
949e0b0741 Drop the @sil_self attribute.
We no longer need to abuse Self archetypes to represent values inside existential containers.

Swift SVN r22487
2014-10-03 03:09:45 +00:00
Arnold Schwaighofer
c1eefb1dad Reapply "stdlib: Remove dead semantic Array._setElement function
Also remove helper functions."

With fixes.

Swift SVN r22479
2014-10-02 20:26:32 +00:00