Name simplifier.

This commit is contained in:
chriseth
2020-09-10 16:23:29 +02:00
parent 95a284e526
commit 6101bdf7e2
16 changed files with 424 additions and 30 deletions
@@ -1081,13 +1081,13 @@
// let _2 := mload(0)
// if slt(sub(_1, _2), 64) { revert(0, 0) }
// sstore(0, and(calldataload(_2), sub(shl(160, 1), 1)))
// let x0, x1, x2, x3, x4 := abi_decode_tuple_t_addresst_uint256t_bytes_calldata_ptrt_enum$_Operation_$1949(mload(7), mload(8))
// let x0, x1, x2, x3, x4 := abi_decode_addresst_uint256t_bytes_calldatat_enum$_Operation(mload(7), mload(8))
// sstore(x1, x0)
// sstore(x3, x2)
// sstore(1, x4)
// pop(abi_encode_tuple_t_bytes32_t_address_t_uint256_t_bytes32_t_enum$_Operation_$1949_t_uint256_t_uint256_t_uint256_t_address_t_address_t_uint256__to_t_bytes32_t_address_t_uint256_t_bytes32_t_uint8_t_uint256_t_uint256_t_uint256_t_address_t_address_t_uint256_(mload(30), mload(31), mload(32), mload(33), mload(34), mload(35), mload(36), mload(37), mload(38), mload(39), mload(40), mload(41)))
// pop(abi_encode_bytes32_t_address_t_uint256_t_bytes32_t_enum$_Operation_t_uint256_t_uint256_t_uint256_t_address_t_address_t_uint(mload(30), mload(31), mload(32), mload(33), mload(34), mload(35), mload(36), mload(37), mload(38), mload(39), mload(40), mload(41)))
// }
// function abi_decode_tuple_t_addresst_uint256t_bytes_calldata_ptrt_enum$_Operation_$1949(headStart, dataEnd) -> value0, value1, value2, value3, value4
// function abi_decode_addresst_uint256t_bytes_calldatat_enum$_Operation(headStart, dataEnd) -> value0, value1, value2, value3, value4
// {
// if slt(sub(dataEnd, headStart), 128) { revert(value4, value4) }
// value0 := and(calldataload(headStart), sub(shl(160, 1), 1))
@@ -1106,7 +1106,7 @@
// if iszero(lt(_3, 3)) { revert(value4, value4) }
// value4 := _3
// }
// function abi_encode_tuple_t_bytes32_t_address_t_uint256_t_bytes32_t_enum$_Operation_$1949_t_uint256_t_uint256_t_uint256_t_address_t_address_t_uint256__to_t_bytes32_t_address_t_uint256_t_bytes32_t_uint8_t_uint256_t_uint256_t_uint256_t_address_t_address_t_uint256_(headStart, value10, value9, value8, value7, value6, value5, value4, value3, value2, value1, value0) -> tail
// function abi_encode_bytes32_t_address_t_uint256_t_bytes32_t_enum$_Operation_t_uint256_t_uint256_t_uint256_t_address_t_address_t_uint(headStart, value10, value9, value8, value7, value6, value5, value4, value3, value2, value1, value0) -> tail
// {
// tail := add(headStart, 352)
// mstore(headStart, value0)
@@ -473,7 +473,7 @@
// let i := _1
// for { } lt(i, length) { i := add(i, 1) }
// {
// abi_encode_t_array$_t_contract$_C_$55_$3_memory_to_t_array$_t_address_$3_memory_ptr(mload(srcPtr), pos)
// abi_encode_t_array$_C_memory(mload(srcPtr), pos)
// srcPtr := add(srcPtr, 0x20)
// pos := add(pos, 0x60)
// }
@@ -483,15 +483,15 @@
// let offset := calldataload(add(_4, 64))
// let _5 := 0xffffffffffffffff
// if gt(offset, _5) { revert(_1, _1) }
// let value2 := abi_decode_t_array$_t_uint256_$dyn_memory_ptr(add(_4, offset), _3)
// let value2 := abi_decode_t_array$_t_uint256_$dyn(add(_4, offset), _3)
// let offset_1 := calldataload(add(_4, 0x60))
// if gt(offset_1, _5) { revert(_1, _1) }
// let value3 := abi_decode_t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr(add(_4, offset_1), _3)
// let value3 := abi_decode_t_array$_t_array$_t_uint256_memory_$dyn(add(_4, offset_1), _3)
// sstore(calldataload(_4), calldataload(add(_4, 0x20)))
// sstore(value2, value3)
// sstore(_1, pos)
// }
// function abi_decode_t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr(offset, end) -> array
// function abi_decode_t_array$_t_array$_t_uint256_memory_$dyn(offset, end) -> array
// {
// let _1 := 0x1f
// if iszero(slt(add(offset, _1), end)) { revert(array, array) }
@@ -509,7 +509,7 @@
// {
// if iszero(slt(add(src, _1), end)) { revert(0, 0) }
// let _4 := 0x2
// let dst_1 := allocateMemory(array_allocation_size_t_array$_t_uint256_$2_memory(_4))
// let dst_1 := allocateMemory(array_allocation_size_t_array$_t_uint256_memory(_4))
// let dst_2 := dst_1
// let src_1 := src
// let _5 := add(src, _3)
@@ -526,7 +526,7 @@
// src := _5
// }
// }
// function abi_decode_t_array$_t_uint256_$dyn_memory_ptr(offset, end) -> array
// function abi_decode_t_array$_t_uint256_$dyn(offset, end) -> array
// {
// if iszero(slt(add(offset, 0x1f), end)) { revert(array, array) }
// let length := calldataload(offset)
@@ -545,7 +545,7 @@
// src := add(src, _1)
// }
// }
// function abi_encode_t_array$_t_contract$_C_$55_$3_memory_to_t_array$_t_address_$3_memory_ptr(value, pos)
// function abi_encode_t_array$_C_memory(value, pos)
// {
// let srcPtr := value
// let i := 0
@@ -569,7 +569,7 @@
// if gt(length, 0xffffffffffffffff) { revert(size, size) }
// size := add(mul(length, 0x20), 0x20)
// }
// function array_allocation_size_t_array$_t_uint256_$2_memory(length) -> size
// function array_allocation_size_t_array$_t_uint256_memory(length) -> size
// {
// if gt(length, 0xffffffffffffffff) { revert(size, size) }
// size := mul(length, 0x20)
@@ -0,0 +1,34 @@
{
// This function name can be shortened, the other cannot.
function nonmstore_(x) {
nonmstore_(x)
sstore(10, calldataload(2))
}
function mstore_(x) -> y {
let t3_3_ := mstore_(x)
y := 8
sstore(y, calldataload(y))
}
let t2_ := mstore_(7)
nonmstore_(70)
}
// ----
// step: fullSuite
//
// {
// {
// pop(mstore_(7))
// nonmstore(70)
// }
// function nonmstore(x)
// {
// nonmstore(x)
// sstore(10, calldataload(2))
// }
// function mstore_(x) -> y
// {
// pop(mstore_(x))
// y := 8
// sstore(y, calldataload(y))
// }
// }
@@ -36,16 +36,16 @@
//
// {
// {
// let a, b := abi_decode_t_bytes_calldata_ptr(mload(0), mload(1))
// let a_1, b_1 := abi_decode_t_bytes_calldata_ptr(a, b)
// let a_2, b_2 := abi_decode_t_bytes_calldata_ptr(a_1, b_1)
// let a_3, b_3 := abi_decode_t_bytes_calldata_ptr(a_2, b_2)
// let a_4, b_4 := abi_decode_t_bytes_calldata_ptr(a_3, b_3)
// let a_5, b_5 := abi_decode_t_bytes_calldata_ptr(a_4, b_4)
// let a_6, b_6 := abi_decode_t_bytes_calldata_ptr(a_5, b_5)
// let a, b := abi_decode_t_bytes_calldata(mload(0), mload(1))
// let a_1, b_1 := abi_decode_t_bytes_calldata(a, b)
// let a_2, b_2 := abi_decode_t_bytes_calldata(a_1, b_1)
// let a_3, b_3 := abi_decode_t_bytes_calldata(a_2, b_2)
// let a_4, b_4 := abi_decode_t_bytes_calldata(a_3, b_3)
// let a_5, b_5 := abi_decode_t_bytes_calldata(a_4, b_4)
// let a_6, b_6 := abi_decode_t_bytes_calldata(a_5, b_5)
// mstore(a_6, b_6)
// }
// function abi_decode_t_bytes_calldata_ptr(offset, end) -> arrayPos, length
// function abi_decode_t_bytes_calldata(offset, end) -> arrayPos, length
// {
// if iszero(slt(add(offset, 0x1f), end)) { revert(arrayPos, arrayPos) }
// length := calldataload(offset)