Commit Graph

938 Commits

Author SHA1 Message Date
chriseth
dd8f12760b Introduce forEach for yul ast nodes. 2021-11-04 16:14:43 +01:00
chriseth
929ed094ce Register functions earlier. 2021-11-04 13:48:11 +01:00
chriseth
99aa18c4f3 Refactor: Only return output. 2021-11-04 13:42:50 +01:00
Daniel Kirchner
95c973d6c2 Refactoring of optimiser suite and yulopti. 2021-11-03 19:33:01 +01:00
Daniel Kirchner
28ae316556 Named function labels. 2021-11-03 12:42:07 +01:00
Daniel Kirchner
1a0605c594 Update tests. 2021-11-03 12:39:55 +01:00
Daniel Kirchner
4229369180 Compatibility with StackCompressor and StackLimitEvader. 2021-11-03 12:39:55 +01:00
Daniel Kirchner
b2c9b69de2 Enable for IR code generation with stack optimization > homestead. 2021-11-03 12:39:55 +01:00
chriseth
d6c461ed61 Use side effects of user-defined functions in other optimizer steps. 2021-11-02 11:59:01 +01:00
chriseth
7ebf71f315
Merge pull request #12203 from ethereum/fixuseafterfreeside
Fix use-after-free bug.
2021-10-27 16:43:44 +02:00
chriseth
dce13fbb6a Fix use-after-free bug. 2021-10-27 15:49:41 +02:00
chriseth
9f48b7419c Do not use named function labels if function names are not unique. 2021-10-19 18:33:00 +02:00
chriseth
9417d6775f Control flow side-effects for user-defined functions. 2021-10-14 17:46:07 +02:00
Kamil Śliwak
bcfefc79d9 Pass DebugInfoSelection down to the code handling assembly printing 2021-10-11 20:34:48 +02:00
Kamil Śliwak
f7c4ed849d Handle DebugInfoSelection in the code printing Yul and EVM assembly 2021-10-11 20:34:48 +02:00
Kamil Śliwak
2cd1c644b6 Remove unused includes and sort existing includes in a few places 2021-10-11 20:34:48 +02:00
Christian Parpart
3f08b2269a Adds fmtlib as 3rdparty dependency for easier string composition. 2021-10-11 13:35:08 +02:00
Kamil Śliwak
620ec47efb OptimizerSuite: Rewrite runSequence() with support for nested brackets 2021-10-06 19:15:02 +02:00
Kamil Śliwak
2fb8f1be5b OptimiserSuite: Use string_view instead of string for step sequences 2021-10-06 18:48:41 +02:00
Sreekesh V
79d9d5bf0d Change optimizer sequence validations to allow nested brackets 2021-10-06 18:46:53 +02:00
Kamil Śliwak
0745842d46 Use BOOST_PP_OVERLOAD() to allow invoking the assertion macros without a message 2021-10-04 12:05:00 +02:00
Kamil Śliwak
4fe6aa1328 Add default messages to assertion macros 2021-10-04 12:05:00 +02:00
chriseth
1531863835 Split Common.h into Numeric.h. 2021-09-23 15:27:29 +02:00
chriseth
c8e6ef9657
Merge pull request #12004 from ethereum/disambiguateBytesRequired
Disambiguate bytesRequired
2021-09-23 15:25:44 +02:00
Kamil Śliwak
fc7e8c56dc Fill out originLocation with nativeLocation when importing Yul AST 2021-09-22 13:17:18 +02:00
Kamil Śliwak
d23754eafd AsmParser: Don't use locationOverride as current location when location from comments is selected 2021-09-22 13:11:39 +02:00
Kamil Śliwak
ce4420f857 Separate DebugData fields for Solidity and Yul source locations 2021-09-22 13:11:39 +02:00
Kamil Śliwak
9c1d40debf AsmParser: Replace m_debugDataOverride with separate variables for location and AST ID 2021-09-22 13:11:39 +02:00
chriseth
50ce1f5ddd Disambiguate bytesRequired 2021-09-22 11:22:07 +02:00
chriseth
e6f0fe8ae3 Use source id in yul to evm code transform. 2021-09-22 11:11:51 +02:00
Kamil Śliwak
a9b5835e5d AsmPrinter: Don't include whitespace after @src if there's no code snippet 2021-09-17 21:46:12 +02:00
chriseth
a72f4f3993 Print AST ID. 2021-09-16 17:19:17 +02:00
chriseth
dafa6f552b Rename formatting function. 2021-09-16 17:19:17 +02:00
chriseth
05d20446bb Parse @ast-id annotation. 2021-09-16 17:18:48 +02:00
chriseth
42739b73b1 Extend debug info. 2021-09-16 17:18:48 +02:00
chriseth
280ff8cbd4 Use iterateReplacing in StatementRemover. 2021-09-16 15:34:48 +02:00
chriseth
d708612e27 Refactor source comment parsing. 2021-09-16 12:22:27 +02:00
chriseth
a66e6f08c0
Merge pull request #11951 from ethereum/scopeFillerNullptr
Use locationOf helper instead of accessing debugData directly.
2021-09-14 15:43:01 +02:00
chriseth
f14ff233fc
Merge pull request #11922 from ethereum/newCodeTransformSourceLocations
Better source locations in Yul ControlFlowGraph and OptimizedEVMCodeTransform.
2021-09-14 14:32:39 +02:00
chriseth
a35608aa8c
Merge pull request #11797 from ethereum/optimizedEVMCodeTransform
Optimized EVM Code Transform. (New Code Transform Step 3)
2021-09-14 14:29:54 +02:00
Daniel Kirchner
854b8b65b5 Better source locations in Yul ControlFlowGraph and OptimizedEVMCodeTransform. 2021-09-14 13:43:16 +02:00
Daniel Kirchner
75c3286311 Optimized EVM Code Transform. 2021-09-14 13:37:04 +02:00
Kamil Śliwak
14639efc5d Print code snippets next to source locations in IR output 2021-09-14 12:09:59 +02:00
Kamil Śliwak
d78522b08b AsmParser: Accept optional code snippets after the @src tags 2021-09-14 12:09:59 +02:00
Kamil Śliwak
37f681c430 Deduplicate code for printing source locations 2021-09-14 11:46:57 +02:00
Daniel Kirchner
7abc55d89a Use locationOf helper instead of accessing debugData directly. 2021-09-14 10:04:09 +02:00
Kamil Śliwak
fbdfc6bb7a AsmParser: Require whitespace before tags in location comments 2021-09-09 18:27:29 +02:00
Kamil Śliwak
14396c207c AsmParser: Generalize location comment parsing to make it easier to add support for more tags 2021-09-09 17:12:59 +02:00
Kamil Śliwak
aa156ab6c7 Parser::fetchSourceLocationFromComment(): Some general cleanup (renaming, wrapping, etc.) 2021-09-09 17:12:59 +02:00
Kamil Śliwak
e3a5f923eb AsmParser: Refactor the @src regex 2021-09-09 17:12:58 +02:00
Daniel Kirchner
c499f27a63 Change RematCandidateSelector to not depend on variable name sorting. 2021-09-08 15:41:40 +02:00
Daniel Kirchner
d512f7a4fd
Merge pull request #11890 from ethereum/stackLayoutGeneratorReportTooDeep
Report stack too deep and conditional stack compression in StackLayoutGenerator.
2021-09-08 10:28:30 +02:00
Daniel Kirchner
a683ea7646 Remove the expression callback from the code generator functions of Yul builtins. 2021-09-06 17:07:53 +02:00
chriseth
be95a8172b
Merge pull request #11891 from ethereum/guidedRematerializer
Allow the Rematerializer to be restricted to an exact set of variables.
2021-09-06 16:22:14 +02:00
hrkrshnn
2cdd3b2081 Resolving Keccak-256: check if arguments are identifiers early.
Previously, the check on whether the optimization was useful gas wise was done before checking if
the keccak256 opcode had identifier as arguments. Since the gas meter crashes when encountering
certain Yul opcodes (create, dataoffset, etc.), this optimizer step crashed.
2021-09-06 13:48:07 +02:00
Daniel Kirchner
e022ba1bfb Report stack too deep and conditionally aggressively compress stack in StackLayoutGenerator. 2021-09-06 09:08:04 +02:00
Daniel Kirchner
646421fee1 Allow the Rematerializer to be restricted to an exact set of variables. 2021-09-03 15:29:51 +02:00
Daniel Kirchner
d384664dcb
Merge pull request #11615 from ethereum/yulStackLayoutGenerator
Yul Stack Layout Generator (New Code Transform Step 2)
2021-09-03 13:13:18 +02:00
chriseth
7f137d352a
Merge pull request #11869 from ethereum/remodelUseSrc
Allow and require use-src to be repeated for each object.
2021-09-02 18:34:07 +02:00
Daniel Kirchner
f881409ea4 Stack layout generator for new code generation. 2021-09-02 17:47:19 +02:00
chriseth
5caa15879b Allow and require use-src to be repeated for each object. 2021-09-02 11:29:42 +02:00
Daniel Kirchner
f4effe966e
Merge pull request #11824 from ethereum/yulControlFlowGraphRecursiveCalls
Mark recursive calls in yul control flow graph.
2021-09-01 15:18:04 +02:00
benldrmn
58e4cc62e0 Increase use of C++ constexpr constant expressions in code base as described in issue #7720 2021-08-31 15:03:59 +02:00
Daniel Kirchner
c82f9b9fab Mark recursive calls in yul control flow graph. 2021-08-19 16:54:43 +02:00
chriseth
8926274000 Fix recursion protection. 2021-08-19 12:51:54 +02:00
chriseth
4b038e3f02 Extend knowledge base. 2021-08-18 12:42:46 +02:00
Daniel Kirchner
f609288cba Add missing header. 2021-08-17 16:04:38 +02:00
chriseth
3622b30a1d Refactor RedundantAssignEliminator. 2021-08-13 14:25:14 +02:00
chriseth
90c4623460 Some more base fees. 2021-08-12 16:37:21 +02:00
chriseth
a4c94a1b5b Fixed inline assembly external identifier access. 2021-08-11 18:18:29 +02:00
hrkrshnn
7f1a2be0fe Allow basefee as Yul identifier for EVMVersion < london
This was done to prevent basefee from being a breaking change. This change will be removed in 0.9.0.

