Commit Graph

521 Commits

Author SHA1 Message Date
Chris Lattner
567a3175dc extend the mark_initialized SIL instruction to have a "kind" enum field.
Existing uses use a "globalvar" kind.  Add a new "rootinit" kind which
will be used for root initializers (i.e. init methods of structs, enums, 
and root classes).



Swift SVN r10772
2013-12-04 02:02:15 +00:00
Chris Lattner
ad05efc481 Redesign the BuiltinFunctionRefInst to contain an Identifier instead of
a FuncDecl.  This makes it much more straight-forward for SIL passes to
introduce a new one - without doing name lookup in the builtin module!



Swift SVN r10694
2013-11-30 01:49:36 +00:00
Dave Abrahams
a29a8778eb [docs] SIL.rst: fix another ReST error
Swift SVN r10650
2013-11-22 00:38:22 +00:00
Dave Abrahams
283662f764 [docs] SIL.rst: fix ReST error
Swift SVN r10649
2013-11-22 00:37:14 +00:00
John McCall
e95dc16fac Describe SIL function types, the restrictions on SIL
value types, and the problem of abstraction difference.

Swift SVN r10647
2013-11-22 00:17:22 +00:00
Joe Groff
f6b1745650 SIL: Remove 'ModuleInst'.
Module values could never be used for anything, and we have SILUndef now, so when SILGen sees a ModuleExpr, we can just emit 'undef'.

Swift SVN r10548
2013-11-18 21:36:08 +00:00
Dmitri Hrybenko
81dc5deee8 Change 'def' keyword back to 'func'
Swift SVN r10522
2013-11-17 07:45:28 +00:00
Chris Lattner
425819ac07 Change the SIL string_literal instruction to produce three results
(the same way alloc_box returns two) instead of returning a tuple.

This eliminates a ton of tuple_extract instructions, which just
bloat the generated SIL.  This resolves rdar://15378135.



Swift SVN r10416
2013-11-13 06:43:09 +00:00
Dmitri Hrybenko
91ce21666d Change 'func' keyword to 'def'
I tried hard find all references to 'func' in documentation, comments and
diagnostics, but I am sure that I missed a few.  If you find something, please
let me know.

rdar://15346654


Swift SVN r9886
2013-11-02 01:00:42 +00:00
Chris Lattner
ef93c81ffb Introduce a new SIL-level "undef" value, useful for SIL transformations.
IRGen support is missing, Joe volenteers to implement it.


Swift SVN r9776
2013-10-30 00:58:09 +00:00
Joe Groff
a334ce8904 SIL.rst: Document cond_fail instruction.
Swift SVN r9590
2013-10-22 15:53:09 +00:00
Joe Groff
61360ba7a4 SIL: Remove ConvertCCInst.
Swift SVN r9577
2013-10-22 03:16:27 +00:00
Mark Lacey
3ed49cf81a Fix typo in vtable example: s/B/C/
Swift SVN r9359
2013-10-15 18:32:11 +00:00
Doug Gregor
32c40e8deb Document @sil_self.
Swift SVN r9069
2013-10-09 17:40:09 +00:00
Dave Abrahams
87e51140fa [docs] SIL.rst: ReST fixups
Swift SVN r9031
2013-10-08 21:53:42 +00:00
Joe Groff
abd8a6dd7e SIL.rst: Update for attribute syntax change.
Swift SVN r8987
2013-10-07 20:49:46 +00:00
Joe Groff
63588740ff SIL.rst: Document new alloc_stack/dealloc_stack invariants enforced by verifier.
Swift SVN r8986
2013-10-07 20:37:31 +00:00
Joe Groff
6424e99da2 SIL: Rename 'condbranch' to the more idiomatic 'cond_br'.
For consistency with the other '*_br' instructions.

Swift SVN r8957
2013-10-07 16:16:35 +00:00
Joe Groff
accdbf318e SIL.rst: Clarify language describing enum initialization.
Swift SVN r8955
2013-10-07 15:57:48 +00:00
Joe Groff
6a84a1c8bc SIL.rst: Describe SIL vtables.
Swift SVN r8953
2013-10-07 15:49:08 +00:00
Joe Groff
0e7a6178d7 SIL.rst: Some fun facts about enums.
Swift SVN r8752
2013-09-28 03:23:10 +00:00
Joe Groff
ef6965b3bc SIL.rst: Update for removal of 'specialize'.
Swift SVN r8748
2013-09-28 00:36:23 +00:00
Michael Gottesman
68a6817ed1 [SIL] Update docs to specify that copy_addr/destroy_addr on trivial types is equivalent to a load/store and no-op respectively.
This patch just documents the answer I got from Joe when I asked him this
question.

Swift SVN r8742
2013-09-27 21:36:13 +00:00
Joe Groff
2118a70dc7 SIL.rst: Describe new checked cast instructions.
Swift SVN r8697
2013-09-26 18:44:54 +00:00
Joe Groff
cbfe3710f6 SIL: Rename the 'isObjC' SILDeclRef specifier to 'isForeign'.
Doug pointed out that 'isObjC' incorrectly excludes C functions, for which we'll also need to be able to independently reference Swift and foreign entries.

