Commit Graph

6605 Commits

Author SHA1 Message Date
Joe Groff
5340cec561 Add 'swift' back to the installation package.
Swift SVN r13863
2014-02-13 07:53:36 +00:00
Jordan Rose
f880250ea3 [Makefiles] Add missing dependency: swift_driver needs the PrintAsObjC library.
Should fix the LLDB build.

Swift SVN r13831
2014-02-12 18:25:52 +00:00
Jordan Rose
657565da73 [CMake] Eliminate SWIFT_NEW_DRIVER; everyone should be using the new driver.
swift_old will stick around for another week at least for A/B testing.
After that, "swift -frontend" will handle the low-level stuff, and
"swift -force-single-frontend-invocation" will do a high-level build
in the style of swift_old.

Swift SVN r13804
2014-02-12 01:43:56 +00:00
Jordan Rose
16f8ece6e6 Drop -print-as-objc from swift-ide-test.
Use "swift -emit-objc-header" (or "swift -emit-objc-header-path output.h")
instead.

Swift SVN r13802
2014-02-12 01:19:14 +00:00
Jordan Rose
c054bea3e4 [PrintAsObjC] Actually call printAsObjC when we pass -emit-objc-header.
Switch the existing tests over to using this.

Swift SVN r13801
2014-02-12 01:19:14 +00:00
Jordan Rose
95461797aa Move -print-as-objc feature into a library.
No functionality change.

Swift SVN r13798
2014-02-12 01:19:09 +00:00
Michael Gottesman
8cff098f1e Split SILCodeMotion into two passes, LoadStoreOpts and SILCodeMotion.
LoadStoreOpts removes duplicate loads, forwards stores to loads, and eliminates
dead stores.

Swift SVN r13789
2014-02-11 23:36:51 +00:00
Doug Gregor
eaf410f9f5 Import Objective-C instancetype methods as DynamicSelf methods.
This eliminates a pile of extra casting when interacting with
Objective-C APIs. Addresses the majority of <rdar://problem/14044307>,
but there is still cleanup to do.


