diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2020-09-09 13:01:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-09 13:01:21 -0700 |
commit | 2aa0cf300998c62aea8cc6698f8325653a9f0895 (patch) | |
tree | 2116bc18fd58514589821858c528951e76c5178b /src/ir/stack-utils.h | |
parent | 41ea543093ed734c73e5202c58c899be447b3223 (diff) | |
download | binaryen-2aa0cf300998c62aea8cc6698f8325653a9f0895.tar.gz binaryen-2aa0cf300998c62aea8cc6698f8325653a9f0895.tar.bz2 binaryen-2aa0cf300998c62aea8cc6698f8325653a9f0895.zip |
Poppy IR wast parsing and validation (#3105)
Adds an IR profile to each function so the validator can determine
which validation rules to apply and adds a flag to have the wast
parser set the profile to Poppy for testing purposes.
Diffstat (limited to 'src/ir/stack-utils.h')
-rw-r--r-- | src/ir/stack-utils.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ir/stack-utils.h b/src/ir/stack-utils.h index 89ec7d47e..fc23b6080 100644 --- a/src/ir/stack-utils.h +++ b/src/ir/stack-utils.h @@ -33,7 +33,10 @@ // stack type of each instruction. Pops may not have `unreachable` type. // // 4. Only control flow structures and instructions that have polymorphic -// unreachable behavior in WebAssembly may have unreachable type. +// unreachable behavior in WebAssembly may have unreachable type. Blocks may +// be unreachable when they are not branch targets and when they have an +// unreachable child. Note that this means a block may be unreachable even +// if it would otherwise have a concrete type, unlike in Binaryen IR. // // For example, the following Binaryen IR Function: // @@ -58,7 +61,10 @@ // ) // // Notice that the sequence of instructions in the block is now identical to the -// sequence of instructions in raw WebAssembly. +// sequence of instructions in raw WebAssembly. Also note that Poppy IR's +// validation rules are largely additional on top of the normal Binaryen IR +// validation rules, with the only exceptions being block body validation and +// block unreahchability rules. // #ifndef wasm_ir_stack_h @@ -75,6 +81,10 @@ namespace StackUtils { // Iterate through `block` and remove nops. void removeNops(Block* block); +// Whether `expr` may be unreachable in Poppy IR. True for control flow +// structures and polymorphic unreachable instructions. +bool mayBeUnreachable(Expression* expr); + } // namespace StackUtils // Stack signatures are like regular function signatures, but they are used to |