Swift SVN r8669
2013-09-25 21:59:03 +00:00
Joe Groff
3d4c1251f1 Rename 'byref' attribute to 'inout'.
Swift SVN r8661
2013-09-25 20:56:52 +00:00
Dave Abrahams
2e1333417c [docs] SIL.rst: fix ReST errors
Swift SVN r8656
2013-09-25 20:24:27 +00:00
Joe Groff
801efc55e7 SIL.rst: ReST typo.
Swift SVN r8577
2013-09-24 00:17:56 +00:00
Joe Groff
014f270516 SIL: Have project_existential_ref project to a protocol Self archetype.
This mirrors the behavior of project_existential and simplifies some special cases in SILGen. It unfortunately makes dynamic_lookup sequences a bit noisier because of the need to explicitly cast the projection from DynamicLookup.Self to Builtin.ObjCPointer, but I think this modeling is more solid and will fit better with my planned redesign of archetype_method/protocol_method.

Swift SVN r8572
2013-09-23 21:57:12 +00:00
Joe Groff
14f1b9da42 SIL.rst: Update for 'This' -> 'Self' sea change.
Swift SVN r8571
2013-09-23 21:57:05 +00:00
Joe Groff
9e54a69016 SIL: Allow RefToObjectPointer and ObjectPointerToRef to cast to/from Builtin.ObjCPointer.
Swift SVN r8558
2013-09-23 16:20:29 +00:00
Joe Groff
26125d050b Update 'union' references in other docs.
Swift SVN r8483
2013-09-20 04:41:49 +00:00
John McCall
7954960797 Add 'copy_value' and 'destroy_value' operations to destroy
entire aggregates at once.

This has three worth effects:
  - It significantly decreases the amount of SIL required
    for these operations.
  - It makes it far easier for IR-gen to choose efficient
    patterns of destruction, e.g. calling a single entrypoint
    or recognizing that it can just use the runtime 'release'
    entrypoints.
  - It makes it easier to recognize and optimize aggregate
    copy/destroy operations.
It does make SROA-like tasks a bit more challenging.  The
intent is to give TypeLowering a way to expand these into
their primitive behavior.

Swift SVN r8465
2013-09-19 22:14:55 +00:00
Joe Groff
04b9685d84 SIL.rst: Remove currently irrelevant and potentially confusing caveat.
Swift SVN r8219
2013-09-13 22:25:18 +00:00
Joe Groff
7b37f2d445 SIL.rst: Clarify class subtyping rules wrt generic instances.
Swift SVN r8216
2013-09-13 22:12:07 +00:00
Joe Groff
6e56a4206c SIL.rst: Describe aliasing rules for heap object references.
Clarify that, unlike SIL addresses, class values and other heap object references can alias and be captured. Class value aliasing is controlled by the type system.

Swift SVN r8210
2013-09-13 21:01:58 +00:00
Chris Lattner
7c8ae9352a Add a new "mark_function_escape" instruction that will be used to mark the
escape point of function definitions that "close" over global variables.



Swift SVN r8152
2013-09-12 18:31:00 +00:00
Chris Lattner
3c0c9a5da7 introduce a new mark_uninitialized SIL instruction which will be used by
definitive initialization of top-level code.


Swift SVN r8144
2013-09-12 04:30:48 +00:00
Joe Groff
f58d65a903 SIL.rst: Update description of 'thunk' linkage for its broader role.
Swift SVN r8124
2013-09-11 23:51:16 +00:00
Joe Groff
705102b544 SIL: Rename 'ClangThunk' specifier to 'Thunk'.
Lazily-generated currying thunks will require the same IR-level linkonce_odr linkage as clang thunks currently do, so generalize the name of the existing SIL-level linkage specifier 'clang_thunk'.

Swift SVN r8122
2013-09-11 23:47:15 +00:00
Joe Groff
4a4c70ab36 IRGen: Implement partial_apply lowering for objc dynamic method values.
To do this right, we need to emit the objc_msgSend on the 'self' argument inside the forwarding stub, so handle them in a different code path in IRGenSIL::visitPartialApplyInst.

Swift SVN r8112
2013-09-11 21:07:28 +00:00
Joe Groff
7eb02647f5 Update SIL.rst discussion of objc calling convention.
Swift SVN r8111
2013-09-11 21:07:22 +00:00
Doug Gregor
ad9a958e2d Document SIL dynamic_method_br instruction
Swift SVN r8086
2013-09-10 22:58:53 +00:00
Anna Zaks
89fff39153 [SIL.rst] Update the guaranteed passes section.
Swift SVN r8058
2013-09-09 22:37:10 +00:00
Joe Groff
387946298e Describe calling convention for [byref] arguments in SIL.rst.
Swift SVN r8052
2013-09-09 20:17:37 +00:00
Doug Gregor
c5557a624c SIL: Introduce the 'dynamic_method' instruction for dynamic method dispatch.
The dynamic_method instruction handles method lookup on an existential
of type DynamicLookup based on the selector of an [objc] method of a
class or protocol. It is only introduced in the narrow case where we
are forcing a use of the method with '!', e.g.,

class X {
  func [objc] f() { println("Dynamic lookup") }
}

var x : DynamicLookup = X()
x.f!()



Swift SVN r8037
2013-09-09 16:12:50 +00:00
Joe Groff
d10491ae18 SIL.rst: Add a note that 'apply' currently consumes thick callees.
Swift SVN r7995
2013-09-06 20:33:32 +00:00
John McCall
7a909b64c2 Update the description of 'assign'.
I also removed a restriction about the form of the operand that
doesn't seem to be enforced by SIL-gen at all.

Swift SVN r7951
2013-09-05 18:08:11 +00:00
Michael Gottesman
743e99fb96 Fixed typo in SIL documentation.
Swift SVN r7944
2013-09-05 07:03:44 +00:00
John McCall
6aba15bc63 Document unowned_to_ref and ref_to_unowned, and discuss some
of the philosophy behind preserving this information in the type.

Swift SVN r7791
2013-08-30 18:31:31 +00:00