Commit Graph

490 Commits

Author SHA1 Message Date
Emanuel Zephir
c20f6a58ad [SIL] Documentation fixes
The following changes remove obsolete constructs:
ObjectPointer becomes NativeObject
ObjcPointer becomes UnknownObject
SomeType.metatype becomes SomeType.Type

Additionally, all enumerator element references in example code have been
updated to use the  'enumelt' sub-reference.
2015-12-21 18:08:19 -08:00
Emanuel Zephir
586a66c243 [SIL] Update generic apply and partial_apply docs
Updates the documentation for the generic versions of apply and partial_apply.
These functions take a simple list of types to substitute instead of the
A = T syntax previously listed in the documentation.
2015-12-21 15:54:36 -08:00
Max Moiseev
2f7b64e475 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-21 12:02:13 -08:00
Erik Eckstein
3080fb4b5c fix doc build error 2015-12-18 22:26:45 -08:00
Emanuel Zephir
e3c4b6f7ec [SIL] Update docs to always use '@convention'
Updates the SIL documentation to use the @convention attribute on function
types. The @thin and @cc attributes are obsolete and result in errors when
used in SIL code.
2015-12-18 17:25:05 -08:00
Doug Gregor
a97ab6dd14 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-18 10:15:47 -08:00
zerotypos-found
0c1df3577e Fix typo: a --> an, an --> a. 2015-12-17 15:10:25 +09:00
Doug Gregor
1ba7b5d98d Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-15 16:01:48 -08:00
Benedikt Terhechte
bf70742353 Fixed typos and what seems like bugs
I changed a couple of SIL code blocks which seemed to be wrong. Since my knowledge here is rather limited I doublechecked my changes by generating SIL from example swift files to see if it matches.
2015-12-15 21:47:01 +01:00
Max Moiseev
806be29941 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-14 12:05:35 -08:00
Adrian Prantl
64cbec3805 Add SIL syntax for declaring debug variables.
Debug variable info may be attached to debug_value, debug_value_addr,
alloc_box, and alloc_stack instructions.

In order to write textual SIL -> SIL testcases that exercise the handling
of debug information by SIL passes, we need to make a couple of additions
to the textual SIL language. In memory, the debug information attached to
SIL instructions references information from the AST. If we want to create
debug info from parsing a textual .sil file, these bits need to be made
explicit.

Performance Notes: This is memory neutral for compilations from Swift
source code, because the variable name is still stored in the AST. For
compilations from textual source the variable name is stored in tail-
allocated memory following the SIL instruction that introduces the
variable.

<rdar://problem/22707128>
2015-12-14 10:29:50 -08:00
Max Moiseev
d610fa0d1c Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-10 10:29:52 -08:00
Dmitri Gribenko
feacbc4433 Rename ErrorType to ErrorProtocol 2015-12-09 17:12:19 -08:00
John McCall
5fddd4a704 Remove the autorelease_return and strong_retain_autoreleased instructions.
There's a buggy SIL verifier check that was previously tautological,
and it turns out that it's violated, apparently harmlessly.  Since it
was already doing nothing, I've commented it out temporarily while
I figure out the right way to fix SILGen to get the invariant right.
2015-12-09 14:50:20 -08:00
Joe Groff
307828169d SIL.rst: Describe @inout_aliasable arg semantics
and clarify `@inout`.
2015-12-08 14:35:48 -08:00
Kanstantsin Linou
41d4c0c67e Fix typo in SIL.rst
'funtion' -> 'function'
2015-12-06 23:34:02 +03:00
codester
745a088b75 Fixed Typo 2015-12-04 00:25:41 +05:30
Umberto Raimondi
cf97f2ec28 A few minor typos in SIL.rst 2015-12-03 19:28:55 +01:00
Erik Eckstein
7cdea978eb docs: fix description of select_enum_addr 2015-12-02 13:20:29 -08:00
Erik Eckstein
ee988e21cb SIL: Add stack attributes to alloc_ref and dealloc_ref.
For details see docs/SIL.rst.
This is needed for the stack promotion optimization.



