Commit Graph

6605 Commits

Author SHA1 Message Date
Chris Lattner
dadc9fc6d1 split predictable memory optimization (load promotion + alloc deletion) out to
its own SIL pass.  The bulk of this patch is updating the DI testcase to detangle
DI tests from load promotion tests.



Swift SVN r10721
2013-12-02 01:33:29 +00:00
Adrian Prantl
5c812906ca Revert "Revert r10613, the debug info problems are significant."
This reverts commit 41a6515ba08219c284a408448d790a783e64dad1.

Swift SVN r10616
2013-11-21 00:50:51 +00:00
Chris Lattner
c5034f8504 Revert r10613, the debug info problems are significant.
Swift SVN r10614
2013-11-21 00:12:34 +00:00
Chris Lattner
41e3d0fc23 Re-commit Stephen's patch: Enable capture promotion pass by default
This fixes up various testcases.  Note that 3 debug info tests are asserting
in IRGen for a common but unknown-to-me reason, I've XFAILed them for now.


Swift SVN r10613
2013-11-21 00:09:35 +00:00
Jordan Rose
5ad19d55b9 Revert "Enable capture promotion pass by default"
This reverts r10597 and r10600. Capture promotion is causing failures on trunk.

Swift SVN r10609
2013-11-20 22:39:49 +00:00
Stephen Lin
cb4ba7ab90 Enable capture promotion pass by default
Swift SVN r10597
2013-11-20 18:03:45 +00:00
Argyrios Kyrtzidis
beb94c5d5a [CMake] For executables, don't export symbols.
This improves startup performance and reduces noise when comparing symbol export
changes between submissions.

Swift SVN r10060
2013-11-08 23:32:24 +00:00
Connor Wakamo
2b3a922aa5 Move SerializedDiagnosticConsumer into swiftFrontend.
This matches where Clang implements its equivalent, and this makes it available to both swift and the new driver.

Swift SVN r10047
2013-11-08 19:26:13 +00:00
Joe Groff
72be5e8f59 IRGen: Always use PIC relocation model.
Fixes <rdar://problem/15358345>.

Swift SVN r10026
2013-11-07 18:42:53 +00:00
Argyrios Kyrtzidis
44d46de7c9 Use swift::SourceManager's addNewSourceBuffer() instead of llvm::SourceMgr's AddNewSourceBuffer().
Also remove the SourceLoc parameter from addNewSourceBuffer(). In llvm::SourceMgr
it is used to indicate textual inclusion, which we don't have in swift.

Swift SVN r10014
2013-11-07 00:51:56 +00:00
Chris Lattner
2ce7f37c69 add a missing ) that broke the bot
Swift SVN r9904
2013-11-03 17:10:47 +00:00
Chris Lattner
68af974227 Remove 'axle' related code and build machinery. It turns out that we
will not be pursuing this project in the immediate future.



Swift SVN r9901
2013-11-03 16:04:27 +00:00
Joe Groff
003709d51f SIL: Add a backreference from SILModule to its originating Swift Module.
Ideally this wouldn't be necessary, but the type substitution APIs required by generic specialization and SIL verification currently require a Module* pointer, and it's obnoxious to have to pass it down separately everywhere it's needed. Longer-term the reliance on Modules for type substitution might be able to go away.

Swift SVN r9866
2013-11-01 00:46:21 +00:00
Chris Lattner
cd844ed08f run simplifycfg as part of performance optimizations (e.g. swift -O1 and above runs it).
It only has one trivial optimization that kicks in only 19 times in the stdlib, but its
progress.


Swift SVN r9792
2013-10-30 16:01:51 +00:00
Chris Lattner
b3d07ad9c6 fix sil-opt to call llvm_shutdown when its done, allowing it to work with -stats.
Swift SVN r9791
2013-10-30 16:01:10 +00:00
Chris Lattner
9c6e940cd1 performance optimizations cannot produce diagnostics, so
make runSILOptimizationPasses return void.


Swift SVN r9790
2013-10-30 15:55:27 +00:00
Chris Lattner
d5fd6a67e0 Sketch out a trivial start at a simplify-cfg pass with one optimization to delete
dead blocks (which happens to be incorrect).

Unlike the LLVM SimplifyCFG pass, this one will be worklist-based instead of 
iterative, avoiding needless iteration over the entire function when a small
local changes are being made.


Swift SVN r9756
2013-10-29 04:37:27 +00:00
Chris Lattner
bb109d6f01 Now that allocbox-to-stack is run before DI, we can run inout-deshadow
before DI.  This will enable us to simplify its algorithm to make it 
more predictable and powerful.

