Commit Graph

1559 Commits

Author SHA1 Message Date
Andrew Trick
731000b4cd Added -sil-print-all and -sil-verify-all options.
Swift SVN r13662
2014-02-07 23:07:11 +00:00
Connor Wakamo
9df53c5c71 [frontend] Switch -debug-assert-* from llvm_unreachable() to assert(0).
Swift SVN r13656
2014-02-07 22:30:40 +00:00
Connor Wakamo
9747d87ff6 [frontend] Added a handful of options to force the frontend to assert or crash.
Added -debug-assert-immediately and -debug-crash-immediately, which cause an
llvm_unreachable or LLVM_BUILTIN_TRAP to execute during argument parsing.

Added -debug-assert-after-parse and -debug-crash-after-parse, which cause an
llvm_unreachable or LLVM_BUILTIN_TRAP to execute after calling
CompilerInstance::performParse().

This fixes <rdar://problem/16013025>.

Swift SVN r13653
2014-02-07 22:03:32 +00:00
Andrew Trick
04b2b5256b First implementation of <rdar://15922760> Deep devirtualization -
specialize on polymorphic arguments.

This can be enabled with: -sil-devirt-threshold 500.

It currently improves RC4 (when enabled) by 20%, but will be much more
important after Michael's load elimination with alias analysis lands.

This implementation is suitable for experimentation. Superficial code
reviews are also welcome. Although be warned that the design is overly
complex and I plan to rewrite it. I initially abandoned the idea of
incrementally specializing one function at a time, thinking that we
need to analyze full chains. However, I since realized after talking
to Nadav that the incremental approach can be made to work. A lot of
book-keeping will go away with that change.

TODO:

- Resolve protocol argument types. Currently we assume they can be
  reinitialized at applies, but I don't think they can unless they are
  @inouts.  This is an issue with the existing local devirtualizer
  that prevents it working across calls.

- Properly mangle the specialized methods. Find existing
  specializations by demangling rather than maintaining a map.

- Rewrite the logic for specializing chains for simplicity.

- Enable by default.

Swift SVN r13642
2014-02-07 19:10:27 +00:00
Jordan Rose
302f9cb50d Disallow importing other Swift source files as modules.
Because this is useful in testing, I've left in a frontend option
-enable-source-import for both swift and swift-ide-test that sidesteps the
module restriction. Right now, though, this is the right thing to avoid
users running into strange issues when they import another file within
their module and Swift treats it as a separate module.

<rdar://problem/15937521>

Swift SVN r13248
2014-01-31 23:01:04 +00:00
Jordan Rose
0820d82e20 Rename '-enable-arc-opts=false' to '-disable-arc-opts'.
Part of the migration to the new driver. With this commit, the only
failures in the test suite using the new frontend are features we don't
intend to port over. Hooray!

Swift SVN r13198
2014-01-31 02:34:37 +00:00
Jordan Rose
6af4dbf0e9 Move SILLinkMode to SILOptions.
SILSerializeAll and EmitVerboseSIL are /not/ being moved because they are
options controlling the output, not about SILGen and SIL passes.

No functionality change.

Swift SVN r13197
2014-01-31 02:34:34 +00:00
Jordan Rose
c7f1064527 Extract '-sil-inline-threshold' from the performance inliner.
Plumbing this through to the inliner necessitated the creation of a
SILOptions class (like FrontendOptions and IRGenOptions). I'll move
more things into this soon.

One change: for compatibility with the new driver, the option must be
specified as "-sil-inline-threshold 50" instead of "-sil-inline-threshold=50".
(We're really trying to be consistent about joined-equals vs. separate
in the new frontend.)

Swift SVN r13193
2014-01-31 01:52:12 +00:00
Jordan Rose
bac31d985a Add '-sil-serialize-all' testing option to the new frontend.
Swift SVN r13190
2014-01-31 01:02:06 +00:00
Jordan Rose
e37d2393d1 Modules containing SIL may not be emitted before SIL diagnostics.
...and probably should not be emitted before optimization passes.
The new frontend got this wrong, and the old one pretended to allow it but
then silently didn't write a module at all.