Swift SVN r32908
2015-10-27 15:29:20 +00:00
Slava Pestov
7cc59e01d7 SIL: Add DeallocPartialRefInst
This instruction destroys instance variables in a partially-initialized
object, then frees it.

Swift SVN r32661
2015-10-13 19:56:20 +00:00
Slava Pestov
090d723763 SIL: Remove null_class instruction
Swift SVN r32605
2015-10-11 02:11:22 +00:00
Andrew Trick
c20370a664 Remove the last remnants of unchecked_ref_bit_cast
Swift SVN r32598
2015-10-10 05:42:57 +00:00
Andrew Trick
665e5169d5 Add unchecked_ref_cast_addr SIL instruction.
Swift SVN r32587
2015-10-10 03:39:32 +00:00
Joe Groff
0cd5aa8c7c Change mangling for the Swift module from 'Ss' to 's'.
'Ss' appears in manglings tens of thousands of times in the standard library and is also incredibly frequent in other modules. This alone is enough to shrink the standard library by 59KB.

Swift SVN r32409
2015-10-02 22:39:44 +00:00
Erik Eckstein
2f2c7d571d Verify that a SILFunction has not multiple throw instructions.
...and document it.



Swift SVN r31351
2015-08-19 21:47:09 +00:00
Ben Langmuir
b38067ba97 Revert "Teach SILPrinter/Parser how to parse the conformances associated with an init_existential_metatype."
This broke some validation tests.

This reverts commit r31277.

Swift SVN r31282
2015-08-17 23:55:07 +00:00
Michael Gottesman
b1f336b0cf Teach SILPrinter/Parser how to parse the conformances associated with an init_existential_metatype.
Now we can IRGen Richards.sil produced via a *.sib file.

rdar://22302277

Swift SVN r31277
2015-08-17 21:05:53 +00:00
Erik Eckstein
388bc31ba7 Add a nothrow flag to the SIL apply_inst.
If the compiler can prove that a throwing function actually does not throw it can
replace a try_apply with an "apply [nothrow]". Such an apply_inst calls a function
with an error result but does not have the overhead of checking for the error case.

Currently this flag is not set, yet.



Swift SVN r31151
2015-08-12 00:18:36 +00:00
Michael Gottesman
c197c627ad Add some missing instructions to SIL.rst and order it more along the lines of SILNodes.def.
Swift SVN r31007
2015-08-04 21:12:59 +00:00
Joe Groff
767e1ff6b3 Update SIL.rst to discuss @box types.
Swift SVN r29773
2015-06-28 17:36:30 +00:00
Andrew Trick
a32a0af02b Allow unchecked_trivial_bit_cast to cast to smaller types.
I'm sure this is totally safe, why wouldn't it be?

Fixes <rdar://problem/21095584> Swift: UnsafePointer on tuple works in
debug but compiles crashing binary in release

Swift SVN r29614
2015-06-24 20:25:15 +00:00
Andrew Trick
7565a65235 Introduce unchecked_bitwise_cast SIL instruction.
We need a SIL level unsafe cast that supports arbitrary usage of
UnsafePointer, generalizes Builtin.reinterpretCast, and has the same
semantics on generic vs. nongeneric code. In other words, we need to
be able to promote the cast of an address type to the cast of an
object type without changing semantics, and that cast needs to support
types that are not layout identical.

This patch introduces an unchecked_bitwise_cast instruction for that
purpose. It is different from unsafe_addr_cast, which has been our
fall-back "unknown" cast in the past. With unchecked_bitwise_cast we
cannot assume layout or RC identity. The cast implies a store and
reload of the value to obtain the low order bytes. I know that
bit_cast is just an abbreviation for bitwise_cast, but we use
"bitcast" throught to imply copying a same sized value. No one could
come up with a better name for copying an objects low bytes via:

  @addr = alloca $wideTy
    store @addr, $wideTy
      load  @addr, $narrowTy

Followup patches will optimize unchecked_bitwise_cast into more
semantically useful unchecked casts when enough type information is
present. This way, the optimizer will rarely need to be taught about
the bitwise case.

