Commit Graph

13 Commits

Author SHA1 Message Date
Arnold Schwaighofer
7e32c68e1d Add new SIL instruction for calling dynamically_replaceable funtions
%0 = dynamic_function_ref @dynamically_replaceable_function
  apply %0()
  Calls a [dynamically_replaceable] function.

  %0 = prev_dynamic_function_ref @dynamic_replacement_function
  apply %0
  Calls the previous implementation that dynamic_replacement_function
  replaced.
2018-11-06 09:53:22 -08:00
Michael Gottesman
03afdc5291 [caller-analysis] Reimplement CallerAnalysis ontop of findLocalApplySites.
Now the caller analysis can tell callers if it was able to find /all/ callers of
a callee.

NOTE: This does not change FSO itself yet.

rdar://41146023
2018-08-21 19:34:03 -07:00
Michael Gottesman
3051cd3f60 [caller-analysis] Change the dumping format to be a yaml format and update tests to use that format.
The current dumping format consists of 1 row of information per function. This
will become unweildy to write patterns for when I add additional state to
FunctionInfo.

Instead, this commit converts the dumping format of the caller analysis into a
multi line yaml format. This yaml format looks as follows:

  ---
  calleeName:      closure1
  hasCaller:       false
  minPartialAppliedArgs: 1
  partialAppliers:
    - partial_apply_one_arg
    - partial_apply_two_args1
  fullAppliers:
  ...

This can easily expand over time as we expand the queries that caller analysis
can answer.

As an additional advantage, there are definitely yaml parsers that can handle
multiple yaml documents in sequence in a stream. This means that by running via
sil-opt the caller-analysis-printer pass, one now will get a yaml description of
the caller analysis state, perfect and ready for analysis.
2018-07-12 22:43:23 -07:00
Hugh Bellamy
f001b7562b Use relatively new LLVM_FALLLTHROUGH instead of our own SWIFT_FALLTHROUGH 2017-02-12 10:47:03 +07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Erik Eckstein
959e19d7bc Add an optimization to eliminate a partial_apply if all applied arguments are dead in the applied function.
This consists of 3 parts:
1) Extend CallerAnalysis to also provide information if a function is partially applied
2) A new DeadArgSignatureOpt pass, similar to FunctionSignatureOpts, which just specializes for dead arguments of partially applied functions.
3) Let CapturePropagation eliminate such partial_apply instructions and replace them with a thin_to_thick conversion of the specialized functions.

This optimzation improves benchmarks where static struct or class functions are passed as a closure (e.g. -20% for SortStrings).
Such functions have a additional metatype parameter. We used to create a partial_apply in this case, which allocates a context, etc.
But this is not necessary as the metatype parameter is not used in most cases.

rdar://problem/27513085
2016-08-23 07:32:41 -07:00
Xin Tong
fd353df19e Remove some of unneeded functionality in CallerAnalysis
We really only need the analysis to tell whether a function has caller
inside the module or not. We do not need to know the callsites.

Remove them for now to make the analysis more memory efficient.

Add a note to indicate it can be extended.
2016-03-17 21:16:24 -07:00
Xin Tong
eab029d795 Add CallerAnalysis Printer.
This provides some basic testing on CallerAnalysis before hooking it
up to function signature opts.
2016-03-17 10:51:16 -07:00
Xin Tong
6b9cde8ffd Fix typo 2016-03-16 18:00:07 -07:00
Xin Tong
cca9c2521a Improve CallerAnalysis.
Address the comments from 0acc0a8464

I still have not made up my mind how to handle deleted functions.

CallerAnalysis is not hooked up to anything yet.
2016-03-16 17:49:34 -07:00
practicalswift
a934702d51 [gardening] Fix recently introduced typo: "fucntion" → "function" 2016-03-16 23:17:13 +01:00
Xin Tong
0acc0a8464 Implement a Caller Analysis.
The analysis can tell all the callsites which calls a function in the module.

The analysis is computed and kept up-to-date lazily.

At the core of it, it keeps a list of functions that need to be recomputed for
the Caller/Callee relation to be precise and on every query, the analysis makes
sure to recompute them and clear the list before any query.

This is NFC right now. I am going to wire it up to function signature analysis
eventually.
2016-03-16 09:33:22 -07:00