TODO revert this commit in breaking.
2021-08-11 10:46:08 +02:00
hrkrshnn
95091f6b58 Implemented block.basefee in Solidilty and basefee() in Yul.
Also added basefee to Yul grammar.
2021-08-09 16:18:08 +02:00
chriseth
467cbf92bc Only provide code generator to CodeTransform. 2021-08-04 18:38:10 +02:00
chriseth
ae519c1278
Merge pull request #11658 from ethereum/removeScannerFromCompilerStack
Remove scanner from compiler stack
2021-08-03 17:47:39 +02:00
chriseth
d7a40622e4
Merge pull request #11729 from ethereum/build-speedups
header file cleanups
2021-08-03 16:44:54 +02:00
Christian Parpart
af18b8afc2 Eliminate some unnecessary header inclusions in headers in Scanner.h and SourceReferenceFormatter.h 2021-08-03 15:43:17 +02:00
Christian Parpart
6294aa871a Simplify AsmParser::parse(.) usage 2021-08-03 15:43:17 +02:00
chriseth
ffc5cfd9a5 Remove scanner from compiler stack. 2021-08-03 15:43:17 +02:00
Christian Parpart
81e9225304 Eliminate some unnecessary header inclusions in headers. 2021-08-03 15:43:14 +02:00
Mathias Baumann
2ee6c7be64 Print @src and @use-src locations in AsmPrinter 2021-08-03 15:29:52 +02:00
Christian Parpart
3755210b7b [libyul] ObjectParser: Enables the use of custom source mapping via @use-src. 2021-07-27 16:46:47 +02:00
Daniel Kirchner
f3707f2ab0 Control flow graph for Yul. 2021-07-15 15:24:12 +02:00
Kamil Śliwak
6753c8f624 Rename escapeAndQuoteYulString() back to escapeAndQuoteString() 2021-07-14 21:29:01 +02:00
chriseth
01dc77e5a2 Properly assign source names for AST import. 2021-07-14 15:12:10 +02:00
chriseth
f75b55071e Remove CharStream from SourceLocation. 2021-07-14 15:12:07 +02:00
chriseth
e5ab68ed71 Use unknown file for invalid source index. 2021-07-12 17:35:49 +02:00
Christian Parpart
f129a3498c Use shared DebugData for when using source locations from comments. 2021-07-09 11:50:50 +02:00
Christian Parpart
5e4868d5d6 Adapted tests due to more precise Yul source locations.
Also added support for -1 source index, referencing original scanner's source location.
2021-07-09 11:50:48 +02:00
Christian Parpart
132fa46faa Yul: Adds parsing @src comment in AsmParser to customize the AST's sourcer locations. 2021-07-09 11:48:00 +02:00
Christian Parpart
43cde4e175 Adds missing include header (for DebugData). 2021-07-09 11:46:59 +02:00
Christian Parpart
f9f32c910d Fix source location for `if` statements. 2021-07-07 17:37:01 +02:00
chriseth
8d5e82b406 Fix source location of builtin function calls. 2021-07-06 16:54:29 +02:00
Alex Beregszaszi
847e30e6ff Optimise libevmasm in yul 2021-07-05 13:46:53 +02:00
Daniel Kirchner
c341445f8e Maintain disambiguation when generating new functions in StackToMemoryMover. 2021-06-28 18:11:57 +02:00
Daniel Kirchner
bc288aacf5 Have the stack optimization in the code transform only reuse slots that are reachable and fix argument slot reuse on functions without return variables. 2021-06-28 18:11:57 +02:00
Daniel Kirchner
dfce7b667d Move function arguments and return values. 2021-06-28 18:11:57 +02:00
Daniel Kirchner
cc0169ad68 Function definition collector. 2021-06-28 18:11:57 +02:00
Kamil Śliwak
19fada966f Do not use \b, \v and \f escapes in string literals in generated Yul code 2021-06-28 14:13:47 +02:00
chriseth
0df8a38e55 Support metadata via IR. 2021-06-21 18:20:31 +02:00
Alex Beregszaszi
6ae09ee0cc Add AssemblyStack.assembleEVM which returns both deploy and runtime assemblies 2021-06-17 15:35:59 +02:00