Swift SVN r13780
2014-02-11 06:42:53 +00:00
Jordan Rose
0de8d19514 Define globals for the names of the stdlib, ObjectiveC, and Foundation modules.
This is mostly useful for the standard library, whose name is going to
change to "Swift" soon. (See <rdar://problem/15972383>.) But it's good DRY.

Swift SVN r13758
2014-02-10 22:40:42 +00:00
Argyrios Kyrtzidis
778c6cbe37 [Driver] When printing out the version also print out the submission version.
Swift SVN r13756
2014-02-10 19:10:01 +00:00
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
Jordan Rose
63df4a5604 [swift2objc] Handle subscripts.
This is the last major Objective-C declaration kind that shows up in
printing bridged Swift classes!

As we modify our set of permitting parameter types, we'll need to continue
adding special cases so that they come out reasonable, but the major
infrastructure work here is pretty much complete.

Swift SVN r13649
2014-02-07 20:08:56 +00:00
Jordan Rose
ddc54844a5 [swift2objc] References to non-@objc classes should come through as 'id'.
Forward-declaring a non-@objc class seems like the right thing to do, but
that could cause a name conflict with an existing @objc class (either
from Clang or from another module). Just use 'id' (and 'Class') to refer
to these.

Swift SVN r13645
2014-02-07 19:31:27 +00:00
Jordan Rose
532a6e0bd3 [swift2objc] Handle properties.
All properties are considered nonatomic. If a property comes from Objective-C,
the accessor names may be customized, so always print them out in that case.

Swift SVN r13644
2014-02-07 19:31:26 +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
Andrew Trick
47b936fbae Let passes get their options (current configuration) from the
PassManager.

I think this is much cleaner and more flexible. The various pass
builders have no business marshalling these things around, and they
shouldn't be bound to the pass C'tor. In the future we will be able
override and dynamically modify pass configuration this way.

Swift SVN r13626
2014-02-07 05:01:00 +00:00
Jordan Rose
a195661833 [swift2objc] Stop generating inline prefix info for every generated header.
Swift SVN r13618
2014-02-07 01:55:02 +00:00
Michael Gottesman
312cab7cca Change invoking id for AADumper in sil-opt from aa-evaluator => aa-dump.
Swift SVN r13604
2014-02-06 23:24:01 +00:00
Michael Gottesman
cd0e0b8c27 Rename AAEvaluator => AADumper as per request.
Swift SVN r13603
2014-02-06 23:19:35 +00:00
Nadav Rotem
591a42aae3 Rename a few more pass factory methods.
Swift SVN r13588
2014-02-06 17:52:18 +00:00
Nadav Rotem
7cfb83449e Rename the pass to AllocBoxToStack
Swift SVN r13586
2014-02-06 17:43:54 +00:00
Michael Gottesman
4c92002736 [sil-aa] Create utility pass AAEvaluator which just evaluates AA on all values in a function. This is so that tests can be written to test out the AA implementation.
Swift SVN r13578
2014-02-06 10:06:21 +00:00
Nadav Rotem
0651b9bbd0 Add a new Dominance Analysis that wraps DomInfo and PDomInfo, and migrate the
passes that use them.



Swift SVN r13571
2014-02-06 07:52:16 +00:00
Michael Gottesman
098fda670f [sil-aa] Change SIL AliasAnalysis into an Analysis.
Swift SVN r13550
2014-02-06 02:29:41 +00:00
Jordan Rose
65e386bbc4 [swift2objc] Print initializers (as init methods).
Swift SVN r13549
2014-02-06 02:25:28 +00:00
Jordan Rose
cf602d3527 [swift2objc] Handle arguments with ignored names (_).
A single argument specified as "func foo(_: Int)" gets its input parameters
represented as a ParenPattern around a TypedPattern, not a TuplePattern.

Swift SVN r13543
2014-02-06 01:52:01 +00:00
Jordan Rose
e1d349d8e3 [swift2objc] Don't print accessor methods.
We don't print properties at all right now, but trying to print accessors
results in output with "(null identifier)" where a selector piece should be.

Swift SVN r13542
2014-02-06 01:52:00 +00:00
Jordan Rose
6b9de74d96 [swift2objc] Forward-declare protocols and classes referenced in methods.
This lets us handle circular dependencies.

Swift SVN r13541
2014-02-06 01:51:57 +00:00
Jordan Rose
1cdb9a0de5 [swift2objc] Minor cleanup; no functionality change.
Swift SVN r13540
2014-02-06 01:51:55 +00:00
Jordan Rose
08093c7874 [swift2objc] Handle @optional methods in protocols.
Swift SVN r13539
2014-02-06 01:51:54 +00:00
Enrico Granata
270bac639d Unbreak the Makefile build - LLDB still needs it
Swift SVN r13534
2014-02-06 01:11:03 +00:00
Michael Gottesman
d57c18c789 [sil-opt] Move PM.run() outside of the loop that sets up the pass manager so we don't run it every time we add a new pass.
Swift SVN r13512
2014-02-05 22:21:47 +00:00
Michael Gottesman
d369b6dbed Add simple inst count pass for counting the various instructions in a module.
Swift SVN r13510
2014-02-05 22:11:40 +00:00
Nadav Rotem
18fac942e2 Migrate sil-opt and some passes to the new Pass Mananger.
Swift SVN r13509
2014-02-05 22:00:50 +00:00
Jordan Rose
335ceb2f57 Re-enable the new Swift driver.
This re-applies r13380, reverted in r13406. I don't think this actually
caused any harm (r13400 was the primary culprit), but if it did I'd
like to actually see the buildbots or someone else's machine fail on it.

Swift SVN r13456
2014-02-05 00:09:00 +00:00
Dave Abrahams
01e9139944 Revert "Enable the new Swift driver!"
This reverts r13380, which broke the build

Swift SVN r13406
2014-02-04 06:13:58 +00:00
Jordan Rose
16b5a57838 Enable the new Swift driver!
This substitutes swift_driver in as the new "swift". Tests that currently
test "%swift" will invoke "swift -frontend", much like "clang -cc1".
Most command-line interaction will look the same, except that Swift can
now emit linked libraries (using -emit-library) and executables (using
-emit-executable, or by not passing a mode option at all).

If you are working with @transparent functions, note that they will not be
properly inlined across file boundaries unless you use
-force-single-frontend-invocation, which emulates the old swift binary.
There are Radars for this already: <rdar://problem/15366167&15693042>

The name 'swift_driver' is now a symlink for 'swift'. This will be removed
next week.

The old 'swift' is still available as 'swift_old', though it is not being
tested at all. This will be removed in two weeks.

Clean CMake builds will get this immediately.

Incremental CMake builds will not get the new driver unless you explicitly
enable the SWIFT_NEW_DRIVER option (-DSWIFT_NEW_DRIVER=ON on the command line).
This option will go away in a week.

Makefile builds will get this immediately because I didn't want to work out
how to maintain both modes.

Much credit to Connor for bringing up the entire driver and for doing much
of the work in ensuring that all the tests continue to pass.

Swift SVN r13380
2014-02-03 22:48:39 +00:00
Jordan Rose
9b732bd4bc [CMake] Even in SWIFT_NEW_DRIVER mode, keep swift_driver around for now.
...as a symlink for "swift".

Swift SVN r13377
2014-02-03 22:24:50 +00:00
Doug Gregor
15c9359f05 Swift2ObjC: Print DynamicSelf as "instancetype".
... and properly register DynamicSelfType for serialization.


Swift SVN r13298
2014-02-01 07:11:28 +00:00
Enrico Granata
c0f101bbd9 Realized I had undone one change too many - this should build just fine
Swift SVN r13272
2014-02-01 01:24:05 +00:00
Enrico Granata
0f7d446d17 Add a -dump-module option to lldb-moduleimport-test that will dump the module's top level decls after successfully importing
Swift SVN r13271
2014-02-01 01:22:04 +00:00
Jordan Rose
2e75543c77 Switch over tests to run with the new driver.
Everything currently using "%swift" now invokes "swift_driver -frontend",
which is the new driver's equivalent of "clang -cc1".

Add a SWIFT_NEW_DRIVER mode to the CMake build.

Building with this set to ON will use the new driver for everything.
In this mode, tests currently using "%swift" will now invoke
"swift_driver -frontend", which is the new driver's equivalent of
"clang -cc1".

The only real change here is that the new driver uses "--" to pass arguments
to interpreted files, while the old one used "--args". Tests should use "--".

This will become the default very soon.

Swift SVN r13266
2014-02-01 01:19:59 +00:00
Mark Lacey
5c696fda8b Make IR generation take an explicit LLVMContext.
Prior to r13134, the modules being constructed for IRGen always used the
LLVM global context due to <rdar://problem/15283227>, but the interface
should really take this as a parameter rather than baking the behavior
into IRGen.

Swift SVN r13260
2014-02-01 01:07:14 +00:00
Michael Gottesman
10efd0b073 Add SILOptions as an argument to runSILDiagnosticPasses.
I am going to use this in a forthcoming patch which creates a special mode
called "ParanoidVerification" which runs the verifier after all passes.
"ParanoidVerification" will be by default off and will be used on the swift-fast
buildbot to help catch bugs which might be hidden by optimizations being run.

Swift SVN r13256
2014-02-01 00:30:53 +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