Commit Graph

479 Commits

Author SHA1 Message Date
David Ungar
8c2c4ab391 Fixes for fine-grained dependencies 2020-01-16 13:20:27 -08:00
Slava Pestov
b73adbe700 Driver: Actually pass -require-explicit-availability{,-target} to frontend jobs
Unless you do this, the flag has no effect when used with the driver;
it only worked in conjunction with -Xfrontend.

Noticed while working on <rdar://problem/58490723>.
2020-01-13 21:50:10 -05:00
David Ungar
cc89dad526 Fine-grained and driver fixes.
Restructure fine-grained-dependencies to enable unit testing

Get frontend to emit correct swiftdeps file (fine-grained when needed) and only emit dot file for -emit-fine-grained-dependency-sourcefile-dot-files

Use deterministic order for more information outputs.

Set EnableFineGrainedDependencies consistently in frontend.

Tolerate errors that result in null getExtendedNominal()

Fix memory issue by removing node everywhere.

Break up print routine

Be more verbose so it will compile on Linux.

Sort batchable jobs, too.
2020-01-11 21:57:14 -08:00
Saleem Abdulrasool
b483047afe Revert "[Incremental] Dependency fixes in preparation for fine-grained dependencies" 2020-01-09 19:14:47 -08:00
David Ungar
6fffe724f2 Fine-grained and driver fixes.
Restructure fine-grained-dependencies to enable unit testing

Get frontend to emit correct swiftdeps file (fine-grained when needed) and only emit dot file for -emit-fine-grained-dependency-sourcefile-dot-files

Use deterministic order for more information outputs.

Set EnableFineGrainedDependencies consistently in frontend.

Tolerate errors that result in null getExtendedNominal()

Fix memory issue by removing node everywhere.

Break up print routine

Be more verbose so it will compile on Linux.

Sort batchable jobs, too.
2020-01-04 14:37:06 -08:00
David Ungar
73a46ce57e Revert "[Incremental, Driver] Only emit a real make-style dependency file for one frontend job." 2019-12-12 22:26:25 -08:00
David Ungar
cc83751ac5 Avoid need to check errors on dummy file creation. 2019-12-11 10:22:22 -08:00
David Ungar
46687189a7 -only-one-dependency-file causes only the first frontend job to emit a real dependency file. 2019-12-10 22:52:57 -08:00
Brent Royal-Gordon
e1e7a3fe75 Merge pull request #25656 from brentdax/file-name-basis
Shorten #file and add #filePath (behind an experimental flag)
2019-12-06 21:34:58 -08:00
Xi Ge
1e4912b759 Merge pull request #28579 from nkcsgexi/track-system-dependencies
Driver: flip the flag of whether tracking system dependencies
2019-12-05 13:17:20 -08:00
Xi Ge
9b49a4ce9f Driver: pass down -track-system-dependencies from driver to front-end invocations 2019-12-05 11:32:49 -08:00
Brent Royal-Gordon
63ec1cf5af Introduce a separate #filePath, remove -pound-file
This makes the path behavior more first-class. The feature is now hidden behind an experimental flag, -enable-experimental-concise-pound-file.
2019-12-04 16:35:13 -08:00
Brent Royal-Gordon
789d38eb04 Control #file behavior with a command line option 2019-12-04 16:33:25 -08:00
David Ungar
6a6e9357ef Change "experimental" to "fine-grained". 2019-12-04 08:50:44 -08:00
Erik Eckstein
a5397b434c Cross module optimization
This is a first version of cross module optimization (CMO).

The basic idea for CMO is to use the existing library evolution compiler features, but in an automated way. A new SIL module pass "annotates" functions and types with @inlinable and @usableFromInline. This results in functions being serialized into the swiftmodule file and thus available for optimizations in client modules.
The annotation is done with a worklist-algorithm, starting from public functions and continuing with entities which are used from already selected functions. A heuristic performs a preselection on which functions to consider - currently just generic functions are selected.

The serializer then writes annotated functions (including function bodies) into the swiftmodule file of the compiled module. Client modules are able to de-serialize such functions from their imported modules and use them for optimiations, like generic specialization.

The optimization is gated by a new compiler option -cross-module-optimization (also available in the swift driver).
By default this option is off. Without turning the option on, this change is (almost) a NFC.

