Commit Graph

45 Commits

Author SHA1 Message Date
Jamie
7bb97a581d [NFC][SILOptimizer]: remove seemingly unused StripDebugInfo pass 2025-10-21 08:32:14 -05:00
Daniel Duan
3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
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.
2022-04-13 14:01:30 -07:00
Graydon Hoare
71da5ec519 Fix flake8 warning W605 invalid escape sequence. 2018-11-06 11:38:39 -08:00
Michael Gottesman
5baa90ca4c [irgen-prepare] Move SILCleanup to ./lib/SILOptimizer/Mandatory and rename it to IRGenPrepare.
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
2018-04-17 00:07:16 -07:00
Hugh Bellamy
fa3543d3c5 Fix some pylint errors for double whitespace after class/function 2017-02-17 15:37:19 +07:00
Andrew Trick
855918c620 [Lowering] Add an AddressLowering pass. 2017-02-13 17:10:02 -08:00
Joe Shajrawi
91bba4d425 Do not emit shadow copied for inout parameters (#5218)
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.
2016-10-13 10:10:59 -07:00
practicalswift
776d28cc3c [Python] Remove unused function diagnostic_passlist() 2016-03-12 20:16:27 +01:00
practicalswift
d5326bfdc4 [Python] Replace global linting excludes with local line-level excludes ("noqa")
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
2016-03-10 16:22:48 +01:00
practicalswift
0796eaad1f [Python] Fix 80-column violations 2016-03-09 23:52:11 +01:00
Brian Gesiak
c9000af795 Merge pull request #1526 from practicalswift/fix-pep8-violations-ii
[Python] Fix five classes of PEP-8 violations (E101/E111/E128/E302/W191)
2016-03-08 23:55:46 -05:00
practicalswift
265835fdfc [Python] Use consistent import ordering for Python code
Ordering used:
1.) standard library imports
2.) third party imports
3.) local package imports

