You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"br: branch to a given label in an enclosing construct"
The br-family instructions in WebAssembly are very different from assemblies like LLVM IR where you can jump to arbitrary labels. I think this should be pointed out in the documentation.
I think this would be a better description of this instruction:
"br: break to block at given nesting-level in an enclosing construct"
Since "br" works more like a "break" in C than a "goto" in C or a "br" in LLVM IR.
The text was updated successfully, but these errors were encountered:
@joelonsql The semantics document is useful as an overview, but has not been updated in a long time. You may want to look at the spec instead. In particular, br is defined here:
Each structured control instruction introduces an implicit label. Labels are targets for branch instructions that reference them with label indices. Unlike with other index spaces, indexing of labels is relative by nesting depth, that is, label 0 refers to the innermost structured control instruction enclosing the referring branch instruction, while increasing indices refer to those farther out. Consequently, labels can only be referenced from within the associated structured control instruction. This also implies that branches can only be directed outwards, “breaking” from the block of the control construct they target. The exact effect depends on that control construct. In case of block or if it is a forward jump, resuming execution after the matching end. In case of loop it is a backward jump to the beginning of the loop.
From https://webassembly.org/docs/semantics/
"br: branch to a given label in an enclosing construct"
The br-family instructions in WebAssembly are very different from assemblies like LLVM IR where you can jump to arbitrary labels. I think this should be pointed out in the documentation.
I think this would be a better description of this instruction:
"br: break to block at given nesting-level in an enclosing construct"
Since "br" works more like a "break" in C than a "goto" in C or a "br" in LLVM IR.
The text was updated successfully, but these errors were encountered: