The `__future__` we relied on is now, where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):
* absolute_import
* print_function
* unicode_literals
* division
These import statements are no-ops and are no longer necessary.
I am going to be adding logic here to enable apple/swift#1550 to be completed.
The rename makes sense due to precedent from LLVM's codegen prepare and also
since I am going to be expanding what the pass is doing beyond just "cleaning
up". It is really a grab bag pass for performing simple transformations that we
do not want to pollute IRGen's logic with.
https://github.com/apple/swift/pull/15502
rdar://39335800
radar rdar://problem/28434323
SILGen has no reason to insert shadow copies for inout parameters any more. They cannot be captured. We still emit these copies. Sometimes deshadowing removes them, but sometimes it does not.
In this PR we just avoid emitting the copies and remove the deshadowing pass.
This PR chery-picked some of @dduan work and built on top of it.
Replace the project global linting rule excludes (as defined in .pep8) with
fine-grained "# noqa" annotations.
By using noqa annotation the excludes are made on a per line basis instead of
globally.
These annotations are used where we make deliberate deviations from the standard
linting rules.
To lint the Python code in the project:
$ flake8
To install flake8:
$ pip install flake8
See https://flake8.readthedocs.org/en/latest/ for details.
To enable checking of the PEP-8 naming conventions, install the optional
extension pep8-naming:
$ pip install pep8-naming
To enable checking of blind "except:" statements, install the optional
extension flake8-blind-except:
$ pip install flake8-blind-except
To enable checking of import statement order, install the optional
extension flake8-import-order:
$ pip install flake8-import-order
* E101: indentation contains mixed spaces and tabs
* E111: indentation is not a multiple of four
* E128: continuation line under-indented for visual indent
* E302: expected 2 blank lines, found 1
* W191: indentation contains tabs
Fixes:
* multiple statements on one line (colon) (E701)
* missing whitespace around arithmetic operator (E226)
* missing whitespace around operator (E225)
* closing bracket does not match visual indentation (E124)
* blank line contains whitespace (W293)
* continuation line missing indentation or outdented (E122)
* continuation line over-indented for hanging indent (E126)
* missing expected blank line (E301)
* trailing whitespace (W291)
* unexpected spaces around keyword / parameter equals (E251)
* whitespace after '(', '[' or '{' (E201)
* whitespace before ')', ']' or '}' (E202)
* whitespace before ',' or ':' (E203)
Fixes:
* blank line at end of file
* closing bracket does not match indentation of opening bracket's line
* continuation line over-indented for hanging indent
* continuation line over-indented for visual indent
* continuation line unaligned for hanging indent
* inline comment should start with '# '
* missing whitespace around arithmetic operator
* missing whitespace around bitwise or shift operator
* multiple imports on one line
* multiple spaces after ':'
* multiple spaces after operator
Before this commit:
```
$ utils/pass-pipeline/scripts/pipeline_generator.py
utils/pass-pipeline/scripts/pipeline_generator.py
Traceback (most recent call last):
File "utils/pass-pipeline/scripts/pipeline_generator.py", line 15, in <module>
normal_pipeline = [x for x in pass_pipeline_library.normal_passpipelines()]
File "/path/to/swift/utils/pass-pipeline/src/pass_pipeline_library.py", line 106, in normal_passpipelines
x.addPass(specialization_passlist())
NameError: global name 'specialization_passlist' is not defined
```
After this commit:
```
$ utils/pass-pipeline/scripts/pipeline_generator.py
[
[
"HighLevel",
"run_n_times",
2,
"SimplifyCFG",
…
```
Fixes:
* Unused import
* Redundant backslash
* Use of discouraged if not x in y
* Use of deprecated form of raising exceptions
Follow-up to PR #655 as requested by @gribozavr
We do generic specialization in the inliner now, so we no longer need
the separate pass.
The order the specializations are inserted into the module differs as a
result of this, which means that one unfortunately huge test needed
substantial changes.
At some point this test needs to be converted to SIL and split up into
smaller chunks.
Swift SVN r31323
This file now contains only the speculative devirtualization pass, so
rename accordingly.
Also remove remaining references to "inline caches", since we're now
calling it speculative devirtualization.
Swift SVN r31096
This makes it clearer via their name what the two scripts are meant to
be used for.
As a recap:
1. pipeline_generator.py is meant for generating pass pipeline json
files.
2. pipelines_build_script.py is a script built ontop of
pipeline_generator.py that makes it easy to run build-script with
various pass pipelines that can be generated from
pipeline_generator.py. It is meant to be used on buildbots and for ones
own enjoyment as well.
Swift SVN r24315
The pipeline code still has too much hard coded. I am going to write a little
tool that is disabled by default that when run provides all this information
from the compiler. So the tool will dump out the current pass list, the normal optimization
pipelines, and then all of the passes used in such pipelines (i.e. AADumper is a
great pass but it won't change how the stdlib compiles). But for now I am going
to leave it hard coded.
Swift SVN r24313
Specifically the following utilities are provided:
1. Normal Pipeline.
2. Normal Pipeline with Specific Passes Disabled.
5. Normal Pipeline with specific PassLists disabled.
Swift SVN r24056