mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Split known state from common subexpression eliminator.
This commit is contained in:
parent
fce1a7f82e
commit
8416a6260f
@ -90,7 +90,8 @@ public:
|
|||||||
for (AssemblyItem& item: input)
|
for (AssemblyItem& item: input)
|
||||||
item.setLocation(SourceLocation(1, 3, make_shared<string>("")));
|
item.setLocation(SourceLocation(1, 3, make_shared<string>("")));
|
||||||
|
|
||||||
eth::CommonSubexpressionEliminator cse;
|
eth::KnownState state;
|
||||||
|
eth::CommonSubexpressionEliminator cse(state);
|
||||||
BOOST_REQUIRE(cse.feedItems(input.begin(), input.end()) == input.end());
|
BOOST_REQUIRE(cse.feedItems(input.begin(), input.end()) == input.end());
|
||||||
AssemblyItems output = cse.getOptimizedItems();
|
AssemblyItems output = cse.getOptimizedItems();
|
||||||
|
|
||||||
@ -231,7 +232,8 @@ BOOST_AUTO_TEST_CASE(function_calls)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(cse_intermediate_swap)
|
BOOST_AUTO_TEST_CASE(cse_intermediate_swap)
|
||||||
{
|
{
|
||||||
eth::CommonSubexpressionEliminator cse;
|
eth::KnownState state;
|
||||||
|
eth::CommonSubexpressionEliminator cse(state);
|
||||||
AssemblyItems input{
|
AssemblyItems input{
|
||||||
Instruction::SWAP1, Instruction::POP, Instruction::ADD, u256(0), Instruction::SWAP1,
|
Instruction::SWAP1, Instruction::POP, Instruction::ADD, u256(0), Instruction::SWAP1,
|
||||||
Instruction::SLOAD, Instruction::SWAP1, u256(100), Instruction::EXP, Instruction::SWAP1,
|
Instruction::SLOAD, Instruction::SWAP1, u256(100), Instruction::EXP, Instruction::SWAP1,
|
||||||
|
Loading…
Reference in New Issue
Block a user