Commit Graph

2998 Commits

Author SHA1 Message Date
Michael Gottesman
9b1c4c6189 Merge pull request #30942 from gottesmm/debug_compiler_autobisect
[debugging-the-compiler] Add to bisecting optimization passes a short example of how to use llvm's bisect tool to autobisect the optimizer.
2020-04-14 10:24:54 -07:00
swift-ci
2fa71b2e9d Merge pull request #29752 from roop/dev_tips_mem_usage 2020-04-14 00:27:00 -07:00
Robert Widmann
bdabeae98c Merge pull request #30609 from gribozavr/sil-rst
Removed a description of curried functions
2020-04-13 13:14:20 -07:00
Robert Widmann
4c4a55f651 Merge pull request #30934 from CodaFi/unchecked-opt-imism
[Gardening] Add Missing Instructions For Setting Optimization Levels in Xcode
2020-04-10 09:16:22 -07:00
Michael Gottesman
b16e0037e0 [debugging-the-compiler] Add to bisecting optimization passes a short example of how to use llvm's bisect tool to autobisect the optimizer. 2020-04-09 21:41:05 -07:00
Owen Voorhees
1ac3709dfa [Diagnostics] Document the verifier syntax for educational notes 2020-04-09 18:18:25 -07:00
Robert Widmann
d453eacc74 [Gardening] Apply Review Feedback 2020-04-09 16:02:51 -07:00
own2pwn
e927b55f48 Add steps to enable -Ounchecked compiler flag 2020-04-09 15:59:05 -07:00
Dan Zheng
2f50c859c0 [test] Add config.target_run_simple_swiftgyb_parameterized.
Support `%target-run-simple-swiftgyb(...)` taking compiler arguments.
Copies existing support for `%target-run-simple-swift(...)`.
2020-04-09 01:47:53 -07:00
swift-ci
9d6ae4cec4 Merge pull request #25810 from apple/stdlib-guide-update 2020-04-07 17:17:05 -07:00
Karoy Lorentey
2c61f00819 [doc] Update based on feedback; add short section on availabilty 2020-04-07 15:31:33 -07:00
swift-ci
9d4ea564c3 Merge pull request #30768 from martinboehme/cxx-exceptions-doc 2020-04-02 05:13:47 -07:00
Martin Boehme
04446c86cc Add a section on exceptions to the C++ interop manifesto. 2020-04-02 12:21:22 +02:00
Ben Rimmington
80093fe559 Update docs/HowSwiftImportsCAPIs.md 2020-04-01 13:50:02 +01:00
Robert Widmann
aa0bf50323 Merge pull request #30723 from CodaFi/dependendable-dependencies
[Evaluator] Online Request-Based Incremental Dependency Tracking
2020-03-31 18:13:05 -07:00
Robert Widmann
ee723cd953 Document Some Whys
* Document a number of legacy conditions and edge cases

* Add lexicon definitions for "dependency source", "dependency sink",
"cascading dependency" and "private dependency"
2020-03-31 16:19:13 -07:00
Robert Widmann
8c69814f5c Define Dependency Sinks
Convert most of the name lookup requests and a few other ancillary typechecking requests into dependency sinks.

Some requests are also combined sinks and sources in order to emulate the current scheme, which performs scope changes based on lookup flags. This is generally undesirable, since it means those requests cannot immediately be generalized to a purely context-based scheme because they depend on some client-provided entropy source. In particular, the few callers that are providing the "known private" name lookup flag need to be converted to perform lookups in the appropriate private context.

Clients that are passing "no known dependency" are currently considered universally incorrect and are outside the scope of the compatibility guarantees. This means that request-based dependency tracking registers strictly more edges than manual dependency tracking. It also means that once we fixup the clients that are passing "known private", we can completely remove these name lookup flags.