Swift SVN r29510
2015-06-19 16:29:35 +00:00
Dmitri Hrybenko
23d474cab3 Fix documentation build
Swift SVN r28710
2015-05-18 18:16:40 +00:00
Slava Pestov
b06c45b9b3 Attempt to document checked_cast_addr_br and unconditional_checked_cast_addr
Swift SVN r28693
2015-05-18 00:26:21 +00:00
Chris Lattner
6f7caf8335 fix a past-o in the dox.
Swift SVN r28149
2015-05-05 04:26:19 +00:00
Erik Eckstein
40c1160713 Revert r28111 "rework the peephole for optional-to-optional casts to be more specific"
and r28105: "implement <rdar://problem/17013042> T! <-> T? conversions should not produce a diamond"

r28111 broke the stdlib build. I also reverted r28105, because r28111 fixes regressions introduced in r2805.



Swift SVN r28114
2015-05-04 07:24:13 +00:00
Chris Lattner
add4909d35 implement <rdar://problem/17013042> T! <-> T? conversions should not produce a diamond
Two pieces to this:
 - Peephole InjectOptionalExpr(BindOptionalExpr(X)) to bitcast x to the result type.
 - Enhance OptionalEvaluationExpr to delete the failure block if not needed.



Swift SVN r28105
2015-05-04 01:12:23 +00:00
Andrew Trick
41cf8608cb Add is_unique documentation.
I also added a placeholder for ARC optimization docs. I wanted anyone
reading about swift ARC optimization to run across my discussion on
correctness w.r.t. COW.

Swift SVN r27890
2015-04-28 22:54:26 +00:00
Joe Groff
8293f3f444 Update SIL.rst to discuss @convention instead of the old attributes.
Swift SVN r27611
2015-04-22 22:51:20 +00:00
Joe Groff
fd138326ba SIL: Reject '@cc', '@thin', and '@objc_block' in SIL.
Since it's an internal interface, there's no need for migration in SIL.

Swift SVN r27610
2015-04-22 22:40:08 +00:00
Chris Lattner
5df6b054db fix the dox build
Swift SVN r27527
2015-04-21 06:18:13 +00:00
Chris Lattner
42b4a966b0 Introduce a new null_class SIL instruction for forming a null pointer
reference to something of class type.  This is required to model
RebindSelfInConstructorExpr correctly to DI, since in the class case, 
self.init and super.init *take* a value out of class box so that it 
can pass the +1 value without performing an extra retain.  Nothing
else in the compiler uninitializes a DI-controlled memory object
like this, so nothing else needs this.  DI really doesn't like something
going from initialized to uninitialized.

Yes, I feel super-gross about this and am really unhappy about it.  I
may end up reverting this if I can find an alternate solution to this
problem.



Swift SVN r27525
2015-04-21 05:56:55 +00:00
Michael Gottesman
11e8cfa06f State in the uncurry level examples which reference is the "natural uncurry level" explicitly.
Swift SVN r27143
2015-04-08 23:30:52 +00:00
Chris Lattner
379cae70d9 unbreak the dox build.
Swift SVN r26761
2015-03-31 16:40:43 +00:00
John McCall
6d8fff9c06 Parsing and basic structure of try_apply. Not yet properly
threaded into IRGen; tests to follow when that's done.

I made a preliminary effort to make the inliner do the
right thing with try_apply, but otherwise tried to avoid
touching the optimizer any more than was required by the
removal of ApplyInstBase.

Swift SVN r26747
2015-03-31 02:41:03 +00:00
Chris Lattner
209d9d6f5b fix the dox build.
Swift SVN r26623
2015-03-27 05:46:33 +00:00
John McCall
35b7db3ae1 Parsing support for error results from SILFunctionType.
Swift SVN r26566
2015-03-26 00:01:32 +00:00
Joe Groff
7431234bd2 SIL.rst: trim
Swift SVN r26496
2015-03-24 19:41:59 +00:00
Joe Groff
a5fb34fea1 SIL.rst: Hook up links to existential box insns.
Swift SVN r26468
2015-03-24 01:10:01 +00:00