-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12074 from ethereum/output-selection-in-assembler…
…-mode CLI output selection in assembler mode
- Loading branch information
Showing
44 changed files
with
249 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--assemble --optimize --yul-dialect evm --machine ewasm --asm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Warning: Yul is still experimental. Please use the output with care. |
4 changes: 4 additions & 0 deletions
4
test/cmdlineTests/evm_to_wasm_output_selection_asm_only/input.yul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
let x := 42 | ||
sstore(0, x) | ||
} |
2 changes: 2 additions & 0 deletions
2
test/cmdlineTests/evm_to_wasm_output_selection_asm_only/output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
======= evm_to_wasm_output_selection_asm_only/input.yul (Ewasm) ======= |
1 change: 1 addition & 0 deletions
1
test/cmdlineTests/evm_to_wasm_output_selection_ewasm_ir_only/args
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--assemble --optimize --yul-dialect evm --machine ewasm --ewasm-ir |
1 change: 1 addition & 0 deletions
1
test/cmdlineTests/evm_to_wasm_output_selection_ewasm_ir_only/err
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Warning: Yul is still experimental. Please use the output with care. |
4 changes: 4 additions & 0 deletions
4
test/cmdlineTests/evm_to_wasm_output_selection_ewasm_ir_only/input.yul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
let x := 42 | ||
sstore(0, x) | ||
} |
34 changes: 34 additions & 0 deletions
34
test/cmdlineTests/evm_to_wasm_output_selection_ewasm_ir_only/output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
======= evm_to_wasm_output_selection_ewasm_ir_only/input.yul (Ewasm) ======= | ||
|
||
========================== | ||
|
||
Translated source: | ||
object "object" { | ||
code { | ||
function main() | ||
{ | ||
let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(0))), 32) | ||
let y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(0, 32))))) | ||
i64.store(0:i32, y) | ||
i64.store(i32.add(0:i32, 8:i32), y) | ||
i64.store(i32.add(0:i32, 16:i32), y) | ||
i64.store(i32.add(0:i32, 24:i32), y) | ||
i64.store(32:i32, y) | ||
i64.store(i32.add(32:i32, 8:i32), y) | ||
i64.store(i32.add(32:i32, 16:i32), y) | ||
let hi_1 := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(42))), 32) | ||
i64.store(i32.add(32:i32, 24:i32), i64.or(hi_1, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(42, 32)))))) | ||
eth.storageStore(0:i32, 32:i32) | ||
} | ||
function bswap16(x:i32) -> y:i32 | ||
{ | ||
y := i32.or(i32.and(i32.shl(x, 8:i32), 0xff00:i32), i32.and(i32.shr_u(x, 8:i32), 0xff:i32)) | ||
} | ||
function bswap32(x:i32) -> y:i32 | ||
{ | ||
let hi:i32 := i32.shl(bswap16(x), 16:i32) | ||
y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32))) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--assemble --optimize --yul-dialect evm --machine ewasm --ewasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Warning: Yul is still experimental. Please use the output with care. |
4 changes: 4 additions & 0 deletions
4
test/cmdlineTests/evm_to_wasm_output_selection_ewasm_only/input.yul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
let x := 42 | ||
sstore(0, x) | ||
} |
54 changes: 54 additions & 0 deletions
54
test/cmdlineTests/evm_to_wasm_output_selection_ewasm_only/output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
|
||
======= evm_to_wasm_output_selection_ewasm_only/input.yul (Ewasm) ======= | ||
|
||
Text representation: | ||
(module | ||
(import "ethereum" "storageStore" (func $eth.storageStore (param i32 i32))) | ||
(memory $memory (export "memory") 1) | ||
(export "main" (func $main)) | ||
|
||
(func $main | ||
(local $hi i64) | ||
(local $y i64) | ||
(local $hi_1 i64) | ||
(block $label_ | ||
(local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 0)))) (i64.const 32))) | ||
(local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 0) (i64.const 32))))))) | ||
(i64.store (i32.const 0) (local.get $y)) | ||
(i64.store (i32.add (i32.const 0) (i32.const 8)) (local.get $y)) | ||
(i64.store (i32.add (i32.const 0) (i32.const 16)) (local.get $y)) | ||
(i64.store (i32.add (i32.const 0) (i32.const 24)) (local.get $y)) | ||
(i64.store (i32.const 32) (local.get $y)) | ||
(i64.store (i32.add (i32.const 32) (i32.const 8)) (local.get $y)) | ||
(i64.store (i32.add (i32.const 32) (i32.const 16)) (local.get $y)) | ||
(local.set $hi_1 (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 42)))) (i64.const 32))) | ||
(i64.store (i32.add (i32.const 32) (i32.const 24)) (i64.or (local.get $hi_1) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 42) (i64.const 32))))))) | ||
(call $eth.storageStore (i32.const 0) (i32.const 32)) | ||
) | ||
) | ||
|
||
(func $bswap16 | ||
(param $x i32) | ||
(result i32) | ||
(local $y i32) | ||
(block $label__1 | ||
(local.set $y (i32.or (i32.and (i32.shl (local.get $x) (i32.const 8)) (i32.const 65280)) (i32.and (i32.shr_u (local.get $x) (i32.const 8)) (i32.const 255)))) | ||
|
||
) | ||
(local.get $y) | ||
) | ||
|
||
(func $bswap32 | ||
(param $x i32) | ||
(result i32) | ||
(local $y i32) | ||
(local $hi i32) | ||
(block $label__2 | ||
(local.set $hi (i32.shl (call $bswap16 (local.get $x)) (i32.const 16))) | ||
(local.set $y (i32.or (local.get $hi) (call $bswap16 (i32.shr_u (local.get $x) (i32.const 16))))) | ||
|
||
) | ||
(local.get $y) | ||
) | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--optimize --ewasm-ir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The following outputs are not supported in compiler mode: --ewasm-ir. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
pragma solidity *; | ||
|
||
contract C {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
--ast-compact-json --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --ewasm --hashes --userdoc --devdoc --metadata --storage-layout | ||
--ast-compact-json --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --ewasm --ewasm-ir --hashes --userdoc --devdoc --metadata --storage-layout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
The following outputs are not supported in standard JSON mode: --abi, --asm, --asm-json, --ast-compact-json, --bin, --bin-runtime, --devdoc, --ewasm, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc. | ||
The following outputs are not supported in standard JSON mode: --abi, --asm, --asm-json, --ast-compact-json, --bin, --bin-runtime, --devdoc, --ewasm, --ewasm-ir, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--strict-assembly --optimize --asm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Warning: Yul is still experimental. Please use the output with care. |
4 changes: 4 additions & 0 deletions
4
test/cmdlineTests/strict_asm_output_selection_asm_only/input.yul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
let x := 42 | ||
sstore(0, x) | ||
} |
12 changes: 12 additions & 0 deletions
12
test/cmdlineTests/strict_asm_output_selection_asm_only/output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
======= strict_asm_output_selection_asm_only/input.yul (EVM) ======= | ||
|
||
Text representation: | ||
/* "strict_asm_output_selection_asm_only/input.yul":15:17 */ | ||
0x2a | ||
/* "strict_asm_output_selection_asm_only/input.yul":29:30 */ | ||
0x00 | ||
/* "strict_asm_output_selection_asm_only/input.yul":22:34 */ | ||
sstore | ||
/* "strict_asm_output_selection_asm_only/input.yul":0:36 */ | ||
stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--strict-assembly --optimize --bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Warning: Yul is still experimental. Please use the output with care. |
4 changes: 4 additions & 0 deletions
4
test/cmdlineTests/strict_asm_output_selection_bin_only/input.yul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
let x := 42 | ||
sstore(0, x) | ||
} |
5 changes: 5 additions & 0 deletions
5
test/cmdlineTests/strict_asm_output_selection_bin_only/output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
======= strict_asm_output_selection_bin_only/input.yul (EVM) ======= | ||
|
||
Binary representation: | ||
602a60005500 |
1 change: 1 addition & 0 deletions
1
test/cmdlineTests/strict_asm_output_selection_ewasm_ir_only/args
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--strict-assembly --optimize --ewasm-ir |
1 change: 1 addition & 0 deletions
1
test/cmdlineTests/strict_asm_output_selection_ewasm_ir_only/err
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Warning: Yul is still experimental. Please use the output with care. |
4 changes: 4 additions & 0 deletions
4
test/cmdlineTests/strict_asm_output_selection_ewasm_ir_only/input.yul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
let x := 42 | ||
sstore(0, x) | ||
} |
2 changes: 2 additions & 0 deletions
2
test/cmdlineTests/strict_asm_output_selection_ewasm_ir_only/output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
======= strict_asm_output_selection_ewasm_ir_only/input.yul (EVM) ======= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--strict-assembly --optimize --ewasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Warning: Yul is still experimental. Please use the output with care. |
4 changes: 4 additions & 0 deletions
4
test/cmdlineTests/strict_asm_output_selection_ewasm_only/input.yul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
let x := 42 | ||
sstore(0, x) | ||
} |
2 changes: 2 additions & 0 deletions
2
test/cmdlineTests/strict_asm_output_selection_ewasm_only/output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
======= strict_asm_output_selection_ewasm_only/input.yul (EVM) ======= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
The following outputs are not supported in assembler mode: --abi, --asm, --asm-json, --bin, --bin-runtime, --devdoc, --ewasm, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc. | ||
The following outputs are not supported in assembler mode: --abi, --asm-json, --bin-runtime, --devdoc, --hashes, --ir, --metadata, --opcodes, --storage-layout, --userdoc. |
1 change: 1 addition & 0 deletions
1
test/cmdlineTests/strict_asm_output_selection_ir_optimized_only/args
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--strict-assembly --optimize --ir-optimized |
1 change: 1 addition & 0 deletions
1
test/cmdlineTests/strict_asm_output_selection_ir_optimized_only/err
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Warning: Yul is still experimental. Please use the output with care. |
4 changes: 4 additions & 0 deletions
4
test/cmdlineTests/strict_asm_output_selection_ir_optimized_only/input.yul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
let x := 42 | ||
sstore(0, x) | ||
} |
7 changes: 7 additions & 0 deletions
7
test/cmdlineTests/strict_asm_output_selection_ir_optimized_only/output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
======= strict_asm_output_selection_ir_optimized_only/input.yul (EVM) ======= | ||
|
||
Pretty printed source: | ||
object "object" { | ||
code { { sstore(0, 42) } } | ||
} |
Oops, something went wrong.