Commit Graph

650 Commits

Author SHA1 Message Date
Ben Langmuir
fadfb6c945 Merge pull request #31874 from benlangmuir/driver-tmp-sad
[driver/sourcekit] Avoid creating temporary output files in TMPDIR
2020-06-05 13:43:23 -07:00
Saleem Abdulrasool
d0131ba6be Merge pull request #31146 from kateinoigakukun/katei/enable-lang-agnostic-lto
[LTO] Support LLVM level link time optimization on Darwin, Linux and Windows
2020-06-05 11:38:09 -07:00
Varun Gandhi
7df7378048 [NFC] Remove redundant includes for llvm/ADT/DenseMap.h. 2020-05-31 13:07:45 -07:00
Varun Gandhi
fea589e470 [NFC] Remove redundant includes for llvm/ADT/DenseSet.h. 2020-05-31 13:07:45 -07:00
Varun Gandhi
e64d4a0ca0 [NFC] Remove redundant includes for llvm/ADT/StringMap.h. 2020-05-31 13:07:45 -07:00
Varun Gandhi
81ce06855c [NFC] Remove redundant includes for llvm/ADT/StringSet.h. 2020-05-31 13:07:45 -07:00
Varun Gandhi
91693e96c9 [NFC] Remove redundant includes for llvm/ADT/SmallPtrSet.h. 2020-05-31 13:07:45 -07:00
Varun Gandhi
2c7b4b119a [NFC] Remove redundant includes for llvm/ADT/Optional.h. 2020-05-31 13:05:48 -07:00
Yuta Saito
915c4a6997 [LTO] Support LLVM level link time optimization
This commit adds -lto flag for driver to enable LTO at LLVM level.
When -lto=llvm given, compiler emits LLVM bitcode file instead of object
file and perform thin LTO using libLTO.dylib plugin.
When -lto=llvm-full given, perform full LTO instead of thin LTO.
2020-05-31 08:12:52 +09:00
Ben Langmuir
ffc990f999 [driver/sourcekit] Avoid creating temporary output files in TMPDIR
When producing frontend arguments for sourcekitd, force the output mode
to -typecheck so that we do not create any temporary output files in the
driver. Previously, any sourcekitd operation that created a compiler
invocation would create 0-sized .o file inside $TMPDIR that would never
be cleaned up.

The new swift-driver project handles temporaries much better as
VirtualPath, and should not need this approach.

