Commit Graph

36 Commits

Author SHA1 Message Date
Dmitri Hrybenko
61286f0260 Fix warnings produced by a newer version of Clang
Swift SVN r25257
2015-02-12 23:50:47 +00:00
Joe Groff
45eec9a2e9 Remove 'interface' from the method names of SILFunctionType.
SILFunctionTypes are always interface types now. NFC.

Swift SVN r19952
2014-07-14 22:03:46 +00:00
Chris Lattner
001c1890e5 put all the SIL*Transform classes in anonymous namespaces, there is
no need for their symbols to be exported out of their implementation
file.


Swift SVN r14714
2014-03-06 01:49:53 +00:00
Joe Groff
033867be57 InOutDeshadowing: Only deshadow inouts that are both loaded from and stored to.
Tighten up the analysis in InOutDeshadowing to ensure that the supposed shadow copy is actually stored back to the inout on every exit path. This avoids forwarding address-only inouts into @in arguments, for which we also emit a copy_addr to a stack slot. Fixes <rdar://problem/16105449>.

Before and after this patch, we deshadow the same number of copies:

    293 inout-deshadow                   - Number of inout shadow variables kept
    207 inout-deshadow                   - Number of inout shadow variables removed

Swift SVN r14108
2014-02-19 22:47:24 +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
Nadav Rotem
27a1a63134 Remove unneeded empty virtual destructors.
Swift SVN r13599
2014-02-06 22:24:33 +00:00
Nadav Rotem
1ef0d157ca PassManager: Inject the function/module into the Transformation.
Now the pass does not need to know about the pass manager. We also don't have
runOnFunction or runOnModule anymore because the trnasformation knows
which module it is processing. The Pass itself knows how to invalidate the
analysis, based on the injected pass manager that is internal to the
transformation.

Now our DCE transformation looks like this:

class DCE : public SILModuleTransform {
  void run() {
    performSILDeadCodeElimination(getModule());
    invalidateAnalysis(SILAnalysis::InvalidationKind::All);
  }
};





Swift SVN r13598
2014-02-06 22:11:21 +00:00
Chris Lattner
827acad533 Various inout improvements:
- purge @inout from comments in the compiler except for places talking about
   the SIL argument convention.
 - change diagnostics to not refer to @inout
 - Change the astprinter to print InoutType without the @, so it doesn't show
   up in diagnostics or in closure argument types in code completion.
 - Implement type parsing support for the new inout syntax (before we just 
   handled patterns).
 - Switch the last couple of uses in the stdlib (in types) to inout.
 - Various testcase updates (more to come).



Swift SVN r13564
2014-02-06 06:22:27 +00:00
Nadav Rotem
99b075c32a Rename SILFunctionTrans -> SILFunctionTransform
Swift SVN r13536
2014-02-06 01:32:10 +00:00
Nadav Rotem
f8c7b54d28 Delete the unused performXXX() functions.
Swift SVN r13531
2014-02-06 00:57:28 +00:00
Nadav Rotem
1df8e93bbb Convert the diagnostic methods into passes.
Swift SVN r13503
2014-02-05 20:30:49 +00:00
Joe Groff
71379f5bad SILGen: Explicitly mark uninitialized locals with mark_uninitialized, and have DI only consider mark_uninitialized storage.
Have SILGen mark all variables bound from pattern bindings without initializers (and *only* ones without initializers) with mark_uninitialized [var] pseudo instructions. On the DI end, *only* consider mark_uninitialized instructions for DI analysis. This has many benefits:

- DI doesn't waste time analyzing locals that are trivially initialized in the original source code.
- DI doesn't try to mangle canonical SIL that has been inlined from transparent functions, which may have been optimized into a form DI isn't written to understand.

While we're here, fix an issue with DCE where it would try to kill unused MarkUninitialized instructions. Although MarkUninitialized has no side effects, it still is semantically important to raw SIL, and can't be killed.

Chris did most of the work here; I just finished updating tests and fixing bugs.

Swift SVN r13247
2014-01-31 22:50:21 +00:00
Nadav Rotem
a07aed9d1f Change errs() -> dbgs() in a few files.
Swift SVN r12572
2014-01-20 06:36:50 +00:00
Joe Groff
b2f0b90ba2 SIL: Switch to SILFunctionType interface types in easy-to-reach places.
In nongeneric contexts, or contexts where we only care about the indirectness of parameters or have already substituted the generic parameters for a function, the interface types are interchangeable, so just switch over.

Swift SVN r12044
2014-01-08 04:48:29 +00:00
Michael Gottesman
4379283013 Remove inclusion of SILPasses/Passes.h into Subsystems.h and update all relevant files.
Swift SVN r10880
2013-12-05 19:58:21 +00:00
John McCall
20e58dcf93 Change the type of function values in SIL to SILFunctionType.
Perform major abstraction remappings in SILGen.  Introduce
thunking functions as necessary to map between abstraction
patterns.

