summaryrefslogtreecommitdiff
path: root/test/lit/help
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-05-09 15:00:13 -0700
committerGitHub <noreply@github.com>2024-05-09 15:00:13 -0700
commit7b2e0190213487b5d2505fe86aa9bbbd30e80fcc (patch)
tree2ae614b27102d83452b0f075612c7558c4493aa6 /test/lit/help
parent006181bb98118c70d36e84e6f1f72b5d60264817 (diff)
downloadbinaryen-7b2e0190213487b5d2505fe86aa9bbbd30e80fcc.tar.gz
binaryen-7b2e0190213487b5d2505fe86aa9bbbd30e80fcc.tar.bz2
binaryen-7b2e0190213487b5d2505fe86aa9bbbd30e80fcc.zip
[StackIR] Run StackIR during binary writing and not as a pass (#6568)
Previously we had passes --generate-stack-ir, --optimize-stack-ir, --print-stack-ir that could be run like any other passes. After generating StackIR it was stashed on the function and invalidated if we modified BinaryenIR. If it wasn't invalidated then it was used during binary writing. This PR switches things so that we optionally generate, optimize, and print StackIR only during binary writing. It also removes all traces of StackIR from wasm.h - after this, StackIR is a feature of binary writing (and printing) logic only. This is almost NFC, but there are some minor noticeable differences: 1. We no longer print has StackIR in the text format when we see it is there. It will not be there during normal printing, as it is only present during binary writing. (but --print-stack-ir still works as before; as mentioned above it runs during writing). 2. --generate/optimize/print-stack-ir change from being passes to being flags that control that behavior instead. As passes, their order on the commandline mattered, while now it does not, and they only "globally" affect things during writing. 3. The C API changes slightly, as there is no need to pass it an option "optimize" to the StackIR APIs. Whether we optimize is handled by --optimize-stack-ir which is set like other optimization flags on the PassOptions object, so we don't need the old option to those C APIs. The main benefit here is simplifying the code, so we don't need to think about StackIR in more places than just binary writing. That may also allow future improvements to our usage of StackIR.
Diffstat (limited to 'test/lit/help')
-rw-r--r--test/lit/help/wasm-as.test6
-rw-r--r--test/lit/help/wasm-ctor-eval.test6
-rw-r--r--test/lit/help/wasm-dis.test6
-rw-r--r--test/lit/help/wasm-emscripten-finalize.test6
-rw-r--r--test/lit/help/wasm-merge.test6
-rw-r--r--test/lit/help/wasm-metadce.test6
-rw-r--r--test/lit/help/wasm-opt.test13
-rw-r--r--test/lit/help/wasm-reduce.test6
-rw-r--r--test/lit/help/wasm-split.test6
-rw-r--r--test/lit/help/wasm2js.test13
10 files changed, 60 insertions, 14 deletions
diff --git a/test/lit/help/wasm-as.test b/test/lit/help/wasm-as.test
index bf12fc1cf..09e5b7c9d 100644
--- a/test/lit/help/wasm-as.test
+++ b/test/lit/help/wasm-as.test
@@ -126,6 +126,12 @@
;; CHECK-NEXT: them and pass them back in, but not
;; CHECK-NEXT: inspect their contents or call them.
;; CHECK-NEXT:
+;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --print-stack-ir print StackIR during writing
+;; CHECK-NEXT:
;; CHECK-NEXT:
;; CHECK-NEXT: General options:
;; CHECK-NEXT: ----------------
diff --git a/test/lit/help/wasm-ctor-eval.test b/test/lit/help/wasm-ctor-eval.test
index bbf8e1daa..e511ef0b9 100644
--- a/test/lit/help/wasm-ctor-eval.test
+++ b/test/lit/help/wasm-ctor-eval.test
@@ -133,6 +133,12 @@
;; CHECK-NEXT: them and pass them back in, but not
;; CHECK-NEXT: inspect their contents or call them.
;; CHECK-NEXT:
+;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --print-stack-ir print StackIR during writing
+;; CHECK-NEXT:
;; CHECK-NEXT:
;; CHECK-NEXT: General options:
;; CHECK-NEXT: ----------------
diff --git a/test/lit/help/wasm-dis.test b/test/lit/help/wasm-dis.test
index f1f8283c8..2dffcc945 100644
--- a/test/lit/help/wasm-dis.test
+++ b/test/lit/help/wasm-dis.test
@@ -119,6 +119,12 @@
;; CHECK-NEXT: them and pass them back in, but not
;; CHECK-NEXT: inspect their contents or call them.
;; CHECK-NEXT:
+;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --print-stack-ir print StackIR during writing
+;; CHECK-NEXT:
;; CHECK-NEXT:
;; CHECK-NEXT: General options:
;; CHECK-NEXT: ----------------
diff --git a/test/lit/help/wasm-emscripten-finalize.test b/test/lit/help/wasm-emscripten-finalize.test
index 8666c2ea1..a4ba48b16 100644
--- a/test/lit/help/wasm-emscripten-finalize.test
+++ b/test/lit/help/wasm-emscripten-finalize.test
@@ -161,6 +161,12 @@
;; CHECK-NEXT: them and pass them back in, but not
;; CHECK-NEXT: inspect their contents or call them.
;; CHECK-NEXT:
+;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --print-stack-ir print StackIR during writing
+;; CHECK-NEXT:
;; CHECK-NEXT:
;; CHECK-NEXT: General options:
;; CHECK-NEXT: ----------------
diff --git a/test/lit/help/wasm-merge.test b/test/lit/help/wasm-merge.test
index 997923256..c87be5edf 100644
--- a/test/lit/help/wasm-merge.test
+++ b/test/lit/help/wasm-merge.test
@@ -149,6 +149,12 @@
;; CHECK-NEXT: them and pass them back in, but not
;; CHECK-NEXT: inspect their contents or call them.
;; CHECK-NEXT:
+;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --print-stack-ir print StackIR during writing
+;; CHECK-NEXT:
;; CHECK-NEXT:
;; CHECK-NEXT: General options:
;; CHECK-NEXT: ----------------
diff --git a/test/lit/help/wasm-metadce.test b/test/lit/help/wasm-metadce.test
index 4d706dc0f..f0889eb81 100644
--- a/test/lit/help/wasm-metadce.test
+++ b/test/lit/help/wasm-metadce.test
@@ -174,6 +174,12 @@
;; CHECK-NEXT: them and pass them back in, but not
;; CHECK-NEXT: inspect their contents or call them.
;; CHECK-NEXT:
+;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --print-stack-ir print StackIR during writing
+;; CHECK-NEXT:
;; CHECK-NEXT:
;; CHECK-NEXT: General options:
;; CHECK-NEXT: ----------------
diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test
index f7ee47c09..f6497618e 100644
--- a/test/lit/help/wasm-opt.test
+++ b/test/lit/help/wasm-opt.test
@@ -182,8 +182,6 @@
;; CHECK-NEXT: without JavaScript BigInt
;; CHECK-NEXT: support).
;; CHECK-NEXT:
-;; CHECK-NEXT: --generate-stack-ir generate Stack IR
-;; CHECK-NEXT:
;; CHECK-NEXT: --global-refining refine the types of globals
;; CHECK-NEXT:
;; CHECK-NEXT: --gsi globally optimize struct values
@@ -333,8 +331,6 @@
;; CHECK-NEXT: --optimize-j2cl optimizes J2CL specific
;; CHECK-NEXT: constructs.
;; CHECK-NEXT:
-;; CHECK-NEXT: --optimize-stack-ir optimize Stack IR
-;; CHECK-NEXT:
;; CHECK-NEXT: --outlining outline instructions
;; CHECK-NEXT:
;; CHECK-NEXT: --pick-load-signs pick load signs based on their
@@ -369,9 +365,6 @@
;; CHECK-NEXT: --print-minified print in minified s-expression
;; CHECK-NEXT: format
;; CHECK-NEXT:
-;; CHECK-NEXT: --print-stack-ir print out Stack IR (useful for
-;; CHECK-NEXT: internal debugging)
-;; CHECK-NEXT:
;; CHECK-NEXT: --propagate-debug-locs propagate debug location from
;; CHECK-NEXT: parents or previous siblings to
;; CHECK-NEXT: child nodes
@@ -746,6 +739,12 @@
;; CHECK-NEXT: in, but not inspect their
;; CHECK-NEXT: contents or call them.
;; CHECK-NEXT:
+;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --print-stack-ir print StackIR during writing
+;; CHECK-NEXT:
;; CHECK-NEXT:
;; CHECK-NEXT: General options:
;; CHECK-NEXT: ----------------
diff --git a/test/lit/help/wasm-reduce.test b/test/lit/help/wasm-reduce.test
index e28894e4a..a98b8a199 100644
--- a/test/lit/help/wasm-reduce.test
+++ b/test/lit/help/wasm-reduce.test
@@ -155,6 +155,12 @@
;; CHECK-NEXT: them and pass them back in, but not
;; CHECK-NEXT: inspect their contents or call them.
;; CHECK-NEXT:
+;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --print-stack-ir print StackIR during writing
+;; CHECK-NEXT:
;; CHECK-NEXT:
;; CHECK-NEXT: General options:
;; CHECK-NEXT: ----------------
diff --git a/test/lit/help/wasm-split.test b/test/lit/help/wasm-split.test
index e7b287fcc..fcd919ea8 100644
--- a/test/lit/help/wasm-split.test
+++ b/test/lit/help/wasm-split.test
@@ -235,6 +235,12 @@
;; CHECK-NEXT: them and pass them back in, but not
;; CHECK-NEXT: inspect their contents or call them.
;; CHECK-NEXT:
+;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --print-stack-ir print StackIR during writing
+;; CHECK-NEXT:
;; CHECK-NEXT:
;; CHECK-NEXT: General options:
;; CHECK-NEXT: ----------------
diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test
index 4b0330db6..13e93c33b 100644
--- a/test/lit/help/wasm2js.test
+++ b/test/lit/help/wasm2js.test
@@ -132,8 +132,6 @@
;; CHECK-NEXT: without JavaScript BigInt
;; CHECK-NEXT: support).
;; CHECK-NEXT:
-;; CHECK-NEXT: --generate-stack-ir generate Stack IR
-;; CHECK-NEXT:
;; CHECK-NEXT: --global-refining refine the types of globals
;; CHECK-NEXT:
;; CHECK-NEXT: --gsi globally optimize struct values
@@ -283,8 +281,6 @@
;; CHECK-NEXT: --optimize-j2cl optimizes J2CL specific
;; CHECK-NEXT: constructs.
;; CHECK-NEXT:
-;; CHECK-NEXT: --optimize-stack-ir optimize Stack IR
-;; CHECK-NEXT:
;; CHECK-NEXT: --outlining outline instructions
;; CHECK-NEXT:
;; CHECK-NEXT: --pick-load-signs pick load signs based on their
@@ -319,9 +315,6 @@
;; CHECK-NEXT: --print-minified print in minified s-expression
;; CHECK-NEXT: format
;; CHECK-NEXT:
-;; CHECK-NEXT: --print-stack-ir print out Stack IR (useful for
-;; CHECK-NEXT: internal debugging)
-;; CHECK-NEXT:
;; CHECK-NEXT: --propagate-debug-locs propagate debug location from
;; CHECK-NEXT: parents or previous siblings to
;; CHECK-NEXT: child nodes
@@ -696,6 +689,12 @@
;; CHECK-NEXT: in, but not inspect their
;; CHECK-NEXT: contents or call them.
;; CHECK-NEXT:
+;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing
+;; CHECK-NEXT:
+;; CHECK-NEXT: --print-stack-ir print StackIR during writing
+;; CHECK-NEXT:
;; CHECK-NEXT:
;; CHECK-NEXT: General options:
;; CHECK-NEXT: ----------------