Merge pull request #8663 from ethereum/ir-function-generation-queue

[Sol->Yul] IR function generation queue (refactor)
This commit is contained in:
chriseth
2020-04-20 15:17:53 +02:00
committed by GitHub
15 changed files with 91 additions and 165 deletions
@@ -10,8 +10,6 @@ object \"C_6\" {
mstore(64, 128)
codecopy(0, dataoffset(\"C_6_deployed\"), datasize(\"C_6_deployed\"))
return(0, datasize(\"C_6_deployed\"))
function fun_f_5()
{ }
}
object \"C_6_deployed\" {
code {
@@ -18,11 +18,6 @@ object \"C_6\" {
return(0, datasize(\"C_6_deployed\"))
function fun_f_5() {
}
}
object \"C_6_deployed\" {
code {
@@ -18,35 +18,6 @@ object \"C_10\" {
return(0, datasize(\"C_10_deployed\"))
function allocateMemory(size) -> memPtr {
memPtr := mload(64)
let newFreePtr := add(memPtr, size)
// protect against overflow
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
mstore(64, newFreePtr)
}
function convert_t_stringliteral_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21_to_t_string_memory_ptr() -> converted {
converted := allocateMemory(64)
mstore(converted, 6)
mstore(add(converted, 32), \"abcabc\")
}
function fun_f_9() -> vloc__4_mpos {
let zero_value_for_type_t_string_memory_ptr_1_mpos := zero_value_for_split_t_string_memory_ptr()
vloc__4_mpos := zero_value_for_type_t_string_memory_ptr_1_mpos
vloc__4_mpos := convert_t_stringliteral_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21_to_t_string_memory_ptr()
leave
}
function zero_value_for_split_t_string_memory_ptr() -> ret {
ret := 96
}
}
object \"C_10_deployed\" {
code {
@@ -18,23 +18,6 @@ object \"C_10\" {
return(0, datasize(\"C_10_deployed\"))
function convert_t_stringliteral_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21_to_t_bytes32() -> converted {
converted := 0x6162636162630000000000000000000000000000000000000000000000000000
}
function fun_f_9() -> vloc__4 {
let zero_value_for_type_t_bytes32_1 := zero_value_for_split_t_bytes32()
vloc__4 := zero_value_for_type_t_bytes32_1
vloc__4 := convert_t_stringliteral_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21_to_t_bytes32()
leave
}
function zero_value_for_split_t_bytes32() -> ret {
ret := 0
}
}
object \"C_10_deployed\" {
code {
@@ -18,35 +18,6 @@ object \"C_10\" {
return(0, datasize(\"C_10_deployed\"))
function cleanup_t_rational_1633837924_by_1(value) -> cleaned {
cleaned := value
}
function convert_t_rational_1633837924_by_1_to_t_bytes4(value) -> converted {
converted := shift_left_224(cleanup_t_rational_1633837924_by_1(value))
}
function fun_f_9() -> vloc__4 {
let zero_value_for_type_t_bytes4_1 := zero_value_for_split_t_bytes4()
vloc__4 := zero_value_for_type_t_bytes4_1
let expr_6 := 0x61626364
vloc__4 := convert_t_rational_1633837924_by_1_to_t_bytes4(expr_6)
leave
}
function shift_left_224(value) -> newValue {
newValue :=
shl(224, value)
}
function zero_value_for_split_t_bytes4() -> ret {
ret := 0
}
}
object \"C_10_deployed\" {
code {
@@ -18,39 +18,6 @@ object \"C_10\" {
return(0, datasize(\"C_10_deployed\"))
function allocateMemory(size) -> memPtr {
memPtr := mload(64)
let newFreePtr := add(memPtr, size)
// protect against overflow
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
mstore(64, newFreePtr)
}
function convert_t_stringliteral_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571_to_t_string_memory_ptr() -> converted {
converted := allocateMemory(128)
mstore(converted, 85)
mstore(add(converted, 32), \"abcdabcdcafecafeabcdabcdcafecafe\")
mstore(add(converted, 64), \"ffffzzzzoooo0123456789,.<,>.?:;'\")
mstore(add(converted, 96), \"[{]}|`~!@#$%^&*()-_=+\")
}
function fun_f_9() -> vloc__4_mpos {
let zero_value_for_type_t_string_memory_ptr_1_mpos := zero_value_for_split_t_string_memory_ptr()
vloc__4_mpos := zero_value_for_type_t_string_memory_ptr_1_mpos
vloc__4_mpos := convert_t_stringliteral_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571_to_t_string_memory_ptr()
leave
}
function zero_value_for_split_t_string_memory_ptr() -> ret {
ret := 96
}
}
object \"C_10_deployed\" {
code {
@@ -18,35 +18,6 @@ object \"C_10\" {
return(0, datasize(\"C_10_deployed\"))
function cleanup_t_rational_2864434397_by_1(value) -> cleaned {
cleaned := value
}
function convert_t_rational_2864434397_by_1_to_t_bytes4(value) -> converted {
converted := shift_left_224(cleanup_t_rational_2864434397_by_1(value))
}
function fun_f_9() -> vloc__4 {
let zero_value_for_type_t_bytes4_1 := zero_value_for_split_t_bytes4()
vloc__4 := zero_value_for_type_t_bytes4_1
let expr_6 := 0xaabbccdd
vloc__4 := convert_t_rational_2864434397_by_1_to_t_bytes4(expr_6)
leave
}
function shift_left_224(value) -> newValue {
newValue :=
shl(224, value)
}
function zero_value_for_split_t_bytes4() -> ret {
ret := 0
}
}
object \"C_10_deployed\" {
code {
@@ -0,0 +1,21 @@
contract Base {
function f() public returns (uint256 i) {
return g();
}
function g() internal virtual returns (uint256 i) {
return 1;
}
}
contract Derived is Base {
function g() internal override returns (uint256 i) {
return 2;
}
}
// ====
// compileViaYul: also
// ----
// f() -> 2