Swift SVN r13189
2014-01-31 01:02:06 +00:00
Connor Wakamo
ba76567dea [frontend] In ParseIRGenArgs(), set IRGenOptions::ModuleName using the value in FrontendOptions.
Swift SVN r13186
2014-01-31 00:12:07 +00:00
Jordan Rose
f165afe1aa Replace "-enable-sil-linking=false" with "-disable-sil-linking".
Also, restructure so that the option isn't declared in a random library file.
(And do the same with "-sil-link-all".)

Part of the migration to the new driver.

Swift SVN r13184
2014-01-31 00:02:46 +00:00
Connor Wakamo
0d483cdd88 [driver] Emit real diagnostics in the driver and integrated frontend instead of just printing to stderr.
Added DiagnosticsDriver.def and DiagnosticsDriver.h for driver-only diagnostics.
(Diagnostics which are shared with the frontend remain in
DiagnosticsFrontend.{def,h}.)

Added a DiagnosticEngine& to Compilation, so that it can emit diagnostics for
events which occur while performing Jobs.

Replaced all of the locations where we were manually printing error messages to
emitting real diagnostics, adding diagnostics if necessary.

Updated Driver::buildCompilation() so that it fails early if any errors were
encountered.

Updated test/Driver/actions.swift to pass a -module-name for multi-input tests.