rdar://62366123
2020-05-18 16:52:41 -07:00
Slava Pestov
368d47429d Frontend: Remove coarse-grained dependency graph implementation 2020-04-29 16:55:53 -04:00
Doug Gregor
548e28170a [Driver/Frontend] Thread the target SDK version through to the IR.
Teach the driver to pass the SDK version it computes (from the SDK
settings JSON in a Darwin-based platform's SDK) down into the frontend.
The frontend then sets that SDK version in the LLVM module, which
eventually makes its way into the Mach-O file.

Last part of rdar://problem/60332732.
2020-04-15 21:42:28 -07:00
Doug Gregor
970ff6b818 [Driver] Read SDK version information to pass to the Darwin linker.
Recent-ish SDKs for Darwin platforms include an SDKSettings.json
file with version information and Catalyst SDK version mappings. Read
these (when available) and use them to pass the appropriate SDK
version down to the Darwin linker via `-platform_version`.

Finishes rdar://problem/55972144.
2020-04-02 21:07:26 -07:00
Francis Visoiu Mistrih
e724ebab6b [Remarks] Add a specialized RemarkStreamer for SIL remarks
This allows the usage of the whole remark infrastructure developed in
LLVM, which includes a new binary format, metadata in object files, etc.

This gets rid of the YAMLTraits-based remark serialization and does the
plumbing for hooking to LLVM's main remark streamer.

For more about the idea behind LLVM's main remark streamer, see the
docs/Remarks.rst changes in https://reviews.llvm.org/D73676.

The flags are now:

* -save-optimization-record: enable remarks, defaults to YAML
* -save-optimization-record=<format>: enable remarks, use <format> for
serialization
* -save-optimization-record-passes <regex>: only serialize passes that
match <regex>.

The YAMLTraits in swift had a different `flow` setting for the debug
location, resulting in some test changes.
2020-03-02 18:33:20 -08:00
Alexis Laferrière
901392896d [Frontend] Output the private module interface with the SPI info 2020-02-19 14:17:14 -08:00
David Ungar
314d1e12c3 Reorganization of SourceFileDepGraph building and mocking. 2020-02-14 21:53:45 -07:00
David Ungar
3ac5cebd8f Small fixes and debugging improvements for SwiftDriverTests 2020-02-08 22:45:30 -08:00
David Ungar
286781fc3e Add a unit test for an individual node change, & add ability to set fingerprints in unit tests. 2020-01-29 16:48:42 -08:00
David Ungar
0a3be7575a unit tests compile 2020-01-27 15:14:46 -08:00
David Ungar
d61f6f2f66 Changes to support per-type-body fingerprints. 2020-01-27 15:14:46 -08:00
David Ungar
98b86c63d1 Use the initial value of EnableFineGrainedDependencies as the default. 2020-01-23 12:12:17 -08:00
David Ungar
f696aabffb Merge pull request #29246 from davidungar/fine-grained-off-but-w-tests-rb
[Incremental] Fixes for fine-grained dependencies + tests for them, but off-by-default
2020-01-22 23:21:33 -08:00
Devin Coughlin
655d89b146 [Driver/Frontend] Add Driver support for macCatalyst and library search paths
Add support in the driver and frontend for macCatalyst target
targets and library search paths.

The compiler now adds two library search paths for overlays when compiling
for macCatalyst: one for macCatalyst libraries and one for zippered macOS
libraries. The macCatalyst path must take priority over the normal macOS path
so that in the case of 'unzippered twins' the macCatalyst library is
found instead of the macOS library.

To support 'zippered' builds, also add support for a new -target-variant
flag. For zippered libraries, the driver invocation takes both a -target and a
-target-variant flag passes them along to the frontend. We support builds both
when the target is a macOS triple and the target variant is macCatalyst and
also the 'reverse zippered' configuration where the target is macCatalyst and the
target-variant is macOS.
2020-01-21 18:28:17 -08:00
David Ungar
cbd458c968 Make tests more deterministic by sorting jobs before scheduling 2020-01-16 13:20:35 -08:00
David Ungar
8c2c4ab391 Fixes for fine-grained dependencies 2020-01-16 13:20:27 -08: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
Ashley Garland
7a3a0a9e23 Symbol graph support
Adds a tool `swift-symbolgraph-extract` that reads an existing Swift
module and prints a platform- and language-agnostic JSON description of
the module, primarly for documentation.

Adds a small sub-library `SymbolGraphGen` which houses the core
implementation for collecting relevant information about declarations.
The main entry point is integrated directly into the driver as a mode:
the tool is meant to be run outside of the normal edit-compile-run/test
workflow to avoid impacting build times.

Along with common options for other tools, unique options include
`pretty-print` for debugging, and a `minimum-access-level` options for
including internal documentation.

A symbol graph is a directed graph where the nodes are symbols in a
module and the edges are relationships between them. For example, a
`struct S` may have a member `var x`. The graph would have two nodes for
`S` and `x`, and one "member-of" relationship edge. Other relationship
kinds include "inherits-from" or "conforms to". The data format for a
symbol graph is still under development and may change without notice
until a specificiation and versioning scheme is published.

Various aspects about a symbol are recorded in the nodes, such as
availability, documentation comments, or data needed for printing the
shapes of declarations without having to understand specifics about the
langauge.

Implicit and public-underscored stdlib declarations are not included by
default.

rdar://problem/55346798
2020-01-10 09:53:37 -08:00
David Ungar
2a79331ac3 add -enable/disable-only-one-dependency-file flag, on by default 2019-12-18 16:07:51 -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
4c365a7735 Merge pull request #28702 from davidungar/only-one-dependency-file
[Incremental, Driver] Only emit a real make-style dependency file for one frontend job.
2019-12-11 21:21:41 -08:00
David Ungar
2fc0f7899c Fix comment for OnlyOneDependencyFile 2019-12-11 15:49:12 -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
David Ungar
9bfed89e8c markTransitive & markExternal return the jobs, unfmt 2019-12-08 11:15:51 -08:00
David Ungar
bc068ae68e format 2019-12-04 10:51:18 -08:00
David Ungar
8dc04c7912 Rename DependencyGraph and DependencyGraphImp with CoarseGrained prefix. 2019-12-04 10:51:18 -08:00
David Ungar
2ff5855c63 Rename DependencyGraphImpl -> CoarseGrainedDependencyGraphImpl, unformatted 2019-12-04 10:51:18 -08:00
David Ungar
200b181eb3 Renaming files -> CoarseGrained 2019-12-04 10:51:18 -08:00
David Ungar
6a6e9357ef Change "experimental" to "fine-grained". 2019-12-04 08:50:44 -08:00
David Ungar
496e602bff Renaming files 2019-12-04 08:38:59 -08:00
David Ungar
3d3507b7b6 Remove unparsed ranges and use diffs to schedule dependents earlier. 2019-12-03 17:23:02 -08:00
David Ungar
3cba2306ca Moving tests and driver refactoring. 2019-12-03 09:24:17 -08:00
David Ungar
448d9df38c Merge pull request #28444 from davidungar/WIP-custom-diff
Fix memory violation when build record is bad.
2019-12-02 10:55:59 -08:00
David Ungar
08cfe80061 Don't crash when asking for comparison but not incremental 2019-11-23 11:21:33 -08: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
68f0ea2290 fmt 2019-11-21 00:01:34 -08:00
David Ungar
65d8504a16 WIP non alloc 2019-11-20 23:59:13 -08:00
David Ungar
59fc0c209b Heap-alloc PRLinks 2019-11-20 14:38:37 -08:00
David Ungar
468a23cef9 report stages unfmt 2019-11-20 13:28:19 -08:00
David Ungar
ae64f471cd Reporting refactoring 2019-11-19 16:42:21 -08:00
David Ungar
bc403424ee Use sets 2019-11-19 13:10:33 -08:00