From b798fd505b105e418288e1f9d9ce110cc2092d57 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 29 Sep 2015 08:58:03 -0700 Subject: [PATCH 1/4] Spell out the "literal" operators. Also, remove a broken link to the binary encoding page. The binary encoding is not yet determined, but AstSemantics.md doesn't need to reference it right now anyway. --- AstSemantics.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/AstSemantics.md b/AstSemantics.md index 35e93951..63c10ffb 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -348,8 +348,14 @@ values. ## Literals -Each local type allows literal values directly in the AST. See the -[binary encoding section](BinaryEncoding.md#constant-pool). +These opcodes have an immediate operand of their associated type which is +copied into their result value. All possible values of all types are +supported. + + * `i32.literal`: produce the value of an i32 immediate + * `i64.literal`: produce the value of an i64 immediate + * `f32.literal`: produce the value of an f32 immediate + * `f64.literal`: produce the value of an f64 immediate ## Expressions with control flow From 1c14145d6632a7f05c189f5f76d7a42555eb5eff Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 29 Sep 2015 12:14:32 -0700 Subject: [PATCH 2/4] Clarify that all NaNs are supported. --- AstSemantics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AstSemantics.md b/AstSemantics.md index 63c10ffb..0d7d303c 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -350,7 +350,7 @@ values. These opcodes have an immediate operand of their associated type which is copied into their result value. All possible values of all types are -supported. +supported (including NaN values of all possible bit patterns). * `i32.literal`: produce the value of an i32 immediate * `i64.literal`: produce the value of an i64 immediate From ba76b25a973ca87928ca1d0838bcdfc4f264d4d8 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 29 Sep 2015 12:14:50 -0700 Subject: [PATCH 3/4] Say "produced" instead of "copied" to match language elsewhere in the design. --- AstSemantics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AstSemantics.md b/AstSemantics.md index 0d7d303c..0ebd81e8 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -349,7 +349,7 @@ values. ## Literals These opcodes have an immediate operand of their associated type which is -copied into their result value. All possible values of all types are +produced as their result value. All possible values of all types are supported (including NaN values of all possible bit patterns). * `i32.literal`: produce the value of an i32 immediate From c84c8d2357b95da03f71e03e12406f721e39c66b Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 1 Oct 2015 07:22:31 -0700 Subject: [PATCH 4/4] Rename `literal` to `const`. --- AstSemantics.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/AstSemantics.md b/AstSemantics.md index 0ebd81e8..12a9d8c6 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -346,16 +346,16 @@ function that returns multiple values will likely have to be a statement that specifies multiple local variables to which to assign the corresponding return values. -## Literals +## Constants These opcodes have an immediate operand of their associated type which is produced as their result value. All possible values of all types are supported (including NaN values of all possible bit patterns). - * `i32.literal`: produce the value of an i32 immediate - * `i64.literal`: produce the value of an i64 immediate - * `f32.literal`: produce the value of an f32 immediate - * `f64.literal`: produce the value of an f64 immediate + * `i32.const`: produce the value of an i32 immediate + * `i64.const`: produce the value of an i64 immediate + * `f32.const`: produce the value of an f32 immediate + * `f64.const`: produce the value of an f64 immediate ## Expressions with control flow