How to apply opcodes optimization directly on opcodes? Solidity compiler

171 views Asked by At

According to documentation, one of the steps of solidity compilation is the optimization on opcodes level, with the following set of rules.
How can I apply optimization directly on opcodes?

Details
Let's say I compiled a contract with the --opcodes option and opcodes optimization disabled:

solc --opcodes --evm-version shanghai example_contract.sol

Resulting in opcodes, like this:

PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0xF JUMPI PUSH0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 ...

I want to optimize it on the opcodes level for 200 runs, to get the result, same as the output of:

solc --opcodes --evm-version shanghai --optimize --optimizate-runs 200 example_contract.sol

The goal is the augmentation of the dataset with opcodes representation of smart contracts with different optimization parameters for non-verified smart contracts, so I don't have access to the source code.

0

There are 0 answers