Commit Graph

68 Commits

Author SHA1 Message Date
Jordan Rose
dbd0d47568 [Driver] Only JobActions have inputs, not InputActions.
Also, cluster the flags on Action into a single word. This probably doesn't
make any real difference, but it's the convention.

No functionality change.
2016-01-12 11:52:31 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Jordan Rose
6d9b5cb8ed [Driver] Factor interpret-script mode out into a separate Action.
This makes it easier to make interpreter modes behave differently from
compilation modes. Obviously that's a trade-off, since the two modes also
share plenty, but given how few of the existing CompileJobAction checks had
to be modified for the new InterpretJobAction, I think this is the right
way to go.

Groundwork for setting [DY]LD_LIBRARY_PATH ahead of time when invoking the
interpreter, which is rdar://problem/23588774.
2015-12-04 12:18:45 -08:00
Jordan Rose
9b55933e02 Check to see if any source files were modified during the build.
For now, just error out at the end of the build if something was modified,
forcing a rebuild. The incremental logic should get that rebuild right.
We could automatically restart the rebuild, but that could lead to infinite
compilation if the user continues to edit an important file.
2015-11-03 17:53:32 -08:00
Adrian Prantl
0de0d43773 Introduce a -modulewrap driver action that wraps a (merged) .swiftmodule
inside a swift ast section in an object file so it can be passed to the
linker. The driver automatically wraps merged swiftmodules iff the target
is ELF.

rdar://problem/22407666

Swift SVN r31641
2015-09-02 21:56:25 +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
Jordan Rose
4dacca912d [Driver] Don't full-rebuild when a new file is added.
Continue to full-rebuild when a file is removed, because we don't know what
was depending on it.

Swift SVN r28776
2015-05-19 18:25:51 +00:00
Erik Eckstein
50423166aa Driver: fix a few things to get -embed-bitcode working with multi-threaded compilation.
Swift SVN r28517
2015-05-13 17:52:57 +00:00
Manman Ren
391e731796 [Driver] add -embed-bitcode for bitcode store project.
With -embed-bitcode, we will invoke swift twice, once to generate the bitcode
file, the second time to perform code generation on the bitcode file.

For now, -embed-bitcode causes -incremental builds to not be incremental,
because of potential issues of mixing the two.

rdar://19048891


Swift SVN r25559
2015-02-26 19:53:12 +00:00
Graham Batty
078a558b26 Extract autolink information as a compile step.
Swift SVN r25510
2015-02-24 20:33:05 +00:00
Jordan Rose
43bcbb8f9e [Driver] Handle outstanding jobs by reading the build record.
r23968 wrote out a record of which source files were included in a build,
and whether they were succesfully compiled or not...and if not, whether
they were out of date because of a cascading or non-cascading dependency.
This commit uses that information to decide what files might need to be
rebuilt even if a particular input doesn't change and doesn't appear to
have any changed dependencies. The two interesting cases are:

- A file was going to be built last time, but the build was halted
  because of an error. Build it this time.
- One of the files was removed and thus we've lost a source of dependency
  information; rebuild everything!

rdar://problem/19270980

Swift SVN r24018
2014-12-18 21:24:18 +00:00
Jordan Rose
69533b53f7 [Driver] Invoke dsymutil after linking when invoked with -g.
This matches Clang's behavior, though this implementation does not check
that it's actually on a platform that uses dsymutil.

<rdar://problem/16012971>

Swift SVN r20529
2014-07-25 01:31:40 +00:00
Jordan Rose
9c6ddc085f [driver] Add -lldb-repl and -integrated-repl modes.
Since LLDB is taking over as the REPL for Swift, we eventually want "swift"
and "swift -repl" to invoke "lldb --repl" rather than the frontend. However,
we only want to do this if the LLDB that's present is related to the Swift
that's present -- we don't want to invoke some random LLDB on the system
or in some other Xcode installation. Therefore, Swift searches for LLDB--
first next to the driver, then in the usr/bin/ outside of a toolchain--
before choosing to use it.

If the user just passes -repl and an LLDB is not found relative to the
driver, the existing "integrated" REPL will be launched instead.*

If the user passes -lldb-repl and an LLDB is not found relative to the
driver, one from the user's PATH will be chosen (like the linker).

The user can also pass -integrated-repl to get the existing behavior.
"swift -frontend -repl" always uses the integrated REPL.

* Since LLDB's not quite ready to be the REPL yet, "swift -repl" still
invokes the integrated REPL. "swift -repl -experimental-prefer-lldb" tests
the new behavior; this option will become the default (and the flag removed)
in <rdar://problem/16776719>.

<rdar://problem/16776705>

Swift SVN r17134
2014-05-01 02:15:53 +00:00
Jordan Rose
b77dccef4e [driver] Add the -emit-library option.
This emits a dynamic library as the final build product (rather than an
executable), as well as implicitly passing -parse-as-library to the frontend.

Swift SVN r12930
2014-01-24 19:46:39 +00:00
Connor Wakamo
bb439764b4 [driver] Implemented driver-level support for immediate mode and the REPL.
Introduced OutputInfo::Mode and OutputInfo::CompilerMode, which dictate how the
driver should invoke the integrated frontend. Currently, there are three
options:

- StandardCompile: invoke the frontend once-per-input, using -primary-file
- REPL: invoke the frontend as the REPL
- Immediate: invoke the frontend in immediate mode

Updated buildOutputInfo() to properly set the CompilerMode, and updated
buildActions() and Swift::constructJob() to honor the CompilerMode.

With these changes, "swift_driver" (with no inputs) and "swift_driver -repl"
should invoke the REPL, and "swift_driver -i" should invoke the frontend in
immediate mode.

Swift SVN r12547
2014-01-18 20:55:21 +00:00
Connor Wakamo
c4a4ab3596 [driver] Added initial infrastructure for generating a Command which merges swiftmodule files.
Added a MergeModuleJobAction, which will be translated into a Command which merges swiftmodule files.
Added a MergeModule subclass of Tool, which will generate a Command which merges swiftmodule files. (Currently, it generates a Command which invokes “swift_driver -frontend -help”.)
Added ToolChain-level support for getting the MergeModule Tool.

Nothing produces MergeModuleJobActions yet; adding that to the Action dependency graph should be enough to get this going.

Swift SVN r12491
2014-01-17 19:39:20 +00:00
Connor Wakamo
e3ea68658c [driver] Added Action::addInput() for adding inputs after creation.
Swift SVN r12434
2014-01-16 23:42:55 +00:00
Connor Wakamo
ed2038585f Initial set of changes to add a new 'swift_driver' executable.
- Added a couple of new targets:
  - libswiftDriver, which contains most of the driver implementation
  - swift_driver, which produces the actual executable

- Added centralized version information into libswiftBasic.

- Added a new "Driver Design & Internals" document, which currently describes
  the high-level design of the Swift driver.

- Implemented an early version of the functionality of the driver, including
  versions of the Parse, Pipeline, Bind, Translate, and Execute driver stages.
  Parse, Pipeline, and Bind are largely implemented; Translate and Execute are
  early placeholders. (Translate produces "swift_driver --version" and "ld -v"
  commands, while Execute performs all subtasks sequentially, rather than in
  parallel.)

This is just the starting point for the Swift driver. Tests for the existing
behavior are forthcoming.

Swift SVN r10933
2013-12-06 21:23:01 +00:00