summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2023-11-09 23:24:09 +0100
committerGitHub <noreply@github.com>2023-11-09 14:24:09 -0800
commitb289577d596bc23e9285e12661e96149a29edb6c (patch)
treed89d1dd7114055c8b0910861d03b4abf2f5e2242 /scripts
parentb8422c5c964fdbb1d4cb01181de121c30c0a2f70 (diff)
downloadbinaryen-b289577d596bc23e9285e12661e96149a29edb6c.tar.gz
binaryen-b289577d596bc23e9285e12661e96149a29edb6c.tar.bz2
binaryen-b289577d596bc23e9285e12661e96149a29edb6c.zip
[Parser][NFC] Filter out unused instructions in gen-s-parser.py (#6095)
The new wat parser parses block, if, loop, then, and else keywords directly rather than depending on code generated from gen-s-parser.py. Filter these keywords out in gen-s-parser.py when generating the new wat parser and delete the stub functions that the removed generated code used to depend on.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gen-s-parser.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py
index 776cc4425..08c5fe31f 100755
--- a/scripts/gen-s-parser.py
+++ b/scripts/gen-s-parser.py
@@ -708,6 +708,11 @@ class Node:
def instruction_parser(new_parser=False):
"""Build a trie out of all the instructions, then emit it as C++ code."""
+ global instructions
+ if new_parser:
+ # Filter out instructions that the new parser does not need.
+ instructions = [(inst, code) for (inst, code) in instructions
+ if inst not in ('block', 'loop', 'if', 'then', 'else')]
trie = Node()
inst_length = 0
for inst, expr in instructions: