mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
CommandLineInterface: Make --yul-optimizations work in strict assembly mode
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"language": "Yul",
|
||||
"sources":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"content": "{ let x := mload(0) sstore(add(x, 0), 0) }"
|
||||
}
|
||||
},
|
||||
"settings":
|
||||
{
|
||||
"optimizer": {
|
||||
"enabled": true,
|
||||
"details": {
|
||||
"yul": true,
|
||||
"yulDetails": {
|
||||
"optimizerSteps": "dhfoDgvulfnTUtnIf"
|
||||
}
|
||||
}
|
||||
},
|
||||
"outputSelection":
|
||||
{
|
||||
"*": { "*": ["*"], "": [ "*" ] }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{"contracts":{"A":{"object":{"evm":{"assembly":" /* \"A\":17:18 */
|
||||
0x00
|
||||
/* \"A\":11:19 */
|
||||
mload
|
||||
/* \"A\":38:39 */
|
||||
0x00
|
||||
/* \"A\":34:35 */
|
||||
0x00
|
||||
/* \"A\":31:32 */
|
||||
dup3
|
||||
/* \"A\":27:36 */
|
||||
add
|
||||
/* \"A\":20:40 */
|
||||
sstore
|
||||
pop
|
||||
","bytecode":{"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"}},"ir":"object \"object\" {
|
||||
code {
|
||||
let x := mload(0)
|
||||
sstore(add(x, 0), 0)
|
||||
}
|
||||
}
|
||||
","irOptimized":"object \"object\" {
|
||||
code {
|
||||
{
|
||||
let x := mload(0)
|
||||
sstore(add(x, 0), 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
"}}},"errors":[{"component":"general","formattedMessage":"Yul is still experimental. Please use the output with care.","message":"Yul is still experimental. Please use the output with care.","severity":"warning","type":"Warning"}]}
|
||||
@@ -0,0 +1 @@
|
||||
--strict-assembly --optimize --yul-optimizations dhfoDgvulfnTUtnIf
|
||||
@@ -0,0 +1 @@
|
||||
Warning: Yul is still experimental. Please use the output with care.
|
||||
@@ -0,0 +1,27 @@
|
||||
object "C_6" {
|
||||
code {
|
||||
mstore(64, 128)
|
||||
if callvalue() { revert(0, 0) }
|
||||
codecopy(0, dataoffset("C_6_deployed"), datasize("C_6_deployed"))
|
||||
return(0, datasize("C_6_deployed"))
|
||||
}
|
||||
object "C_6_deployed" {
|
||||
code {
|
||||
{
|
||||
mstore(64, 128)
|
||||
if iszero(lt(calldatasize(), 4))
|
||||
{
|
||||
let selector := shift_right_224_unsigned(calldataload(0))
|
||||
pop(selector)
|
||||
}
|
||||
pop(iszero(calldatasize()))
|
||||
revert(0, 0)
|
||||
}
|
||||
|
||||
function shift_right_224_unsigned(value) -> newValue
|
||||
{
|
||||
newValue := shr(224, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
|
||||
======= strict_asm_optimizer_steps/input.yul (EVM) =======
|
||||
|
||||
Pretty printed source:
|
||||
object "C_6" {
|
||||
code {
|
||||
{
|
||||
mstore(64, 128)
|
||||
if callvalue() { revert(0, 0) }
|
||||
codecopy(0, dataoffset("C_6_deployed"), datasize("C_6_deployed"))
|
||||
return(0, datasize("C_6_deployed"))
|
||||
}
|
||||
}
|
||||
object "C_6_deployed" {
|
||||
code {
|
||||
{
|
||||
mstore(64, 128)
|
||||
pop(iszero(lt(calldatasize(), 4)))
|
||||
revert(0, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary representation:
|
||||
60806040523415600f5760006000fd5b6010601d60003960106000f3fe608060405260043610155060006000fd
|
||||
|
||||
Text representation:
|
||||
/* "strict_asm_optimizer_steps/input.yul":45:48 */
|
||||
0x80
|
||||
/* "strict_asm_optimizer_steps/input.yul":41:43 */
|
||||
0x40
|
||||
/* "strict_asm_optimizer_steps/input.yul":34:49 */
|
||||
mstore
|
||||
/* "strict_asm_optimizer_steps/input.yul":61:72 */
|
||||
callvalue
|
||||
/* "strict_asm_optimizer_steps/input.yul":58:60 */
|
||||
iszero
|
||||
tag_1
|
||||
jumpi
|
||||
/* "strict_asm_optimizer_steps/input.yul":85:86 */
|
||||
0x00
|
||||
/* "strict_asm_optimizer_steps/input.yul":82:83 */
|
||||
0x00
|
||||
/* "strict_asm_optimizer_steps/input.yul":75:87 */
|
||||
revert
|
||||
/* "strict_asm_optimizer_steps/input.yul":58:60 */
|
||||
tag_1:
|
||||
/* "strict_asm_optimizer_steps/input.yul":98:163 */
|
||||
dataSize(sub_0)
|
||||
dataOffset(sub_0)
|
||||
/* "strict_asm_optimizer_steps/input.yul":107:108 */
|
||||
0x00
|
||||
/* "strict_asm_optimizer_steps/input.yul":98:163 */
|
||||
codecopy
|
||||
/* "strict_asm_optimizer_steps/input.yul":172:207 */
|
||||
dataSize(sub_0)
|
||||
/* "strict_asm_optimizer_steps/input.yul":179:180 */
|
||||
0x00
|
||||
/* "strict_asm_optimizer_steps/input.yul":172:207 */
|
||||
return
|
||||
stop
|
||||
|
||||
sub_0: assembly {
|
||||
/* "strict_asm_optimizer_steps/input.yul":298:301 */
|
||||
0x80
|
||||
/* "strict_asm_optimizer_steps/input.yul":294:296 */
|
||||
0x40
|
||||
/* "strict_asm_optimizer_steps/input.yul":287:302 */
|
||||
mstore
|
||||
/* "strict_asm_optimizer_steps/input.yul":348:349 */
|
||||
0x04
|
||||
/* "strict_asm_optimizer_steps/input.yul":332:346 */
|
||||
calldatasize
|
||||
/* "strict_asm_optimizer_steps/input.yul":329:350 */
|
||||
lt
|
||||
/* "strict_asm_optimizer_steps/input.yul":322:351 */
|
||||
iszero
|
||||
/* "strict_asm_optimizer_steps/input.yul":319:321 */
|
||||
pop
|
||||
/* "strict_asm_optimizer_steps/input.yul":570:571 */
|
||||
0x00
|
||||
/* "strict_asm_optimizer_steps/input.yul":567:568 */
|
||||
0x00
|
||||
/* "strict_asm_optimizer_steps/input.yul":560:572 */
|
||||
revert
|
||||
}
|
||||
Reference in New Issue
Block a user