Commit Graph

569 Commits

Author SHA1 Message Date
Vinicius Vendramini
aebfb53966 Ast dump ignore wmo (#20596)
* Ignore -wmo when passing -dump-ast

* Cleanup on driver diagnostics

* Remove the FIXME.

* Add support for ignoring `-index-file`

* Revert unrelated formatting changes

* Revert back to only ignoring `-wmo`

Ignoring both `-wmo` and `-index-file` will be harder than just `-wmo`. This is because when calling the compiler and passing `-index-file` after `-dump-ast`, the option gets un-ignored by `Driver::buildOutputInfo`. Therefore, we will just ignore `-wmo` for now.

* Add tests, inspired by `Driver/batch_mode_with_WMO_or_index.swift`
2019-12-19 11:47:47 -08:00
swift_jenkins
f898b2bd5e Merge remote-tracking branch 'origin/master' into master-next 2019-12-19 11:19:56 -08:00
Doug Gregor
393c6d35bf Merge pull request #28874 from DougGregor/unversioned-triple
[Driver] Add unversioned triple to the output of -print-target-info.
2019-12-19 11:07:02 -08:00
Doug Gregor
3a9b8bc658 [Driver] Add unversioned triple to the output of -print-target-info.
SwiftPM wants to use the unversioned triple to know where to put
results. Vend this as part of -print-target-info.
2019-12-19 09:10:58 -08:00
swift_jenkins
a812971ee5 Merge remote-tracking branch 'origin/master' into master-next 2019-12-17 15:00:16 -08:00
Xi Ge
3a55c3c96e Front-end: teach the compiler to generate a .c file for $ld$add$os symbols.
When symbols are moved to this module, this module declares them as HIDE
for the OS versions prior to when the move happened. On the other hand, the
original module should declare ADD them for these OS versions. An executable
can choose the right library to link against depending on the deployment target.
This is a walk-around that linker directives cannot specify other install
name per symbol, we should eventually remove this.
2019-12-13 17:22:00 -08:00
Xi Ge
93a83d3f14 IRGen: reuse linker directives collected from tbd gen to emit these symbols to IR 2019-12-12 22:22:28 -08:00
Joe Groff
fb34044408 Merge remote-tracking branch 'origin/master' into master-next 2019-12-10 12:46:41 -08:00
Doug Gregor
f451dc4177 Merge pull request #28646 from DougGregor/print-target-info-paths
[Frontend] Add some paths to the output of -print-target-info.
2019-12-09 10:00:04 -08:00
Doug Gregor
c92600b38b [Frontend] Add some paths to the output of -print-target-info.
Add various target-specific and compiler-determined paths to the output
of `-print-target-info`, such as the runtime resource path, SDK path, and
runtime library paths.
2019-12-08 21:10:30 -08:00
Doug Gregor
179e3c2ab4 Merge pull request #28602 from DougGregor/print-target-triple
[Driver/Frontend] Add -print-target-triple
2019-12-07 10:51:38 -08:00
Doug Gregor
61c83d2415 [Driver] Switch -print-target-triple to -print-target-info and add more info.
Rather than only emitting the target triple, provide additional
information about that particular target, including the module triple
(i.e., what file names will be used for Swift modules for that
triple), the runtime compatibility version if there is one, and
whether linking with rpaths is required for the standard library and
other libraries shipped with Swift. Encode this as JSON so we can
extend it in the future. For now, it looks like this:

```
{
  "target": {
    "triple": "arm64-apple-ios12.0",
    "moduleTriple": "arm64-apple-ios",
    "swiftRuntimeCompatibilityVersion": "5.0",
    "librariesRequireRPath": true
  }
}
```

Which you can deserialize into a TargetInfo instance as defined below:

```
struct Target: Codable {
  /// The target triple.
  var triple: String
  /// The triple used for module file names.
  var moduleTriple: String
  /// If this platform provides the Swift runtime, the Swift language
  version
  /// with which that runtime is compatible.
  var swiftRuntimeCompatibilityVersion: String?
  /// Whether linking against the Swift libraries requires the use of
  rpaths.
  var librariesRequireRPath: Bool
}

struct TargetInfo: Codable {
  var target: Target
}
```

Implements rdar://problem/47095159.
2019-12-06 22:17:29 -08:00
Doug Gregor
cfe25eabb0 [Driver/Frontend] Add -print-target-triple
Add a -print-target-triple command line option to the Swift frontend
and driver to allow other tools (e.g., SwiftPM) to query the host
triple as it is understood by the Swift compiler. This follows the
precedent set by Clang. Implements rdar://problem/57434967.
2019-12-05 17:23:13 -08:00
David Ungar
6a6e9357ef Change "experimental" to "fine-grained". 2019-12-04 08:50:44 -08:00
David Ungar
7af9b99c84 Format 2019-12-04 08:41:16 -08:00
David Ungar
496e602bff Renaming files 2019-12-04 08:38:59 -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
Robert Widmann
16bd20e30b Merge pull request #17581 from huonw/validate-tbd-by-default-everywhere
[Don't merge] [TBD] Validate TBDs in debug compilers for all platforms.
2019-12-02 10:44:49 -08:00
Tapan Thaker
322ad482b6 [FrondEnd] Wrap RunInmediately() in a pretty stack trace indicating we are running user code 2019-11-30 12:33:28 -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
swift_jenkins
372ccf43e6 Merge remote-tracking branch 'origin/master' into master-next 2019-11-19 15:59:40 -08:00
Mishal Shah
b8866006c3 Revert "[FrontEnd] Pretty stack trace indicating running user code" 2019-11-19 15:37:58 -08:00
swift_jenkins
96e95791e8 Merge remote-tracking branch 'origin/master' into master-next 2019-11-19 10:39:18 -08:00
swift_jenkins
b9f998ffa4 Merge remote-tracking branch 'origin/master' into master-next 2019-11-15 15:56:48 -08:00
Tapan Thaker
f2f521f8bf [FrondEnd] Wrap RunInmediately() in a pretty stack trace indicating we are running user code 2019-11-15 07:29:29 -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
Tony Allevato
3c45041b17 Add driver modes to emit and dump Clang precompiled modules. 2019-11-11 15:00:51 -08:00
swift-ci
03eeaf3a4b Merge remote-tracking branch 'origin/master' into master-next 2019-11-01 17:29:49 -07:00
Varun Gandhi
0f277aca15 [Frontend] Avoid crashing in trace emission due to "duplicate" swiftinterfaces. 2019-11-01 11:26:51 -07:00
swift-ci
ae278ae961 Merge remote-tracking branch 'origin/master' into master-next 2019-10-30 14:50:00 -07:00
Owen Voorhees
8a6711769e [Diagnostics] Refactor DiagnosticConsumer interface
DiagnosticInfo now holds all the information needed to consume
a diagnostic, so remove unneeded parameters from handleDiagnostic.
2019-10-29 13:52:12 -07:00
Xi Ge
64c0680686 Merge remote-tracking branch 'apple/master' into master-next 2019-10-28 10:19:36 -07:00
Varun Gandhi
ab1381a808 [Frontend] Weaken validation when emitting a trace. (#27737)
Fixes rdar://problem/56333192.
2019-10-17 09:32:10 -07:00
Varun Gandhi
903add2c3f [Frontend] Make the module trace emission more robust.
✔ More informative error messages in case of crashes.
✔ Handling and documenting different cases.
✔ Test cases for different cases.
✔ Make SDKDependencies.swift pass again.
2019-10-15 15:44:26 -07:00
swift-ci
31004db03c Merge remote-tracking branch 'origin/master' into master-next 2019-10-03 18:29:24 -07:00
Slava Pestov
55a6693da8 Frontend: -emit-silgen exits with non-zero status code if a diagnostic was emitted 2019-10-03 17:11:44 -04:00
swift-ci
abcec82ca5 Merge remote-tracking branch 'origin/master' into master-next 2019-09-22 19:30:00 -07:00
David Ungar
3c891f9532 Fully eager for printing, just eager enough for type-checking. 2019-09-22 17:59:40 -07:00
swift-ci
6e2d90770c Merge remote-tracking branch 'origin/master' into master-next 2019-09-17 09:09:58 -07:00
Jordan Rose
94265e8163 [Frontend] Add a comment about 9e6d4db (#27169)
With wording help from David U.
2019-09-17 09:05:23 -07:00
swift-ci
0c440ff5ef Merge remote-tracking branch 'origin/master' into master-next 2019-09-13 20:49:32 -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
Harlan Haskins
fafc5832fe [ModuleInterfaces] ParseableInterfaceModuleLoader -> ModuleInterfaceLoader
Rename this class to better fit the user-facing name.
2019-09-13 13:40:01 -07:00
swift-ci
cdffb88fe8 Merge remote-tracking branch 'origin/master' into master-next 2019-09-12 18:10:45 -07:00
Jordan Rose
9e6d4db6d0 [Frontend] Avoid doing whole-module work under primary-file typecheck (#27153)
...a situation we get into with indexing. The way Xcode generates
indexing invocations is to take a build command and add additional
flags to it; in order for the Driver to produce a single frontend
command from /that/, it currently plans as if it's going to do a
whole-module -typecheck and then turns around and uses -primary-file
anyway. This is questionable practice, to be sure...

...but meanwhile, let's not crash by trying to access declarations
that haven't been type-checked yet.

rdar://problem/53117124
2019-09-12 17:53:06 -07:00
Mike Ash
f5e7ab866c Merge branch 'master' into master-next 2019-09-09 12:11:25 -04:00
Slava Pestov
859b37e782 Frontend: Only build and generate a single SILModule at a time
Instead of SILGen'ing all primary files before we go on to optimize
and IRGen them, run each file to completion before starting the next
one. This reduces memory usage.
2019-09-06 21:50:15 -04:00
Slava Pestov
01e65e18c4 SIL: Share TypeConverter between SILModules in batch mode 2019-09-06 21:50:15 -04:00
swift-ci
f4374ed77c Merge remote-tracking branch 'origin/master' into master-next 2019-09-03 09:49:53 -07:00
Varun Gandhi
4bd7a89bd6 Skip module trace emission if we encountered errors when compiling.
Fixes rdar://problem/54860311.
2019-08-30 16:14:18 -07:00