Swift SVN r10562
2013-11-19 22:55:09 +00:00
Dmitri Hrybenko
81dc5deee8 Change 'def' keyword back to 'func'
Swift SVN r10522
2013-11-17 07:45:28 +00:00
Dmitri Hrybenko
91ce21666d Change 'func' keyword to 'def'
I tried hard find all references to 'func' in documentation, comments and
diagnostics, but I am sure that I missed a few.  If you find something, please
let me know.

rdar://15346654


Swift SVN r9886
2013-11-02 01:00:42 +00:00
Chris Lattner
16d041fc19 complete this file comment.
Swift SVN r9840
2013-10-31 02:54:01 +00:00
Chris Lattner
968e89a3be improve the DEBUG output of inout-deshadow and allocbox-to-stack.
clean up a couple random things in silcombiner:
  - it shouldn't return "made any changes" out of the pass.
  - statistics should be spelled out more and don't end with periods.



Swift SVN r9755
2013-10-29 04:02:32 +00:00
Chris Lattner
ff3290e47c simplify inout deshadowing to not look at load/store sequences at all,
just at autogenerated copy_addrs.


Swift SVN r9754
2013-10-29 03:14:41 +00:00
Chris Lattner
143fd76129 revert r9703, which added a bunch of complexity to inout deshadow to
look through copy_value.  With the new approach, this isn't needed anymore.


Swift SVN r9753
2013-10-29 03:10:46 +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
47f49451ed Enhance inout deshadowing to look through copy_values, allowing it to
eliminate stack allocations of non-trivial type.  This is progress towards
rdar://15228172 but is not enough, we are still leaving copyvalue+destroys
around, which need to be fixed.


Swift SVN r9705
2013-10-28 00:37:32 +00:00
Chris Lattner
7826c7d32d simplify this pass pretty substantially based on its new design, no functionality change.
Swift SVN r9703
2013-10-28 00:22:35 +00:00
Chris Lattner
9c6ef17256 Now that definite initialization is exploding copy_addrs, the simplistic
algorithm used by inout deshadowing broke in many common cases.  Reimplement
the pass with a different approach, where it looks for autogenerated copies
into and out of the inout pointer, which may be exploded.

This doesn't handle nontrivial types yet, but is progress towards fixing
rdar://15228172.



Swift SVN r9702
2013-10-28 00:10:53 +00:00
Chris Lattner
c118613de3 Fix SILValue use_iterators to type the user as a SILInstruction, not just a ValueBase.
There are no values other than instructions that can use other values.  BBArguments are
defs, not uses.  This eliminates a bunch of casts in clients that use getUser().


Swift SVN r9701
2013-10-27 23:32:14 +00:00
Chris Lattner
ea4da2970b Abstract copy_addr identification out of inout deshadowing. This
is just a refactoring, no functionality change.


Swift SVN r9692
2013-10-26 23:48:10 +00:00
John McCall
b880e60100 Remove SILFunctionTypeInfo in favor of SILFunctionType.
We still don't actually use this as a type, however.

Swift SVN r9091
2013-10-09 20:55:55 +00:00
Chris Lattner
0dbf32c6eb improve the debug output for inout deshadowing. I'm satisfied that
it is catching all the cases it should right now.  The primary misses
are by-ref closure captures, which are modeled as inout arguments but
have no inout shadow to remove.


Swift SVN r9062
2013-10-09 16:55:31 +00:00
Chris Lattner
21e6e9376f Improve inout shadow elimination to apply to values of trivial type
which don't get their init/take flags reliably set.  This causes the
transformation to trigger on many many many more inout shadows, and also
breaks the debug info test.


Swift SVN r9041
2013-10-09 00:42:05 +00:00
Chris Lattner
b31ab725c4 Implement inout deshadowing. This currently doesn't trigger on non-trivial types
but seems to work in other cases.  It still needs to load+release to be emitted as
destroy_addr, and isn't extensively tested.


Swift SVN r9011
2013-10-08 00:47:22 +00:00
Chris Lattner
348ace2211 sketch some more infrastructure for inout promotion, no functionality yet.
Swift SVN r9004
2013-10-07 23:00:17 +00:00
Chris Lattner
e1b0d4ed4b the new approach will only look at copy_addr's. Sketch this out.
Swift SVN r8966
2013-10-07 17:23:22 +00:00
Chris Lattner
1687382e95 Checkpoint some progress on inout deshadowing, since I'm about to
take a direction change and remove it all. :-)


Swift SVN r8965
2013-10-07 17:18:21 +00:00
Chris Lattner
467626fdab New file that I forgot to svn-add.
Swift SVN r8956
2013-10-07 16:08:39 +00:00