Finally, some tests had to change to accomodate the new scheme. Currently, we go out of our way to register a dependency edge for extensions that declare protocol conformances. However, we were also asserting in at least one test that extensions without protocol conformances weren't registering dependency edges. This is blatantly incorrect and has been undone now that the request-based scheme is automatically registering this edge.
2020-03-31 16:16:53 -07:00
Michael Gottesman
2b8fec56c4 [debugging-the-compiler] Add more details to Dumping SIL section and explain how to easily extract cmdline for the stdlib to use with those options when building with Ninja. 2020-03-30 17:31:00 -07:00
Robert Widmann
92c8a65f09 Drop references to name binding as a phase
A lot of places appear to mean "name lookup".  A few places meant "import resolution".
2020-03-29 18:51:09 -07:00
Robert Widmann
b5dc4233c7 [Gardening] Strike an Acchieved Request Evaluator Goal
ActiveRequest currently solves the on-stack request problem quite
handily.
2020-03-27 19:11:26 -07:00
Michael Gottesman
0036570e6f [debugging-the-compiler] Explain how one can use -R to set a breakpoint at a relative assembly offset.
Specifically, lldb resolves the breakpoint normally and then adjusts the
breakpoint address according to the value passed to -R. This is really useful
with -n (function name) and -M (method name) breakpoints across multiple-runs of
the debugger.
2020-03-27 16:49:36 -07:00
Owen Voorhees
791312fb74 Turn Educational Notes On-By-Default (#30583)
* [Diagnostics] Turn educational notes on-by-default

* [Diagnostics] Only include educational notes in printed output if -print-educational-notes is passed

* Make -print-educational-notes a driver option

* [Diagnostics] Issue a printed remark if educational notes are available, but disabled

* [docs] Update educational notes documentation and add a contributing guide

* [Diagnostics] Cleanup PrintingDiagnosticConsumer handling of edu notes

* Revert "[Diagnostics] Issue a printed remark if educational notes are available, but disabled"
For now, don't notify users if edu notes are available but disabled. This decision can be reevaluated later.
2020-03-27 15:29:48 -07:00
Dan Zheng
c1fe0e37ba [AutoDiff upstream] Add differentiable function type mangling. (#30675)
Add mangling scheme for `@differentiable` and `@differentiable(linear)` function
types. Mangling support is important for debug information, among other things.

Update docs and add tests.

Resolves TF-948.
2020-03-27 12:02:55 -07:00
ematejska
75691d641e [AutoDiff upstream] Add linear function SIL instructions (#30638)
Add `linear_function` and `linear_function_extract` instructions.

`linear_function` creates a `@differentiable(linear)` function-typed value from
an original function operand and a transpose function operand (optional).

`linear_function_extract` extracts either the original or transpose function
value from a `@differentiable(linear)` function.

Resolves TF-1142 and TF-1143.
2020-03-26 09:41:14 -07:00
Dmitri Gribenko
05cbd9702c Removed a description of curried functions
Curried functions were removed in 2016 in 983a674e0.
2020-03-24 14:42:18 +01:00
Dan Zheng
cc7e9fc39e [AutoDiff upstream] [SIL] Add differentiable function instructions.
Add `differentiable_function` and `differentiable_function_extract`
instructions.

`differentiable_function` creates a `@differentiable` function-typed
value from an original function operand and derivative function operands
(optional).

`differentiable_function_extract` extracts either the original or
derivative function value from a `@differentiable` function.

The differentiation transform canonicalizes `differentiable_function`
instructions, filling in derivative function operands if missing.

Resolves TF-1139 and TF-1140.
2020-03-22 23:53:43 -07:00
Dan Zheng
aab622e913 [AutoDiff upstream] Add derivative function SILDeclRefs. (#30564)
`@differentiable` attribute on protocol requirements and non-final class members
will produce derivative function entries in witness tables and vtables.

This patch adds an optional derivative function configuration
(`AutoDiffDerivativeFunctionIdentifier`) to `SILDeclRef` to represent these
derivative function entries.

Derivative function configurations consist of:
- A derivative function kind (JVP or VJP).
- Differentiability parameter indices.

Resolves TF-1209.
Enables TF-1212: upstream derivative function entries in witness tables/vtables.
2020-03-22 11:50:29 -07:00
Robert Widmann
984df635b8 Merge pull request #30478 from MForster/patch-1
Fix a typo in CppInteroperabilityManifesto.md
2020-03-21 19:49:13 -07:00
swift-ci
cf325597ff Merge pull request #30481 from MForster/patch-2 2020-03-21 17:19:09 -07:00
Dmitri Gribenko
e715ebdfdd Fix documentation for alloc_existential_box
Remove the description of the second element of the return tuple: this
instruction has been returning only one value since b7ea3b9bb2.
2020-03-20 14:55:53 +01:00
Slava Pestov
9ec80df97e SIL: Remove curried SILDeclRefs 2020-03-19 02:20:21 -04:00
Michael Forster
ec9fd08ac6 Fix another typo in CppInteroperabilityManifesto.md 2020-03-18 22:30:41 +01:00
Michael Forster
608a041dec Fix a typo in CppInteroperabilityManifesto.Md 2020-03-18 21:51:43 +01:00
Jonas Devlieghere
09834bb768 [docs] Outer and Inner are not glossary terms 2020-03-18 09:09:51 -07:00
ematejska
85b7b4bedf Updating Testing instructions with utils/run-test
Updating Testing instructions with utils/run-test.  I find this utility useful and others might too.
2020-03-17 16:41:04 -07:00
Dmitri Gribenko
5fb5c74369 Added "parent type" to the lexicon 2020-03-17 19:26:36 +01:00
Erik Eckstein
ae93e60072 SIL: add a lazy_property_getter flag to SILFunction
It is set on getter-functions for lazy properties.
2020-03-13 09:49:55 +01:00
Erik Eckstein
cc0afcb838 docs: document SILFunction attributes in SIL.rst
Well, at least mention them. There could be more documentation about the attributes.
2020-03-12 14:00:05 +01:00
Patrick Deschênes
2a8546862c doc, windows: set LLVM_ENABLE_LIBEDIT=NO
Necessary to make the source compile. This option is used in the
current azure pipeline.
2020-03-09 21:58:31 -04:00
Patrick Deschênes
58f6e9ba26 doc, windows: break down the cmake command
Rewrite the cmake command on multiple lines to see each option more
clearly.
2020-03-09 21:58:18 -04:00
Patrick Deschênes
9fd34abb7c doc, windows: remove extra parenthesis 2020-03-09 21:57:46 -04:00
John McCall
ceff414820 Distinguish invocation and pattern substitutions on SILFunctionType.
In order to allow this, I've had to rework the syntax of substituted function types; what was previously spelled `<T> in () -> T for <X>` is now spelled `@substituted <T> () -> T for <X>`.  I think this is a nice improvement for readability, but it did require me to churn a lot of test cases.

Distinguishing the substitutions has two chief advantages over the existing representation.  First, the semantics seem quite a bit clearer at use points; the `implicit` bit was very subtle and not always obvious how to use.  More importantly, it allows the expression of generic function types that must satisfy a particular generic abstraction pattern, which was otherwise impossible to express.

As an example of the latter, consider the following protocol conformance:

```
protocol P { func foo() }
struct A<T> : P { func foo() {} }
```

The lowered signature of `P.foo` is `<Self: P> (@in_guaranteed Self) -> ()`.  Without this change, the lowered signature of `A.foo`'s witness would be `<T> (@in_guaranteed A<T>) -> ()`, which does not preserve information about the conformance substitution in any useful way.  With this change, the lowered signature of this witness could be `<T> @substituted <Self: P> (@in_guaranteed Self) -> () for <A<T>>`, which nicely preserves the exact substitutions which relate the witness to the requirement.

When we adopt this, it will both obviate the need for the special witness-table conformance field in SILFunctionType and make it far simpler for the SILOptimizer to devirtualize witness methods.  This patch does not actually take that step, however; it merely makes it possible to do so.

As another piece of unfinished business, while `SILFunctionType::substGenericArgs()` conceptually ought to simply set the given substitutions as the invocation substitutions, that would disturb a number of places that expect that method to produce an unsubstituted type.  This patch only set invocation arguments when the generic type is a substituted type, which we currently never produce in type-lowering.

My plan is to start by producing substituted function types for accessors.  Accessors are an important case because the coroutine continuation function is essentially an implicit component of the function type which the current substitution rules simply erase the intended abstraction of.  They're also used in narrower ways that should exercise less of the optimizer.
2020-03-07 16:25:59 -05:00
Patrick Deschênes
0484ef0af3 docs: Update WindowsBuild.md
Update azure links
2020-03-05 20:10:48 -05:00
Erik Eckstein
a637b89c29 docs: add documentation for the [dynamic_lifetime] attribute of alloc_stack in SIL.rst 2020-03-05 13:12:08 +01:00
John McCall
9df969a627 Mangle coroutine information when mangling SILFunctionTypes. 2020-03-01 22:40:43 -05:00
David Ungar
f9ee5722fe fix underline length 2020-02-28 08:45:56 -08:00
Dmitri Gribenko
910af40940 Merge pull request #29880 from gribozavr/import-cpp-into-swift
Added a document about interoperability between Swift and C++
2020-02-27 14:18:11 +01:00
Michael Gottesman
71fc5bd347 [opt-tips] Remove -Ounchecked and talk about WMO + 'internal' to reduce dynamic dispatch. (#30068)
* Remove reference to -Ounchecked.

* Add internal + wmo in reducing dynamic dispatch.

* Fix some grammar

Co-Authored-By: Brennan Saeta <brennan.saeta@gmail.com>

Co-authored-by: Brennan Saeta <brennan.saeta@gmail.com>
2020-02-26 16:36:26 -08:00
Dmitri Gribenko
19a09f422c Added a document about interoperability between Swift and C++
This document discusses the design and tradeoffs for interoperability
between Swift and C++.

This document was written with valuable contributions from
Doug Gregor <dgregor@apple.com>, John McCall <jmccall@apple.com>,
Chris Lattner <clattner@nondot.org>, Dave Abrahams <dabrahams@google.com>,
Tony Allevato <allevato@google.com>, Mike Forster <forster@google.com>,
Dave MacLachlan <dmaclach@google.com>, and Josh L <joshl@google.com>.
2020-02-26 10:08:59 +01:00
Luciano Almeida
86f7c6bb9d [docs] Updating doc list for the diagnostics ported to new framework 2020-02-23 14:41:44 -03:00