To test the end-to-end behavior of inout promotion in the compiler,
I'm adding a new integration test with some examples that we cover 
today.  There is still more work to be done though.



Swift SVN r9748
2013-10-29 02:40:08 +00:00
Chris Lattner
92d9d37612 move the allocbox to stack pass to run before definite init, now that the
dependencies blocking this have been resolved.  No important functionality
change, this is working towards fixing inout promotion.


Swift SVN r9726
2013-10-28 20:40:45 +00:00
Dmitri Hrybenko
f0cd6e3f20 Don't import the standard library multiple times in the REPL
SourceFile should filter out duplicate imports, rdar://15334029, but for now
this prevents duplicating code completion results for the standard library in
the REPL.


Swift SVN r9718
2013-10-28 19:25:12 +00:00
Chris Lattner
991856dbe5 Fix the swift driver to not run SIL diagnostic passes on a .sil file
that is already in canonical form.  Besides being the obviously right
thing to do, this stabilizes an IRGen test file against SIL 
diagnostic pass changes.


Swift SVN r9698
2013-10-27 20:10:27 +00:00
Dmitri Hrybenko
0648d1d26b Portability: CMake build system: use ln -n instead of ln -h. For Darwin ln
these options are the same, but GNU ln only implements -n.


Swift SVN r9694
2013-10-27 05:26:49 +00:00
Jordan Rose
ec4234bdbc Perform unqualified lookup using the current SourceFile as context.
And, properly treat imports as per-file: when looking up decls through the
TU module, don't pick up every other source file's imports.

This implements our resolution rules:
1. Check the current source file.
2. Check the current module.
3. Check imported modules.

Currently, "import Foo" is treated as a file-private import and
"@reexported import Foo" is treated as a public /and/ module-wide import.
This further suggests that access control is the right tool for re-export
control:

(private) import Foo // current file only
package import Foo   // whole module
public import Foo    // whole world

Swift SVN r9682
2013-10-25 22:21:12 +00:00
Jordan Rose
28e01f3c3a Eliminate "MainSourceFile" from TranslationUnit in favor of an array.
Anywhere that assumes a single input file per TU now has to do so explicitly.
Parsing still puts all files in a single SourceFile instance; that's next on
the list.

There are a lot of issues still to go, but the design is now in place.

Swift SVN r9669
2013-10-25 17:30:37 +00:00
Jordan Rose
ec23db6962 Push the TU's lookup cache down to SourceFile.
Also move print() and dump() from TranslationUnit to SourceFile.

Swift SVN r9645
2013-10-24 18:59:18 +00:00
Dmitri Hrybenko
6129bc71ef Build system: specify dependencies more precisely, allows us to build on
systems with more strict linkers


Swift SVN r9611
2013-10-23 04:55:18 +00:00
Dmitri Hrybenko
acdd5b120a Make type checker debug output redirectable
Introduce a replaceable TypeCheckerDebugConsumer for this.


Swift SVN r9555
2013-10-21 20:26:32 +00:00
Jordan Rose
d870f60edd Don't print statistics twice under -print-stats.
llvm::EnableStatistics() already causes statistics to be printed on exit.

Swift SVN r9549
2013-10-21 18:36:44 +00:00
Greg Parker
fbd1c95292 Add support for iOS builds using cmake.
Swift SVN r9499
2013-10-18 21:52:37 +00:00
Jordan Rose
f7f253320a Re-add -l flag to Swift interim driver.
This is useful in -i and REPL modes, which do not have a separate linking
step. This version of the -l flag doesn't rely on TranslationUnit. I also
cleaned up the library-loading diagnostics.

Swift SVN r9488
2013-10-18 18:52:10 +00:00
Argyrios Kyrtzidis
f92d4dc073 [CMake] Set "@rpath" as the install name of the stdlib dynamic libraries and add an rpath to swift executable so the interpreter can load them.
Swift SVN r9482
2013-10-18 16:44:48 +00:00
Argyrios Kyrtzidis
87ae08a908 Introduce some versioning for the swift executable.
Swift SVN r9481
2013-10-18 16:44:45 +00:00
Jordan Rose
9a4528c904 Move gyb from tools/ to utils/
For consistency with the vague idea that things that are only useful for
compiler developers should go in utils/, not tools/. Unless they need
build system support.

Swift SVN r9433
2013-10-17 00:08:48 +00:00
Michael Gottesman
bdf7cbe178 [sil-combine] Initial SILCombine implementation.
This pass is a port of InstCombine from LLVM to SIL. Thus if you are familiar
with the code from InstCombine you will feel right at home.

