Commit Graph

1260 Commits

Author SHA1 Message Date
David Ungar
ebb77e8ee8 ExpDepGraph -> FineGrainedDepGraph 2019-12-08 09:44:47 -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
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
Butta
14cc620016 [android] A few tweaks for native compilation and to get more tests working
Now that CMAKE_HOST_SYSTEM_NAME and CMAKE_SYSTEM_NAME are set by default to
Android in the Termux app, make the needed tweaks. Some tests were adapted
to work natively on Android too, adds sys/cdefs.h to the Bionic modulemap,
and includes the start of native Android platform support in the build-script.
2019-12-07 01:01:59 +05:30
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
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
David Ungar
86a76cb2ea Merge pull request #28566 from davidungar/renaming-dependencies-2
Rename older dependency graph to "CoarseGrainedDependencyGraph"
2019-12-05 09:35:33 -08:00
Saleem Abdulrasool
23b1a6b87a Driver: add support for WASI/WASM toolchain
Treat WASM/WASI as a generic Unix toolchain.  This adds the necessary
support to build a toolchain for WASM/WASI.
2019-12-04 20:14:08 -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
Daniel Rodríguez Troitiño
5a6343f6f4 Merge pull request #28561 from compnerd/spectre-humanised
Driver: fix the Windows build after #28543
2019-12-04 12:22:07 -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
Saleem Abdulrasool
ed4fe81129 Driver: fix the Windows build after #28543
Repair the VS2017 build after #28543.  It would fail to convert the
dependency set's keys into a vector of StringRefs:

```
error C2678: binary '*': no operator found which takes a left-hand operand of type 'const _Iter' (or there is no acceptable conversion)
        with [
            _Iter=llvm::StringMapKeyIterator<char>
        ]
C:\agent\_work\2\s\toolchain\llvm\include\llvm/ADT/StringMap.h(549): note: could be 'llvm::StringRef &llvm::StringMapKeyIterator<ValueTy>::operator *(void)'
        with
        [
            ValueTy=char
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\\include\xmemory(217): note: while trying to match the argument list '(const _Iter)'
        with
        [
            _Iter=llvm::StringMapKeyIterator<char>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\\include\vector(1823): note: see reference to function template instantiation '_FwdIt *std::_Uninitialized_copy<_Iter,llvm::StringRef*,std::allocator<_Ty>>(const _InIt,const _InIt,_FwdIt,_Alloc &)' being compiled
        with
        [
            _FwdIt=llvm::StringRef *,
            _Iter=llvm::StringMapKeyIterator<char>,
            _Ty=llvm::StringRef,
            _InIt=llvm::StringMapKeyIterator<char>,
            _Alloc=std::allocator<llvm::StringRef>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\\include\vector(708): note: see reference to function template instantiation 'llvm::StringRef *std::vector<llvm::StringRef,std::allocator<_Ty>>::_Ucopy<_Iter>(_Iter,_Iter,llvm::StringRef *)' being compiled
        with
        [
            _Ty=llvm::StringRef,
            _Iter=llvm::StringMapKeyIterator<char>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\\include\vector(708): note: see reference to function template instantiation 'llvm::StringRef *std::vector<llvm::StringRef,std::allocator<_Ty>>::_Ucopy<_Iter>(_Iter,_Iter,llvm::StringRef *)' being compiled
        with
        [
            _Ty=llvm::StringRef,
            _Iter=llvm::StringMapKeyIterator<char>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\\include\vector(723): note: see reference to function template instantiation 'void std::vector<llvm::StringRef,std::allocator<_Ty>>::_Range_construct_or_tidy<_Iter>(_Iter,_Iter,std::forward_iterator_tag)' being compiled
        with
        [
            _Ty=llvm::StringRef,
            _Iter=llvm::StringMapKeyIterator<char>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\\include\vector(723): note: see reference to function template instantiation 'void std::vector<llvm::StringRef,std::allocator<_Ty>>::_Range_construct_or_tidy<_Iter>(_Iter,_Iter,std::forward_iterator_tag)' being compiled
        with
        [
            _Ty=llvm::StringRef,
            _Iter=llvm::StringMapKeyIterator<char>
        ]
C:\agent\_work\2\s\toolchain\swift\lib\Driver\Compilation.cpp(1571): note: see reference to function template instantiation 'std::vector<llvm::StringRef,std::allocator<_Ty>>::vector<IteratorT,void>(_Iter,_Iter,const _Alloc &)' being compiled
        with
        [
            _Ty=llvm::StringRef,
            IteratorT=llvm::StringMapKeyIterator<char>,
            _Iter=llvm::StringMapKeyIterator<char>,
            _Alloc=std::allocator<llvm::StringRef>
        ]
C:\agent\_work\2\s\toolchain\swift\lib\Driver\Compilation.cpp(1571): note: see reference to function template instantiation 'std::vector<llvm::StringRef,std::allocator<_Ty>>::vector<IteratorT,void>(_Iter,_Iter,const _Alloc &)' being compiled
        with
        [
            _Ty=llvm::StringRef,
            IteratorT=llvm::StringMapKeyIterator<char>,
            _Iter=llvm::StringMapKeyIterator<char>,
            _Alloc=std::allocator<llvm::StringRef>
        ]
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\\include\xmemory(217): error C2100: illegal indirection
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\\include\xmemory(217): error C2062: type 'unknown-type' unexpected
```

Attempt to make it more explicit with a `std::copy`.
2019-12-04 09:30:12 -08:00
David Ungar
4d2c46c9a5 Format 2019-12-04 08:51:33 -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
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
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
5b0c4b2486 Fix memory violation when build record is bad. 2019-11-22 14:56:31 -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
3ff6c1c315 Merge pull request #28347 from davidungar/rdar-56946329-dynlink-filelist
[Driver] Use correct designator for filelist for dynamic link job
2019-11-21 11:31:39 -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
46ad660606 untested minor refact 2019-11-20 13:28:52 -08:00
David Ungar
468a23cef9 report stages unfmt 2019-11-20 13:28:19 -08:00
swift_jenkins
f60eec9290 Merge remote-tracking branch 'origin/master' into master-next 2019-11-20 13:20:27 -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
David Ungar
e4fb791a3c bug fix unfmt 2019-11-19 12:30:43 -08:00
David Ungar
ee17f61179 factor out comparator and report supp jobs 2019-11-19 12:22:04 -08:00
David Ungar
d2146d1c47 Report falling back differently. 2019-11-18 23:09:58 -08:00
David Ungar
5d25cd8571 Print negative build decisions with -show-incremental 2019-11-18 22:58:34 -08:00
David Ungar
aee3cb482e Try both in filelist for linker 2019-11-18 22:19:43 -08:00
David Ungar
38a6559aa9 Take path arg for comparo 2019-11-18 20:23:10 -08:00
David Ungar
1f60d4479e Work with either source of inputs. 2019-11-18 17:53:52 -08:00
David Ungar
76c4742ba0 Use correct designator for filelist 2019-11-18 17:07:22 -08:00
Saleem Abdulrasool
6e234e6058 Driver: pass -target immediately after clang++ 2019-11-18 16:49:09 -08:00
David Ungar
0a0d22abab fmt 2019-11-16 23:54:52 -08:00
David Ungar
edbbdb65c7 WIP 2019-11-16 23:41:31 -08:00
David Ungar
a6bf84e20b refactoring WIP unfmt 2019-11-16 23:17:37 -08:00
David Ungar
3433bf8cef comparision WIP 2019-11-16 21:39:19 -08:00