Commit Graph

75 Commits

Author SHA1 Message Date
Connor Wakamo
a982000175 [driver] Added a hidden -force-single-frontend-invocation option.
This sets OutputInfo::CompilerMode to a new SingleCompile mode, which in turn
causes the driver to create a single CompileJobAction for all inputs. This mode
also prevents the creation of a MergeModuleJobAction, since we can rely on the
frontend to generate a full swiftmodule.

This mode will allow the driver to properly compile the stdlib; if this mode is
necessary for other inputs, we can rename and publicize this option.

Swift SVN r12612
2014-01-20 21:47:17 +00:00
Chris Lattner
31dafade74 refactor addSwiftmoduleInputs out to be a static function to avoid a clang false
positive warning.


Swift SVN r12589
2014-01-20 17:55:55 +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
0203d5d32b Fix comment.
Swift SVN r12518
2014-01-18 00:24:01 +00:00
Connor Wakamo
6a33e53258 [driver] Renamed OutputMode to OutputInfo.
OutputInfo no longer just describes a "mode", so use a more applicable name for
the class.

Swift SVN r12501
2014-01-17 19:39:25 +00:00
Connor Wakamo
f99d60906c [driver] Use the OutputMode to determine the value to pass with -module-name.
Swift SVN r12499
2014-01-17 19:39:24 +00:00
Connor Wakamo
64a18140a1 [driver] Properly implemented MergeModule::constructJob().
This now effectively invokes “swift_driver -frontend -parse-as-library -emit-module -o <output path> <partial swiftmodules>”.

Swift SVN r12498
2014-01-17 19:39:23 +00:00
Connor Wakamo
db3888ba0f [driver] Replaced Tool::constructJob()’s LinkingOutput parameter with an OutputMode parameter.
Moved OutputMode out of Driver and directly into swift::driver.
Adjusted callers of Tool::constructJob() to pass an OutputMode.

Swift SVN r12497
2014-01-17 19:39:23 +00:00
Connor Wakamo
10810970b7 [driver] Added support for passing -emit-module to the frontend.
If the Swift tool is told to generate a command which produces a swiftmodule
additional output, pass -emit-module and -module-output-path. (Note that nothing
sets up this additional output yet; support for that is forthcoming.)

Swift SVN r12493
2014-01-17 19:39: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
824c0cb126 [driver] Reworked the CommandOutput class to add support for specifying additional outputs.
This will allow the driver to specify the location for, among other things, the partial swiftmodule generated by a single frontend invocation.

Swift SVN r12449
2014-01-17 01:11:55 +00:00
Connor Wakamo
40b38c40b2 [driver] Reworked Driver::buildJobsForAction() so that it doesn’t create the same Job multiple times.
Since a Job may be reached through multiple paths in the dependency graph, we
need to include support for caching Jobs. (Currently, the cache maps
Action/ToolChain pairs to Jobs.)

As a result of these changes, Tool::constructJob() and
Driver::buildJobsForAction() return a plain Job *, instead of a
std::unique_ptr<Job>, since the Jobs returned by buildJobsForAction() no longer
need to be unique.

Swift SVN r12443
2014-01-17 00:47:21 +00:00
Connor Wakamo
3f4a6efd44 [driver] Pass -serialize-diagnostics to the frontend, if requested.
Swift SVN r12252
2014-01-13 21:38:04 +00:00
Connor Wakamo
f0555a73a8 [driver] Add support for the -parse-sil option, including passing it through to the frontend.
Swift SVN r12175
2014-01-11 00:33:31 +00:00
Connor Wakamo
86fe23de29 [driver] Add support for passing -parse-as-library and -parse-stdlib to the frontend.
Swift SVN r12172
2014-01-11 00:33:29 +00:00
Connor Wakamo
ee7c66258a [driver] Add support for passing all inputs to the Swift frontend, selecting one per invocation with -primary-file.
Swift SVN r12151
2014-01-10 22:39:06 +00:00
Connor Wakamo
5303544046 [driver] Add support for passing -O to the integrated frontend.
Swift SVN r11451
2013-12-18 23:42:51 +00:00
Connor Wakamo
5a603a3cd1 [driver] Add support for -emit-ir and -emit-bc.
Added driver-level support for generating commands with -emit-ir and -emit-bc as well integrated frontend support for handling -emit-ir and -emit-bc.

Swift SVN r11375
2013-12-17 02:43:40 +00:00
Connor Wakamo
6127955b05 [driver] Add support for passing arguments after -- down to the frontend as-is if the driver is in immediate mode.
In Driver::translateInputArgs(), don’t break apart the OPT__DASH_DASH argument if we’re in immediate mode.
Mark OPT__DASH_DASH as being a FrontendOption.
In Swift::constructJob(), add support for types::TY_Nothing, and pass the argument for OPT__DASH_DASH as-is if the driver is invoking the frontend in immediate mode.

Swift SVN r11325
2013-12-15 00:58:27 +00:00
Connor Wakamo
85c2afcd90 [driver] Added support for -Xfrontend, which passes arguments through to the frontend.
Swift SVN r11166
2013-12-12 01:14:06 +00:00
Connor Wakamo
fb38d09bb1 [driver] Switch from passing “-triple” to “-target” to the integrated frontend.
Swift SVN r11097
2013-12-10 23:17:00 +00:00
Connor Wakamo
02c1532d27 Initial support for an integrated frontend in swift_driver.
- Added support for invoking the Swift frontend via "swift_driver -frontend".
- Added frontend_main.cpp, which implements the main entry point for the
  integrated frontend. (Currently, this supports compiling an input Swift file
  into an object file.)
- Removed lib/Frontend/FrontendOptions.td, and replaced its functionality with
  options in include/Swift/Driver/Options.td and a new
  include/Swift/Driver/FrontendOptions.td. Options supported by the frontend
  are denoted by the FrontendOption flag; options which are not supported by
  the driver are denoted by the NoDriverOption flag.
- Updated CompilerInvocation::parseArgs() to use the option table returned from
  createDriverOptTable(), including renaming a handful of options. (-triple is
  now -target, and -Xclang is now -Xcc.)

Swift SVN r11082
2013-12-10 18:06:54 +00:00
Connor Wakamo
725eda93a7 [driver] Reimplemented Swift::constructJob() so that it actually produces compile commands.
Instead of producing "swift_driver --version" commands, implemented support for producing
"swift" commands which actually compile code. (The support at this point is rudimentary,
but serves as a good starting point.)

Swift SVN r10949
2013-12-06 23:11:31 +00:00
Connor Wakamo
e93274315e [driver] Assert that the linker is only asked to produce outputs of type TY_Image.
Swift SVN r10948
2013-12-06 23:11:30 +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