summaryrefslogtreecommitdiff
path: root/src/passes/ReReloop.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [NFC] Remove our bespoke `make_unique` implementation (#5613)Thomas Lively2023-03-311-2/+2
| | | | This code predates our adoption of C++14 and can now be removed in favor of `std::make_unique`, which should be more efficient.
* Switch from `typedef` to `using` in C++ code. NFC (#5258)Sam Clegg2022-11-151-1/+1
| | | | This is more modern and (IMHO) easier to read than that old C typedef syntax.
* Refactor interaction between Pass and PassRunner (#5093)Thomas Lively2022-09-301-4/+4
| | | | | | | | | | | | | | Previously only WalkerPasses had access to the `getPassRunner` and `getPassOptions` methods. Move those methods to `Pass` so all passes can use them. As a result, the `PassRunner` passed to `Pass::run` and `Pass::runOnFunction` is no longer necessary, so remove it. Also update `Pass::create` to return a unique_ptr, which is more efficient than having it return a raw pointer only to have the `PassRunner` wrap that raw pointer in a `unique_ptr`. Delete the unused template `PassRunner::getLast()`, which looks like it was intended to enable retrieving previous analyses and has been in the code base since 2015 but is not implemented anywhere.
* Modernize code to C++17 (#3104)Max Graey2021-11-221-6/+3
|
* Preserve Function HeapTypes (#3952)Thomas Lively2021-06-301-2/+2
| | | | | | | | | When using nominal types, func.ref of two functions with identical signatures but different HeapTypes will yield different types. To preserve these semantics, Functions need to track their HeapTypes, not just their Signatures. This PR replaces the Signature field in Function with a HeapType field and adds new utility methods to make it almost as simple to update and query the function HeapType as it was to update and query the Function Signature.
* cleanup to allow binaryen to be built in more strict environments (#3566)walkingeyerobot2021-02-161-0/+1
|
* Remove exnref and br_on_exn (#3505)Heejin Ahn2021-01-221-2/+1
| | | This removes `exnref` type and `br_on_exn` instruction.
* Refactor printing code so that printing Expressions always works (#3450)Alon Zakai2020-12-171-4/+0
| | | | | | | | This avoids needing to add include wasm-printing if a file doesn't already have it. To achieve that, add the std::ostream hooks in wasm.h, and also use them when possible, removing the need for the special WasmPrinter object. Also stop printing in "full" (print types on each line) in error messages by default. The user can still get that, as always, using BINARYEN_PRINT_FULL=1 in the env.
* [ReReloop] Pass module when calling ReFinalize (#3382)Alon Zakai2020-11-171-1/+1
| | | | | | I happened to notice that this was the one place that calls ReFinalize without the module. That could error if the module is actually needed, which the pass might use, based on the code (but rare enough that it's never been an issue I guess).
* Fix Relooper leaking Branches (#3097)Daniel Wirtz2020-09-081-4/+2
| | | Fixes the `Relooper` leaking `Branch`es in `Optimizer::SkipEmptyBlocks`, by refactoring the API so a `std::unique_ptr` is ensured for each `Block`, `Branch` and `Shape` upon adding to the relooper.
* Error out when EH is used in unsupported code (#2713)Heejin Ahn2020-03-271-0/+3
| | | | | This calls `Fatal()` when EH instructions are used in unsupported code. Currently EH instructions are unsupported in Flatten, ReReloop, and DataFlow-using passes.
* [NFC] Enforce use of `Type::` on type names (#2434)Thomas Lively2020-01-071-2/+2
|
* Remove FunctionType (#2510)Thomas Lively2019-12-111-2/+3
| | | | | | | | | | | | | | | | | Function signatures were previously redundantly stored on Function objects as well as on FunctionType objects. These two signature representations had to always be kept in sync, which was error-prone and needlessly complex. This PR takes advantage of the new ability of Type to represent multiple value types by consolidating function signatures as a pair of Types (params and results) stored on the Function object. Since there are no longer module-global named function types, significant changes had to be made to the printing and emitting of function types, as well as their parsing and manipulation in various passes. The C and JS APIs and their tests also had to be updated to remove named function types.
* Add string parameter to WASM_UNREACHABLE (#2499)Sam Clegg2019-12-051-2/+2
| | | | | This works more like llvm's unreachable handler in that is preserves information even in release builds.
* clang-tidy braces changes (#2075)Alon Zakai2019-05-011-1/+2
| | | Applies the changes in #2065, and temprarily disables the hook since it's too slow to run on a change this large. We should re-enable it in a later commit.
* Apply format changes from #2048 (#2059)Alon Zakai2019-04-261-51/+45
| | | Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048
* Verify flat IR where it is expected, and give a nice error (#2009)Alon Zakai2019-04-161-0/+3
| | | Fixes #2007 #2008
* Relooper CFG optimizations (#1759)Alon Zakai2018-11-211-6/+7
| | | | | | | | | | | | | | | | Previously the relooper would do some optimizations when deciding when to use an if vs a switch, how to group blocks, etc. This PR adds an additional pre-optimization phase with some basic but useful simplify-cfg style passes, * Skip empty blocks when they have just one exit. * Merge exiting branches when they are equivalent. * Canonicalize block contents to make such comparisons more useful. * Turn a trivial one-target switch into a simple branch. This can help in noticeable ways when running the rereloop pass, e.g. on LLVM wasm backend output. Also: * Binaryen C API changes to the relooper, which now gets a Module for its constructor. It needs it for the optimizations, as it may construct new nodes. * Many relooper-fuzzer improvements. * Clean up HashType usage.
* runFunction => runOnFunction (we run on the function, not run the function) ↵Alon Zakai2018-01-101-1/+1
| | | | (#1356)
* Rereloop fuzz fix (#1259)Alon Zakai2017-11-091-0/+12
| | | | * fix relooper bug, ensure function body has right type, as relooper output does not flow stuff out, but wasm functions with a result do expect a flow value, so none is not an option. in other words, as the docs say, a relooper block must end with a terminator (return, unreachable, break, etc.) and not flow out.
* notation change: AST => IR (#1245)Alon Zakai2017-10-241-1/+1
| | | The IR is indeed a tree, but not an "abstract syntax tree" since there is no language for which it is the syntax (except in the most trivial and meaningless sense).
* fix re-reloop fuzz bug, we need to ensure a terminator in all relooper ↵Alon Zakai2017-10-111-0/+31
| | | | blocks (#1214)
* Flattening rewrite (#1201)Alon Zakai2017-10-031-1/+1
| | | | | | | | | | | | | | | | | | | | Rename flatten-control-flow to flatten, which now flattens everything, not just control flow, so e.g. (i32.add (call $x) (call $y) ) ==> (block (set_local $temp_x (call $x)) (set_local $temp_y (call $y)) (i32.add (get_local $x) (get_local $y) ) ) This uses more locals than before, but is much simpler and avoids a bunch of corner cases and fuzz bugs the old one hit. We can optimize later if necessary.
* Make several derived classes final (#1180)Derek Schuff2017-09-121-6/+5
| | | | | | | Recent versions of clang turn on -Wdelete-non-virtual-dtor at our warning level, which fires when deleting a non-final class that has virtual functions but a non-virtual destructor. Pre-C++11 standard rule of thumb is to just always have a virtual destructor if there are virtual functions, but C++11 final is even better since it may allow for devirtualization optimizations.
* relooper improvementsAlon Zakai (kripken)2017-05-201-0/+3
|
* Re-reloop pass (#1009)Alon Zakai2017-05-161-0/+325
This adds a pass that converts to a CFG, runs the relooper, and re-generates wasm from that. This depends on flatten-control-flow being run before. The main goal here is to help code generators other than asm2wasm (which already receives relooped code from fastcomp).