Each group is individually alphabetized.
2016-03-07 23:25:16 +01:00
practicalswift
183da818df [Python] Fix five classes of PEP-8 violations (E101/E111/E128/E302/W191)
* 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
2016-03-07 22:36:23 +01:00
practicalswift
f6d6585ee0 [Python] Improve Python consistency: Use function_name(…) throughout (PEP8) 2016-02-29 22:49:19 +01:00
practicalswift
e0fdba9aeb [gardening] Avoid unnecessary list comprehensions
Rewrite [x for x in y] as list(y)
2016-01-24 12:38:00 +01:00
practicalswift
679f1853d2 PEP8: Fix all violations of type "at least two spaces before inline comment" (E261) 2016-01-24 10:10:55 +01:00
practicalswift
84a31184c7 PEP8: Fix all violations of type "missing whitespace after ','" (E231) 2016-01-24 09:40:32 +01:00
practicalswift
1cd4d4e9c9 [gardening] Fix violations of non-controversial PEP8 rules
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)
2016-01-23 09:23:33 +01:00
practicalswift
22d043fcc0 [gardening] Fix violations of non-controversial PEP8 rules.
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
2016-01-16 00:47:43 +01:00
practicalswift
78c5264885 Make scripts/pipeline_generator.py usable again.
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",
…
```
2015-12-29 12:52:34 +01:00
practicalswift
4f2496e1a6 Various Python cleanups
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
2015-12-22 21:05:47 +01:00
practicalswift
a477105a70 Sort passes as per @jrose-apple's request in #540 2015-12-16 22:17:37 +01:00
practicalswift
d4cbcfff04 Fix NameError bug: s/Devirtualizer/SpeculativeDevirtualizer/ 2015-12-14 23:22:46 +01:00
Mark Lacey
4c62204007 Remove the stand-alone generic specialization pass.
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
2015-08-19 00:24:00 +00:00
Mark Lacey
99cf3dcf2a Rename Devirtualizer.cpp to SpeculativeDevirtualizer.cpp.
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
2015-08-08 06:42:30 +00:00
Michael Gottesman
851b7885da [pass-pipeline] Cleanup parser.
Swift SVN r24351
2015-01-10 04:12:40 +00:00
Michael Gottesman
4e941c8374 Create the verbose argument right... *sigh*.
Swift SVN r24340
2015-01-10 00:45:21 +00:00
Michael Gottesman
3f6f10a562 [pipelines] Add a verbose option to pipelines.
Swift SVN r24338
2015-01-10 00:40:28 +00:00
Michael Gottesman
37d07b9ce0 [pipelines] Change running with build script to not bail if one iteration of building the stdlib with a pass disabled fails. Also only dump output upon failure.
Swift SVN r24328
2015-01-09 22:43:05 +00:00
Michael Gottesman
997b90aa7b Add to pipelines_build_script.py subparsers for argparsing the right way and add a user friendly mode to run with a specific pass disabled.
Swift SVN r24316
2015-01-09 17:29:37 +00:00
Michael Gottesman
faa2f9339e Rename normal_pipeline.py => pipeline_generator.py and pipelines.py => pipelines_build_script.py.
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
2015-01-09 17:29:36 +00:00
Michael Gottesman
9ec2bee5a7 [pipeline] Refactor our generation of pipeline files for disabling a specific pass from the general go through and disable all passes once and run code.
Swift SVN r24314
2015-01-09 17:29:36 +00:00
Michael Gottesman
e998041451 pipeline: Don't hard code pass names into pipelines.py. Just use the PASSES variable from passes.py in the library.
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
2015-01-09 17:29:36 +00:00
Michael Gottesman
7365be3b5f [pipeline] Pretty print the pipeline json files.
Swift SVN r24312
2015-01-09 17:29:35 +00:00
Michael Gottesman
73a5a1bcf7 [passpipeline] Some small cleanups. NFC.
Swift SVN r24311
2015-01-09 17:29:35 +00:00
Michael Gottesman
9f3bd6936f remove old cruft from pipeline.
Swift SVN r24307
2015-01-09 16:34:32 +00:00
Michael Gottesman
43e84fca09 Add a preset for extra-swift-args and fixup the pipeline driver so it works with the preset.
Swift SVN r24282
2015-01-08 20:57:59 +00:00
Michael Gottesman
ee61c58439 Fix some pylint errors.
Swift SVN r24275
2015-01-08 07:29:56 +00:00
Michael Gottesman
c88d9d3e0a Make pipelines.py executable and remove trailing whitespace.
Swift SVN r24274
2015-01-08 07:18:41 +00:00
Michael Gottesman
3f73d74a97 Add a new pipelines generating script that works with build script options to pass arbitrary flags into the compiler
Swift SVN r24273
2015-01-08 07:17:14 +00:00
Michael Gottesman
09cf7b87e9 [libjenkins] Remove invocation code from libjenkins.pipelines.sh. It is supposed to be a library not an exe anymore. = /.
Swift SVN r24122
2014-12-23 21:45:37 +00:00
Michael Gottesman
b8f7cfdda7 [libjenkins] Add libjenkins.pipelines.sh, an extension that is sourced after libjenkins that provides the ability to run various pipelines.
Swift SVN r24120
2014-12-23 21:10:55 +00:00
Michael Gottesman
1a14651091 Add in small script that generates pipelines one for each pass with the pass disabled and for each pass manager with the passmanager disabled.
The idea is to put this on a bot so we can catch these all the time.

Swift SVN r24106
2014-12-23 08:50:03 +00:00
Michael Gottesman
a5ad9f5d51 Add in a #! python line for normal_pipeline generation.
Swift SVN r24065
2014-12-21 23:14:19 +00:00
Michael Gottesman
4ef6edbda9 Add python utilities for generating pipeline files.
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
2014-12-20 04:09:48 +00:00