Swift SVN r13175
2014-01-30 22:42:16 +00:00
Jordan Rose
d0d4286d21 Put modules for 32-bit iOS builds in lib/swift/iphone{os,simulator}/32.
This keeps us from having to deal with fat swiftmodules for now.
In the long run we're hoping to solve this problem with build configurations,
so that a single module file can support multiple architectures.
(See <rdar://problem/15056323>)

<rdar://problem/15204953>

Swift SVN r13135
2014-01-30 03:26:50 +00:00
Jordan Rose
12fb34d60f Eliminate "Immediate" flag from CompilerInvocation.
This adds some ugliness in the current swift binary because we weren't
bothering to set a requested action before, but it keeps things simpler
elsewhere. (Thanks, Connor.)

Swift SVN r13067
2014-01-28 22:20:13 +00:00
Jordan Rose
cb358825d1 [driver] Set the Immediate flag in -i or -repl modes.
This activates a special mode where code is also generated for input files.
We don't really care about this for -i mode, but it makes -repl mode a bit
nicer.

Swift SVN r13044
2014-01-28 03:16:48 +00:00
Jordan Rose
4d69bebc08 [driver] -emit-module is not compatible with -i, -parse, or -repl.
Also, preserve the errors for "at least one input file" and "exactly one
input file".

Swift SVN r13042
2014-01-28 03:16:47 +00:00
Jordan Rose
8dc6098104 [driver] LLVM bitcode is a binary format; don't write it to stdout.
Swift SVN r13040
2014-01-28 03:16:46 +00:00
Jordan Rose
2132bfff49 Replace "-sdk=<path>" with "-sdk <path>" in tests.
Part of the migration to the new driver.

Swift SVN r13027
2014-01-28 01:42:38 +00:00
Connor Wakamo
38e1fd44af [frontend] Added support for -disable-llvm-arc-opts.
Adjusted how this option is handled: it is now set in IRGenOptions. If set,
this prevents the relevant passes from being added at all, instead of making
them no-ops.

Swift SVN r13005
2014-01-27 21:22:46 +00:00
Chris Lattner
2792e55be4 remove the -enable-new-objc-properties staging option, and
simplify some code.


Swift SVN r12976
2014-01-26 23:24:35 +00:00
Connor Wakamo
10ab8e9a87 [frontend] Adjusted the algorithm for determining a fallback module name.
If the OutputFilename points to a directory, fall back to the first
InputFilename.

This matches the behavior of the swift executable, and matches what would be
chosen if we could resolve the correct OutputFilename without knowing the module
name.

Swift SVN r12935
2014-01-24 21:43:20 +00:00
Connor Wakamo
6e77523342 [frontend] Add support for -enable-new-objc-properties to the integrated frontend.
Swift SVN r12928
2014-01-24 19:20:42 +00:00
Connor Wakamo
1ffcba47e8 [frontend] Fixed an issue with the default output filename algorithm.
If the user explicitly specified -module-name, prefer that to the base of the only input filename.
Also fixed an 80-column violation.

Swift SVN r12892
2014-01-24 00:35:17 +00:00
Connor Wakamo
399257e072 [frontend] Added a comment to indicate that the branch for choosing a default output filename should never be used when invoking the frontend via the driver.
Swift SVN r12882
2014-01-23 22:38:00 +00:00
Connor Wakamo
6325d2eac5 [frontend] Made EmitObject the default requested action.
This matches the behavior of the swift executable.

Swift SVN r12881
2014-01-23 22:20:07 +00:00
Connor Wakamo
6348426d3f [frontend] Added support for selecting a default OutputFilename.
If the user did not specify an OutputFilename, or if the user specified a
directory with -o, calculate a default OutputFilename based on the inputs,
module name, and requested action.

This matches the behavior of the swift executable.

Swift SVN r12880
2014-01-23 22:20:06 +00:00
Connor Wakamo
552558d03f [frontend] Removed the separate TargetOptions class.
TargetOptions only contained the target triple, which was duplicated in
IRGenOptions. These could get out-of-sync, which would cause issues during
IRGen. Since nothing was using TargetOptions other than CompilerInvocation,
removed TargetOptions in favor of making IRGenOptions the canonical home of the
target triple.

Swift SVN r12869
2014-01-23 19:07:55 +00:00
Connor Wakamo
b35b8451f4 [frontend] Fixed an issue with auto-detecting SIL input.
Swift SVN r12868
2014-01-23 18:30:54 +00:00
Connor Wakamo
39666501b0 [frontend] Added support for -enable-experimental-patterns to the integrated frontend.
Swift SVN r12867
2014-01-23 18:30:53 +00:00
Connor Wakamo
6dd1532788 [frontend] Added support for -disable-all-runtime-checks to the integrated frontend.
Swift SVN r12866
2014-01-23 18:30:53 +00:00
Jordan Rose
9cb81b0006 [driver] Add support for invoking ld.
swift_driver can now end-to-end compile a Swift file. Try it yourself!

echo 'println("hello")' | swift_driver -

Swift SVN r12840
2014-01-23 02:11:47 +00:00
Connor Wakamo
947f3be6e7 [driver] Removed the limited support for -module-source-list.
This option was never honored, and the main functionality that this option
would have implemented has been subsumed by -output-file-map.

Swift SVN r12800
2014-01-22 22:37:21 +00:00
Connor Wakamo
0a3202a46a [driver] Standardized the names of output-specifying options for secondary outputs.
The new format is "-<option>" and "-<option>-path". As a result:
  - Renamed -serialized-diagnostics-path to -serialize-diagnostics-path.
  - Renamed -module-output-path to -emit-module-path.

Swift SVN r12614
2014-01-20 23:16:22 +00:00
Connor Wakamo
de753a659b [frontend] Added a check to disallow the combination of -i and -primary-file.
Swift SVN r12524
2014-01-18 00:55:47 +00:00
Connor Wakamo
a23b6408a9 [frontend] Added a check to ensure REPL mode is not requested with input files.
Swift SVN r12523
2014-01-18 00:55:46 +00:00
Jordan Rose
11008f0ed1 Split diagnostics out into separate files.
Thanks to the way we've set up our diagnostics engine, there's not actually
a reason for /everything/ to get rebuilt when /one/ diagnostic changes.
I've split them up into five categories for now: Parse, Sema, SIL, IRGen,
and Frontend, plus a set of "Common" diagnostics that are used in multiple
areas of the compiler. We can massage this later.

No functionality change, but should speed up compile times!

Swift SVN r12438
2014-01-17 00:15:12 +00:00
Adrian Prantl
035a1175df Debug info: Ensure that the SDK is emitted if it is implicit. Also do a
slightly better job at quoting.
<rdar://problem/15808224> Point ClangImporter at the right SDK for the target

Swift SVN r12310
2014-01-15 01:51:41 +00:00
Connor Wakamo
3a1810336e [frontend] Implement support for emitting modules with the integrated frontend.
Added support for the -emit-module and -module-output-path options. -emit-module
and -module-output-path function similarly to -serialize-diagnostics and
-serialized-diagnostics-path: notably, -module-output-path implies -emit-module,
but -emit-module can be passed without -module-output-path and a default path
will be determined based on other inputs.

Added support for the -module-link-name option, which specifies the name of the
library to link against when importing the generated module.

Note that support for these options is only implemented in the integrated
frontend; driver-level support for these options is forthcoming.

Swift SVN r12301
2014-01-14 23:38:36 +00:00
Connor Wakamo
00f076daa5 [frontend] Implemented support for emitting serialized diagnostics.
Reworked the -serialize-diagnostics option, so that it is now just a flag
indicating that the frontend should generate serialized diagnostics. The path at
which the diagnostics will be serialized is now specified by the
-serialized-diagnostics-path option, which is a frontend-only option. (The
frontend treats -serialized-diagnostics-path as implying -serialize-diagnostics.)

If -serialize-diagnostics is passed but -serialized-diagnostics-path is not
passed, the frontend will choose an output path from a few default values:

- If the frontend has a non-stdout output path, replace that path's extension
  with .dia.
- If there is a primary input filename, use that input's base name as the base
  name for the serialized diagnostics file.
- Otherwise, use the module name as the base name for the serialized diagnostics
  file.

Added support for setting up a serialized diagnostics DiagnosticConsumer in
frontend_main() if FrontendOptions::SerializedDiagnosticsPath is non-empty.

Swift SVN r12251
2014-01-13 21:38:03 +00:00
Connor Wakamo
0b7569fab7 [frontend] Add proper support for determining the InputKind.
Added checks to determine if the input should be treated as SIL, Library, REPL, or Main, based on the command line arguments and inputs.

Swift SVN r12176
2014-01-11 00:33:31 +00:00
Connor Wakamo
b0f27de6b8 [frontend] Move InputKind from CompilerInvocation to FrontendOptions, and move handling of -parse-as-library to ParseFrontendArgs().
Swift SVN r12174
2014-01-11 00:33:30 +00:00
Connor Wakamo
044be74855 [frontend] Move ParseStdlib from CompilerInvocation to FrontendOptions, and move handling of -parse-stdlib to ParseFrontendArgs().
Swift SVN r12173
2014-01-11 00:33:30 +00:00
Connor Wakamo
a7460947bd [frontend] Made -primary-file accept a value (instead of relying on relative position of arguments).
Also added a -primary-file= alias.

Swift SVN r12171
2014-01-11 00:06:24 +00:00
Connor Wakamo
8c04586911 [frontend] Add support for specifying the primary input with the -primary-file flag.
Swift SVN r12150
2014-01-10 22:39:05 +00:00
Joe Groff
e06ee37dca Enable SIL protocol witnesses.
We should be able to cut out another layer of IRGen grime now.

This does XFAIL one test, test/Prototypes/TextFormatting.swift, which fails because of a weird archetype ordering in a nested substitution list. This should get sorted out by switching to interface types, so I'm going to let it go until then.

Swift SVN r11618
2013-12-24 04:36:03 +00:00
Greg Parker
0e360cb26e Install stdlib into /usr/lib/swift/<OS name>/.
This reinstates r11411 with fixes for the autoconf+make build.


Swift SVN r11494
2013-12-20 01:01:35 +00:00
Argyrios Kyrtzidis
21518ab695 [Frontend] When setting the MainInputFilename in the compiler invocation, check first that the input filenames vector is not empty.
Swift SVN r11484
2013-12-19 22:29:27 +00:00
Connor Wakamo
53a0acad66 [frontend] Added temporary support for setting MainInputFilename, Triple, and OutputFilename in IRGenOptions.
MainInputFilename and OutputFilename are pulled from the FrontendOptions, while Triple is parsed directly from the ArgList.
Eventually, MainInputFilename and OutputFilename should likely be removed from IRGenOptions, in favor of the values in FrontendOptions, while Triple will be in a separate TargetOptions class.

Swift SVN r11455
2013-12-18 23:42:53 +00:00
Connor Wakamo
0f6c51dd5b [frontend] Add support for -enable-dynamic-value-type-layout.
Swift SVN r11454
2013-12-18 23:42:53 +00:00