rdar://problem/22591518
2019-12-03 14:37:01 +01:00
David Ungar
62ae2bfd2f Merge pull request #28164 from davidungar/WIP-custom-diff
[Incremental compilation] Source-range-based dependencies
2019-11-21 23:47:52 -08:00
David Ungar
aee3cb482e Try both in filelist for linker 2019-11-18 22:19:43 -08:00
Doug Gregor
ec70b62d5e Merge pull request #28107 from allevato/emit-pcm
Add driver flag to precompile Swift-compatible explicit Clang modules.
2019-11-14 10:25:53 -08:00
David Ungar
742c3985bd Source-range-based dependencies
Frontend outputs source-as-compiled, and source-ranges file with function body ranges and ranges that were unparsed in secondaries.
Driver computes diffs for each source file. If diffs are in function bodies, only recompiles that one file. Else if diffs are in what another file did not parse, then the other file need not be rebuilt.
2019-11-12 20:41:02 -08:00
Dan Liew
63e72909b5 [Sanitizers] Add Driver/Frontend option to enable sanitizer instrumentation that supports error recovery.
The new option `-sanitize-recover=` takes a list of sanitizers that
recovery instrumentation should be enabled for. Currently we only
support it for Address Sanitizer.

If the option is not specified then the generated instrumentation does
not allow error recovery.

This option mirrors the `-fsanitize-recover=` option of Clang.

We don't enable recoverable instrumentation by default because it may
lead to code size blow up (control flow has to be resumable).

The motivation behind this change is that today, setting
`ASAN_OPTIONS=halt_on_error=0` at runtime doesn't always work. If you
compile without the `-sanitize-recover=address` option (equivalent to
the current behavior of the swift compiler) then the generated
instrumentation doesn't allow for error recovery. What this means is
that if you set `ASAN_OPTIONS=halt_on_error=0` at runtime and if an ASan
issue is caught via instrumentation then the process will always halt
regardless of how `halt_on_error` is set. However, if ASan catches an
issue via one of its interceptors (e.g. memcpy) then `the halt_on_error`
runtime option is respected.

With `-sanitize-recover=address` the generated instrumentation allows
for error recovery which means that the `halt_on_error` runtime option
is also respected when the ASan issue is caught by instrumentation.

ASan's default for `halt_on_error` is true which means this issue only
effects people who choose to not use the default behavior.

rdar://problem/56346688
2019-11-12 11:33:58 -08:00
Tony Allevato
3c45041b17 Add driver modes to emit and dump Clang precompiled modules. 2019-11-11 15:00:51 -08:00
Xi Ge
70137251c6 Address Jordan's code review comments 2019-09-24 13:52:17 -07:00
Xi Ge
3103b5cec1 Frontend: set up output file .swiftsourceinfo
This patch will focus on teaching driver and frontend to emit this file.
The actual content and de-serialization parts will come later.

More details: https://forums.swift.org/t/proposal-emitting-source-information-file-during-compilation/28794
2019-09-24 13:52:17 -07:00
Harlan Haskins
c82c9b8210 [ModuleInterfaces] Remove references to 'parseable' interfaces everywhere
Now that we've settled on Module Interface as the name, let's remove the
vestiges of "Parseable Interfaces"
2019-09-13 14:55:48 -07:00
Owen Voorhees
e7a1a1cc3d Add -debug-diagnostic-names frontend flag
This flag adds diagnostic names to the end of their messages, e.g. 'error: cannot convert value of type '[Any]' to specified type '[Int]' [cannot_convert_initializer_value]'. It's intended to be used for debugging purposes when working on the compiler.
2019-08-05 18:54:21 -07:00
Saleem Abdulrasool
f82572a573 Merge pull request #25990 from compnerd/one-sdk-to-rule-them-all
Driver: look for the runtime object in the SDK
2019-07-25 15:32:51 -07:00
Erik Eckstein
321d340331 Driver: Don't imply -enable-anonymous-context-mangled-names with optimizations enabled, even if -g is used.
The option -enable-anonymous-context-mangled-names prevents stripping of dead metadata to improve debuggability.
But with optimizations enabled, we do a lot of dead code stripping which affects debuggability anyway.

rdar://problem/48123944
2019-07-17 12:10:16 +02:00
Harlan Haskins
21bd24a150 Revert "[Driver] Load the standard library before starting parallel frontend invocations"
This failed the source compat suite, it seems we need more driver
changes for this.
2019-07-12 21:38:23 -07:00
Harlan Haskins
7022110a05 [Driver] Load the standard library before starting parallel frontend invocations
Add a new action, LoadModuleJobAction, that the driver can use to schedule a
load of a given module before we fan out and invoke the frontend multiple
times. This gives the module interface loader a chance to compile it from a
module interface before we start with parallel invocations, avoiding starting
potentially dozens of redundant compiles of a large module. Start by using this
on the standard library.

