Commit Graph

64 Commits

Author SHA1 Message Date
Robert Widmann
81e9a3f660 [NFC] Drop PerformJobsState as a friend class
Make the coupling between PerformJobsState and Compilation indirect.
2018-07-10 14:57:01 -07:00
Graydon Hoare
8be2c53b24 [BatchMode] Add -driver-batch-count to allow overriding batch count inferred by -j 2018-06-14 11:51:31 -07:00
Robert Widmann
da13d89c24 Move DummyQueue logic into buildTaskQueue 2018-05-29 21:58:27 -07:00
Robert Widmann
d7493dd0fa [NFC] Expose the TaskQueue as a Compilation Parameter
Shuffle the responsibility for creating the TaskQueue out of the
Compilation's internal job state object and into the driver.  Expose
a builder convenience function that handles the argument parsing.
2018-05-29 21:58:27 -07:00
Argyrios Kyrtzidis
0682756a72 Merge pull request #15743 from nathawes/rdar38231888-sourcekit-error-when-parsing-the-compiler-arguments
[Driver] Add -driver-filelist-threshold to set the number of inputs beyond which filelists are used
2018-04-12 19:10:40 -07:00
Nathan Hawes
0a4204e99f [Driver] Add -driver-filelist-threshold to set the number of inputs beyond which filelists are used
When generating a compiler invocation in driver::createCompilerInvocation()
we end up using filelists if the number of inputs is > 128 (to work around
command line arg limits). We never actually write them out though, and so
fail when parsing the frontend arguments that reference them.

As this function is called frequently by SourceKit and command line limits
aren't a concern here, this patch makes the 128 threshold value configurable
via a new -driver-filelist-threshold option. This is set to its maximum value
in driver::createCompilerInvocation() to ensure filelists aren't used. This
new option makes the existing -driver-use-filelists (that forces filelists to
be used) redundant as it's now equivalent to -driver-filelist-threshold=0.

Resolves rdar://problem/38231888
2018-04-12 05:24:03 -07:00
David Ungar
906e1cadc3 Add some "consts" to the Driver. 2018-04-06 18:47:48 -07:00
Rintaro Ishizaki
2cec8dfc99 [Driver] Factor out build-record filename construction
* Retrive filename for read and write at the same time.
* Read LastBuildTime directly from the build record.
2018-04-03 20:39:55 +09:00
Rintaro Ishizaki
18ceef56e3 [Driver] Use separated build record file for '-emit-module' only mode
* In full compilation '-c' with '-emit-module', output duplicated build
  record file for full compilation *and* emit module ('~moduleonly') mode.
* In '-emit-module' only mode, use '~moduleonly' build record.
2018-04-02 21:04:13 +09:00
David Ungar
90773d298c Write out filemaps for supplementary outputs.
Add -driver-force-one-batch-repartition and enhance  batch_mode-overlong_argv test.
2018-03-20 09:42:13 -07:00
David Ungar
17a81f6981 Restore -### functionality for batch-mode by extending OutputLevel. 2018-03-05 11:07:20 -08:00
Graydon Hoare
263c4c54d5 [BatchMode] Preserve intra-batch order, add a seed mode. 2018-02-20 18:31:41 -08:00
Graydon Hoare
3d9ce0afb9 [BatchMode] Store -{enable,disable}-batch-mode as a flag in Compilation. 2018-02-15 15:38:09 -08:00
Graydon Hoare
798f43cf5f [BatchMode] Make Compilation::TheToolChain available to clients. 2018-02-15 15:38:08 -08:00
Graydon Hoare
a2c718777d [BatchMode] Pass OutputInfo to Compilation on construction. 2018-02-15 15:38:08 -08:00
Graydon Hoare
e03e61a32a [BatchMode] Add Compilation::DerivedOutputFileMap. 2018-02-09 14:06:22 -08:00
Graydon Hoare
36b7c76fde [BatchMode] Mark Compilation::TheToolChain as LLVM_ATTRIBUTE_UNUSED for now. 2018-02-09 14:06:16 -08:00
Graydon Hoare
d139ab2968 [BatchMode] Expand lifetime of ToolChain, pass reference to it to Compilation. 2018-01-24 10:31:19 -08:00
Jordan Rose
47872d9190 [Driver] Transfer all ownership of Actions to the Compilation.
Previously, Actions were responsible for freeing their inputs...
except for the ones that weren't. Or the ones that were supposed
to, but then they needed to share an input, so they couldn't anymore.
If this sounds ridiculous, you're right; now Actions are just
immediately allocated and owned by the Compilation.

