From f59174c1cf526d7e9fe5d4ba74ab0370f40a1856 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 13 May 2021 13:57:19 -0700 Subject: Add pass argument sugar to commandline (#3882) 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). --- .../extract-function_pass-arg=extract@foo.wast | 36 ---------------------- 1 file changed, 36 deletions(-) delete mode 100644 test/passes/extract-function_pass-arg=extract@foo.wast (limited to 'test/passes/extract-function_pass-arg=extract@foo.wast') diff --git a/test/passes/extract-function_pass-arg=extract@foo.wast b/test/passes/extract-function_pass-arg=extract@foo.wast deleted file mode 100644 index ab1d8b269..000000000 --- a/test/passes/extract-function_pass-arg=extract@foo.wast +++ /dev/null @@ -1,36 +0,0 @@ -(module - (func $foo - (call $bar) - ) - (func $bar - (call $foo) - ) - (func $other - (drop (i32.const 1)) - ) -) -(module - ;; Use another function in the table, but the table is not used in the - ;; extracted function - (table $t 10 funcref) - (elem $0 (table $t) (i32.const 0) func $other) - (func $foo - ) - (func $other - (drop (i32.const 1)) - ) -) -(module - ;; Use another function in the table, and the table *is* used. As a result, - ;; the table and its elements will remain. The called function, $other, will - ;; remain as an import that is placed in the table. - (type $none (func)) - (table $t 10 funcref) - (elem $0 (table $t) (i32.const 0) func $other) - (func $foo - (call_indirect (type $none) (i32.const 10)) - ) - (func $other - (drop (i32.const 1)) - ) -) -- cgit v1.2.3