From 460938bd3fd9edc1419f0f85e7a4e5bdfbc60129 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 17 Jun 2016 17:46:14 +0100 Subject: [PATCH 1/2] Simplify loop by removing its exit label. This removes loop's bottom label. --- AstSemantics.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/AstSemantics.md b/AstSemantics.md index 0fbb8c0b..78889152 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -345,9 +345,12 @@ a value and may appear as children of other expressions. ### Branches and nesting The `br` and `br_if` constructs express low-level branching. -Branches may only reference labels defined by an outer *enclosing construct*. -This means that, for example, references to a `block`'s label can only occur -within the `block`'s body. +Branches may only reference labels defined by an outer *enclosing construct*, +which can be a `block` (with a label at the `end`), `loop` (with a label at the +beginning), `if` (with a label at the `end` or `else`), `else` (with a label at +the `end), or the function body (with a label at the `end`). This means that, +for example, references to a `block`'s label can only occur within the +`block`'s body. In practice, outer `block`s can be used to place labels for any given branching pattern, except for one restriction: one can't branch into the middle of a loop @@ -367,7 +370,7 @@ The `nop`, `br`, `br_if`, `br_table`, and `return` constructs do not yield value Other control constructs may yield values if their subexpressions yield values: * `block`: yields either the value of the last expression in the block or the result of an inner branch that targeted the label of the block -* `loop`: yields either the value of the last expression in the loop or the result of an inner branch that targeted the end label of the loop +* `loop`: yields either the value of the last expression in the loop * `if`: yields either the value of the last *then* expression or the last *else* expression or the result of an inner branch that targeted the label of one of these. In all constructs containing block-like sequences of expressions, all expressions but the last must not yield a value. From 1c0697ee80cdacaa9011cca3b6a69dc7c0e7a751 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 14 Sep 2016 13:55:37 -0700 Subject: [PATCH 2/2] Remove "either". --- AstSemantics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AstSemantics.md b/AstSemantics.md index 78889152..426090b7 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -370,7 +370,7 @@ The `nop`, `br`, `br_if`, `br_table`, and `return` constructs do not yield value Other control constructs may yield values if their subexpressions yield values: * `block`: yields either the value of the last expression in the block or the result of an inner branch that targeted the label of the block -* `loop`: yields either the value of the last expression in the loop +* `loop`: yields the value of the last expression in the loop * `if`: yields either the value of the last *then* expression or the last *else* expression or the result of an inner branch that targeted the label of one of these. In all constructs containing block-like sequences of expressions, all expressions but the last must not yield a value.