Keep in mind that in order to help with review, this is just a skeleton with no
optimizations in it besides a simple DCE based off of isInstructionTriviallyDead
(which this patch exposes in Local.h like LLVM does) to ensure that trivial
testing of the pass can be accomplished since otherwise it would do nothing
implying that no tests could be written at all.

I additionally modified one test which no longer passed due to SILCombine
removing 1x unused metatype instruction from the standard library.

Swift SVN r9404
2013-10-16 03:10:14 +00:00
Dmitri Hrybenko
d839801c36 Interpreter: perform SIL linking for loaded modules
Swift SVN r9396
2013-10-16 01:19:27 +00:00
Stephen Lin
d500349527 SILOpt: remove accidental fall-through from capture promotion to next case
Swift SVN r9374
2013-10-15 20:44:01 +00:00
Stephen Lin
94dbad4666 Add (but do not enable by default) a pass for closure capture promotion (rdar://problem/14757727).
Swift SVN r9362
2013-10-15 19:11:54 +00:00
Dmitri Hrybenko
b47ad7f364 Perform SIL linking when running code in REPL
This allows us to inline transparent functions and emit diagnostics in SIL
diagnostic passes.  Fixes rdar://15209827


Swift SVN r9280
2013-10-13 11:53:43 +00:00
John McCall
8fbc790d39 Subsume OwnershipConventions into SILFunctionType.
Swift SVN r9186
2013-10-11 00:50:57 +00:00
Jordan Rose
7b936e2b85 Remove unfinished notion of "Component" (originally for resilience).
docs/Resilience.rst describes the notion of a resilience component:
if the current source file is in the same component as a module being
used, it can use fragile access for everything in the other module,
with the assumption that everything in a component will always be
recompiled together.

However, nothing is actually using this today, and the interface we
have is probably not what we'll want in 2.0, when we actually implement
resilience.

Swift SVN r9174
2013-10-10 21:41:57 +00:00
Jordan Rose
25deab5f31 Misc. cleanup related to use of TranslationUnit.
Swift SVN r9164
2013-10-10 19:49:32 +00:00
Jordan Rose
5ed38c0b72 Clarify SourceFile vs. TranslationUnit interfaces for SILGen and IRGen.
Once we have multiple SourceFiles in a TranslationUnit, it no longer makes
sense to say "only SILGen decls starting from element N" without specifying
which source file you mean.

Also, clarify ownership by having performSILGeneration return a unique_ptr
instead of just a bare pointer.

Swift SVN r9112
2013-10-09 23:44:43 +00:00
Jordan Rose
9d09d9c7a5 Adopt SourceFile for type checking.
Swift SVN r9106
2013-10-09 22:44:33 +00:00
Jordan Rose
09787207fc Push TUKind into SourceFile (as InputKind).
Different SourceFiles in the same module will eventually have different
input kinds (at the very least Main vs. Library).

Swift SVN r9076
2013-10-09 18:38:25 +00:00
Jordan Rose
cba6b2cc70 Use SourceFile in REPL code completion.
Swift SVN r9074
2013-10-09 18:38:19 +00:00
Jordan Rose
f5de2e43d7 Push SourceFile into Parser and REPL somewhat.
Swift SVN r9073
2013-10-09 18:38:17 +00:00
Jordan Rose
597640a5d2 Introduce "SourceFile" within a TranslationUnit.
Right now this is just an extra layer of indirection for the decls,
operators, and imports in a TU, but it's the first step towards compiling
multiple source files at once without pretending they're all in a single
file. This is important for the "implicit visibility" feature, where
declarations from other source files in the same module are accessible
from the file currently being compiled.

Swift SVN r9072
2013-10-09 18:38:15 +00:00
Chris Lattner
f012f40797 Fix a bug in SILType::isInOutArgument that caused it to assert on indirect returns.
Turn inout promotion on by default.  It only triggers a dozen times right now in the
stdlib, but that is better than nothing.


Swift SVN r9039
2013-10-09 00:30:14 +00:00
Chris Lattner
73ad4dbb6a Completely remove the stacktossa pass, it is dead now.
Swift SVN r8996
2013-10-07 22:11:32 +00:00
Chris Lattner
2489f0005a Disable the diagnostics level "stack to SSA" pass, which is almost completely
subsumed by definite initialization.

The single case that definite initialization misses (as illustrated by the 
testcase) are opportunities to eliminate the load feeding the final release 
that is produced by the box-to-stack pass.

I'm fine ignoring this one minor, because this doesn't matter for diagnostic 
passes, and we'll eventually have a general load-elimination pass if this is 
important.



Swift SVN r8995
2013-10-07 22:07:38 +00:00