The graph structure of the actions is still useful for some things; in
particular, "top-level" actions get to put their outputs somewhere
permanent rather than TMPDIR. But I expect these things to get cleaned
up in the future too.
2017-08-11 21:09:34 -07:00
Jordan Rose
64df9b1edc [Driver] Actually free Actions instead of just leaking them.
Fixes rdar://problem/32518867, though in a fairly messy way. Next
commit will clean this up again.
2017-08-11 21:09:34 -07:00
Jordan Rose
a875d8c7c7 [Driver] Preserve filelists when a subprocess crashes. (#9849)
This should make it easier to rerun crashed jobs that use filelists;
previously you'd have to run the top-level driver command again with
-save-temps. I didn't want to save /all/ temporary files because that
often includes things like .o files, which could fill up your disk
pretty quickly. But we can always tweak this later.
2017-05-22 17:14:20 -07:00
Huon Wilson
7e8568d03d [Driver] Main compiler tells frontend to -emit-loaded-module-trace. 2017-04-21 11:14:29 -07:00
Graydon Hoare
0245c83c4b [Stats] Add -stats-output-dir, wire UnifiedStatsReporter into place. 2017-04-03 18:08:59 -07:00
Graydon Hoare
ec5d4f3ea1 [Driver] Put new job-lifecycle diagnostic chatter behind another option. 2017-03-01 09:07:21 -08:00
Graydon Hoare
ab5201f60e [Driver] Make PerformJobsState a mostly-private class. 2017-02-28 15:17:26 -08:00
Graydon Hoare
01655789a0 [Driver] Move some function-local state into PerformJobState. 2017-02-28 13:22:20 -08:00
Bob Wilson
37e7d1c627 Merge remote-tracking branch 'origin/master' into master-next 2017-01-08 17:07:46 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Bob Wilson
13da3fa8b1 Merge remote-tracking branch 'origin/master' into master-next 2016-12-04 18:16:09 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Bob Wilson
5c4f517824 Checkpoint fixes for llvm r284966 (TimeValue) 2016-10-28 12:09:57 -07:00
Brian Gesiak
ba8009bfa3 [SR-1788] Add -driver-time-compilation option (#4367)
Add an option to print the time it takes each driver task to complete.

Here's an example of the output:

```
$ swiftc -driver-time-compilation \
         -emit-library -module-name Crispix \
         Crispix/A.swift Crispix/B.swift Crispix/C.swift
===-------------------------------------------------------------------------===
                           Driver Time Compilation
===-------------------------------------------------------------------------===
  Total Execution Time: 0.0000 seconds (0.0875 wall clock)

   ---Wall Time---  --- Name ---
   0.0245 ( 28.0%)  link /path/to/Crispix/A.swift /path/to/Crispix/B.swift /path/to/Crispix/C.swift
   0.0211 ( 24.1%)  compile /path/to/Crispix/A.swift
   0.0209 ( 23.9%)  compile /path/to/Crispix/B.swift
   0.0176 ( 20.1%)  compile /path/to/Crispix/C.swift
   0.0035 (  4.0%)  swift-autolink-extract /path/to/Crispix/A.swift /path/to/Crispix/B.swift /path/to/Crispix/C.swift
   0.0875 (100.0%)  Total
```
2016-08-23 13:35:48 -07:00
Jordan Rose
f8bb54f6e6 [Driver] Pass around 'const char *' instead of 'const std::string &'.
No functionality change -- lifetime extension is handled by the
ArgumentList already owned by the Compilation.
2016-01-13 18:39:24 -08:00
Jordan Rose
b45a69ef09 [Driver] Allow passing all source files in a filelist.
Generate frontend commands with -filelist in them. This isn't actually
implemented yet, but we can start testing at this point.

Part 1 of https://bugs.swift.org/browse/SR-280.
2016-01-12 19:20:50 -08:00
Jordan Rose
7be3effeed [Driver] Remove an unused accessor.
No one should be accessing the raw input argument list; it's there merely
to keep the info about the derived argument list alive.
2016-01-12 16:17:27 -08:00
Jordan Rose
7552d49c4a [Driver] Eliminate unused fields from Compilation.
No functionality change.
2016-01-12 16:17:27 -08:00
Jordan Rose
5f78d24e85 [Driver] Make the list of input files available when creating Jobs.
Previously jobs had to grovel this information out of the raw argument
list, which dropped the types we had inferred on input files. This
makes things more consistent across the compiler, though arguably we
should be able to designate "primary" and "non-primary" inputs on a
per-action basis rather than resorting to "global" state.

Use this new information to stop passing object file inputs to the
Swift frontend, fixing rdar://problem/23213785.

The list wouldn't have to live on the Compilation, but I'm going to use
it to fix SR-280 / rdar://problem/23878192 as well.
2016-01-12 11:52:31 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Michael Gottesman
c03adef030 Fix "Adjust to InputArgList being a move-only type"
DerivedArgList has a pointer to the InputArgList it came from, so we can't
just std::move it around. Put most of the driver back the way it was, with
small changes to clarify ownership.

Swift SVN r31811
2015-09-09 04:37:29 +00:00
Michael Gottesman
d6cdce1013 Adjust to InputArgList being a move-only type
Swift SVN r31800
2015-09-09 04:37:17 +00:00
Jordan Rose
45189f9feb [Driver] Add a basic tracing mode to determine why files are getting rebuilt.
Enabled with -driver-show-incremental. For debugging purposes only.

Swift SVN r29804
2015-06-30 19:31:07 +00:00
Jordan Rose
036b083138 [Driver] Eliminate the JobList class.
This was just a wrapper around SmallVector that optionally owned the Job pointers
in it. Now that all Jobs are owned by the Compilation, we don't have to worry
about this any more.

No functionality change.

Swift SVN r29668
2015-06-25 15:45:45 +00:00
Jordan Rose
482cfac8a1 [Driver] Store all Jobs in a flat list in the Compilation object.
The Compilation is now the only owner of the Jobs.

No end-user functionality change.

Swift SVN r29667
2015-06-25 15:45:43 +00:00
Jordan Rose
4af8295600 [Driver] Put all jobs in a single task queue.
Previously, we would process all of a job's dependencies separately before
even scheduling it, and we wouldn't interleave dependencies from different
jobs. This meant (a) more overhead than necessary, and more importantly
(b) -embed-bitcode builds weren't being parallelized.

rdar://problem/21129029

Swift SVN r29665
2015-06-25 15:45:36 +00:00
Jordan Rose
2b7b78d162 [Driver] A .swift file should be rebuilt if its mtime has changed.
...not if it's newer than its output .o file. This handles cases where the
object file is generated too quickly (rdar://problem/19404140) or when you
revert to a previous version of the file, mtime intact (rdar://problem/19720146).

There's a lot of test churn here; the only real new test is the backwards
mtime update in one-way.swift.

Swift SVN r29584
2015-06-24 00:06:58 +00:00
Erik Eckstein
cedc6c5671 Driver: simplify handling of temporary files.
Should be NFC.



Swift SVN r26228
2015-03-17 17:06:25 +00:00
Argyrios Kyrtzidis
7fd2ca6fc9 [driver] Introduce 'continue-after-building' functionality in the driver.
The '-update-code' mode is taking advantage of it to go through all the swift files, even though they have errors.

Swift SVN r24902
2015-02-02 21:57:04 +00:00
Jordan Rose
6e0df7d65e [Driver] Rebuild everything when command-line arguments change.
If certain command-line arguments change, the results of the last
compilation aren't reusable, i.e. we can't do an incremental build.
Do a full rebuild when we detect that this happens.

(Which command-line options? Conservatively assume all of them, /except/
those with the new DoesNotAffectIncrementalBuild flag in Options.td.)

Swift SVN r24385
2015-01-13 01:11:38 +00:00
Jordan Rose
94e7a284bd [Driver] Write out a record of which files were compiled in a build.
This is important because we might get part-way through the full
compilation, overwriting swiftdeps files as we go, and then encounter an
error. We don't want to lose information about any decls that have been
removed since the previous compile, so we propagate forward the information
we already have by saving it to a "build record" file.

More simply, this is necessary to track when a file is removed from a target.

The next commit will handle reading in this file at the start of a build.

Swift SVN r23968
2014-12-17 00:26:28 +00:00
Jordan Rose
c385a9d43a [Driver] Make the "incremental" flag an explicit part of Compilation.
No functionality change. Laying groundwork for the next commit.

Swift SVN r23965
2014-12-17 00:26:23 +00:00