Quick fix for rdar://52839445
2019-07-12 14:53:25 -07:00
Saleem Abdulrasool
e96e7cc190 Driver: look for the runtime object in the SDK
The runtime object is for the host, and is part of the SDK.  If `-sdk`
is passed, look for the runtime support object relative to the SDK root.
2019-07-09 14:56:42 -07:00
pschuh
4fd0671e54 Merge pull request #25870 from pschuh/cpp-1
Add -enable-cxx-interop flag and support for extern "C" {}
2019-07-09 11:37:31 -07:00
Jordan Rose
3f0e69ff8e Merge pull request #25992 from broadwaylamb/no-color-diagnostics
[Driver] Implement -no-color-diagnostics flag
2019-07-09 10:42:29 -07:00
Sergej Jaskiewicz
0ac6f3a3ad [Driver] Automatic -color-diagnostics flag is added *before* -Xfrontend 2019-07-09 15:53:35 +03:00
Parker Schuh
fa69a73ee4 Add -enable-cxx-interop flag and support for extern "C" {} 2019-07-08 11:43:35 -07:00
Sergej Jaskiewicz
0ed3bb1e17 [Driver] Implement -no-color-diagnostics flag 2019-07-08 04:22:06 +03:00
Brent Royal-Gordon
1e81ced48d Revert "Revert "Look up runtime libraries in SDK"" 2019-07-03 14:18:48 -07:00
David Ungar
3a3145c0f4 Alternate SelfDC computation, fixes, and cleanups.
ASTScopeLookup by default
Create empty fn bodies for IDE tests.
Include initializer source range for property wrappers.
Add -disable-astscope-lookup
2019-06-23 09:17:09 -07:00
swift-ci
bb2e003a21 Merge pull request #25628 from akyrtzi/index-disable-typo-correction 2019-06-20 09:38:37 -07:00
Jordan Rose
543632deda Merge pull request #25202 from troughton/static-libraries-driver
[Driver] Add -static flag for generating static archives
2019-06-20 09:10:02 -07:00
Argyrios Kyrtzidis
e23d3e3fbb [driver] For -index-file mode add -disable-typo-correction
We don't need typo-correction for that since the errors will be ignored and it can be expensive to do typo-correction.
2019-06-20 08:22:15 -07:00
Jordan Rose
04f74b8710 [Driver] Remove default from fully-covered switch (#25548)
This produces warnings when compiling with Clang.
2019-06-18 09:23:21 -07:00
Arnold Schwaighofer
05a6299b7b Another review comment I missed 2019-06-17 19:51:44 -07:00
Arnold Schwaighofer
5d329464d6 Use thread private key to avoid weak linkage
We use one bit of the third reserved swift private tls key.

Also move the functionality into a separate static archive that is
always linked dependent on deployment target.
2019-06-17 15:03:45 -07:00
Thomas Roughton
e5ea42d774 Driver: renamic LinkJob to DynamicLinkJob and ArchiveJob to StaticLinkJob
# Conflicts:
#	lib/Driver/DarwinToolChains.cpp
2019-06-17 12:49:17 +12:00
Thomas Roughton
b34a1cbbc6 Driver: add -static flag for generating static archives 2019-06-17 12:49:03 +12:00
David Ungar
06527db4ab Merge pull request #24594 from davidungar/A5-7-ASTOOScope-rebased
[NameLookup] ASTOOScope ontology
2019-06-14 08:03:09 -07:00
David Ungar
6cfcabd8e5 add -disable-parser-lookup 2019-06-11 09:08:10 -07:00
Joe Groff
4ed8de10f9 Revert "Revert "Use autolinking to pull in compatibility libraries."" 2019-06-03 20:10:51 -07:00
Joe Groff
a7cc3a38cc Revert "Use autolinking to pull in compatibility libraries." 2019-06-03 14:18:39 -07:00
Joe Groff
dffd1b27a1 Use autolinking to pull in compatibility libraries.
Many build systems that support Swift don't use swiftc to drive the linker. To make things
easier for these build systems, also use autolinking to pull in the needed compatibility
libraries. This is less ideal than letting the driver add it at link time, since individual
compile jobs don't know whether they're building an executable or not. Introduce a
`-disable-autolink-runtime-compatibility` flag, which build systems that do drive the linker
with swiftc can pass to avoid autolinking.

rdar://problem/50057445
2019-05-31 13:11:14 -07:00