summaryrefslogtreecommitdiff
path: root/src/passes/ExtractFunction.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Refactor interaction between Pass and PassRunner (#5093)Thomas Lively2022-09-301-9/+8
| | | | | | | | | | | | | | 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.
* Improve ExtractFunction pass error printing (#4747)juj2022-09-131-2/+3
| | | | | * Improve ExtractFunction pass error printing. * Update lint
* Add missing include for windows (#4627)martinRenou2022-05-021-0/+2
| | | | | Without this Windows fails with: 'isdigit': is not a member of 'std'
* Do not crash in ExtractFunction if an export already exists (#4040)Alon Zakai2021-07-301-0/+1
| | | | | | | | We just cleared the list of exports, but the exportMap was still populated, so the data was in an inconsistent state. This fixes the case of running --extract-function multiple times on a file (which is usually not useful, unless one of the passes you are debugging adds new functions to the file - which some do).
* Add a extract-function-index passThomas Lively2021-06-171-28/+51
| | | | | | | | This is a useful alternative to extract-function when you don't know the function's name. Also moves the extract-function tests to be lit tests and re-uses them as extract-function-index tests.
* Fix usage comment for ExtractFunction (#3896)Alon Zakai2021-05-191-1/+1
| | | Fixes #3895
* Add pass argument sugar to commandline (#3882)Alon Zakai2021-05-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have --pass-arg that allows sending an argument to a pass, like this: wasm-opt --do-stuff --pass-arg=do-stuff@FUNCTION_NAME With this PR that is equivalent to this: wasm-opt --do-stuff=FUNCTION_NAME That is,one can just give an argument to a pass on the commandline. This fixes the Optional mode in command-line.h/cpp. That was not actually used anywhere before this PR. Also rename --extract-function's pass argument to match it. That is, the usage used to be wasm-opt --extract-function --pass-arg=extract@FUNCTION_NAME Note how the pass name differed from the pass-arg name. This changes it to match. This is a breaking change, but I doubt this is used enough to justify any deprecation / backwards compatibility effort, and any usage is almost certainly manual, and with PR writing it manually becomes easier as one can do wasm-opt --extract-function=FUNCTION_NAME The existing test for that is kept (&renamed), and a new test added to test the new notation. This is a step towards unifying the symbol map functionality between wasm-as and wasm-opt (later PRs will turn the symbol mapping pass into a pass that receives an argument).
* ExtractFunction: Do not always remove the memory and table (#3877)Alon Zakai2021-05-111-17/+19
| | | | | | | | | Instead, run RemoveUnusedModuleElements, which does that sort of thing. That is, this pass just "extracts" the function by turning all others into imports, and then they should almost all be removable via RemoveUnusedModuleElements, depending on whether they are used in the table or not, whether the extracted function calls them, etc. Without this, we would error if a function was in the table, and so this fixes #3876
* [reference-types] remove single table restriction in IR (#3517)Abbas Mashayekh2021-02-091-1/+3
| | | Adds support for modules with multiple tables. Adds a field for the table name to `CallIndirect` and updates the C/JS APIs accordingly.
* Improve testing on Windows (#3142)Wouter van Oortmerssen2020-09-171-2/+1
| | | | | | This PR contains: - Changes that enable/disable tests on Windows to allow for better local testing. - Also changes many abort() into Fatal() when it is really just exiting on error. This is because abort() generates a dialog window on Windows which is not great in automated scripts. - Improvements to CMake to better work with the project in IDEs (VS).
* Add a --strip-dwarf pass (#2454)Alon Zakai2019-11-191-6/+8
| | | | | | | | | | | | | This pass strips DWARF debug sections, but not other debug sections. This is useful when emitting source maps, as we do need the SourceMapURL section, but the DWARF sections are not longer necessary (and we've seen a testcase where they are massively large, so big the wasm can't even be loaded in a browser...). Also contains a trivial one-line fix in --extract-function which was necessary to create the testcase here: that pass extracts a function from a wasm file (like llvm-extract) but it didn't check if an export already existed for the function.
* Don't use colons in filenames (#2134)Derek Schuff2019-05-211-1/+1
| | | Windows filenames can't contain colons. Use @ instead for passing arguments to passes.
* Apply format changes from #2048 (#2059)Alon Zakai2019-04-261-6/+5
| | | 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
* Add a mechanism to pass arguments to passes (#1941)Alon Zakai2019-04-031-13/+9
| | | | | | | | | This allows wasm-opt --pass-arg=KEY:VALUE where KEY and VALUE are strings. It is then added to passOptions.arguments, where passes can read it. This is used in ExtractFunction instead of an env var.
* improve --extract-function (#1517)Alon Zakai2018-04-271-4/+22
| | | Remove more of the unwanted stuff, and leave just an export to the function we are extracting. Then optimizations can do an effective cleanup.
* make ExtractFunction use an env var instead of a hardcoded stringAlon Zakai2016-11-061-2/+8
|
* add ExtractFunction passAlon Zakai2016-09-131-0/+46