-
Notifications
You must be signed in to change notification settings - Fork 23
[EVM] [DO NOT MERGE] Add Ethereum stackification #714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
0c4c74e to
1f1e2d8
Compare
akiramenai
requested changes
Oct 24, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please handle dead arguments properly.
Example:
; Function Attrs: nounwind
define i256 @foo(i256 %a1, i256 %a2, i256 %a3) #0 {
%x1 = add i256 %a1, %a1
ret i256 %x1
}
; Function Attrs: nounwind
define i256 @wat(i256 %a1, i256 %a2, i256 %a3) #0 {
%x1 = add i256 %a2, %a2
ret i256 %x1
}
; Function Attrs: nounwind
define i256 @wat2(i256 %a1, i256 %a2, i256 %a3) #0 {
%x1 = add i256 %a2, %a3
ret i256 %x1
}
; Function Attrs: nounwind
define i256 @bar() #0 {
%res = call i256 @foo(i256 1, i256 2, i256 3)
ret i256 %res
}
Codegen:
foo: ; @foo
; %bb.0:
JUMPDEST
DUP1
ADD
SWAP1
JUMP
; -- End function
.globl wat ; -- Begin function wat
wat: ; @wat
; %bb.0:
JUMPDEST
DUP1
ADD
SWAP1
JUMP
; -- End function
.globl wat2 ; -- Begin function wat2
wat2: ; @wat2
; %bb.0:
JUMPDEST
SWAP1
ADD
SWAP1
JUMP
; -- End function
.globl bar ; -- Begin function bar
bar: ; @bar
; %bb.0:
JUMPDEST
PUSH4 @.FUNC_RET0
PUSH1 3
PUSH1 2
PUSH1 1
PUSH4 @foo
JUMP
.FUNC_RET0:
JUMPDEST
SWAP1
JUMP
ff232c6 to
5771d35
Compare
fe7ccda to
5a7e27f
Compare
51a6cbc to
6c9275d
Compare
ae49567 to
026ee9a
Compare
e6d46fb to
fd6194b
Compare
9d3038b to
f9b5db6
Compare
ARGUMENT instructions should always be located at the beginning of a MF`s entry basic block and be ordered in ascending order of their operand values.
Original idea and some code parts were taken from the Ethereum`s compiler (solc) stackification algorithm.
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
This patch adds pseudo jumps, call and ret instructions to fix machine verifier after stackification and to reduce complexity added with bundles. Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
- Removed EVMControlFlowGraph/EVMControlFlowGraphBuilder classes - Functionality that analyzes machine CFG and provides query methods was moved to EVMMachineCFGInfo class - Information about MBB terminators is represented in EVMMBBTerminatorsInfo class - StackSlot, Stack and Operation definitions were moved to EVMStackModel - Replaced almost all the std::map/std::set with llvm counterparts in EVMStackLayoutGenerator
Update assert to reflect support for libraries. Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
f9b5db6 to
0ea80f9
Compare
* Remove TemporarySlot * Refactor createOperation * Remove Output field from Operation
|
|
…erator And remove EVMStackDebug.h and EVMStackDebug.cpp. This patch is a joint work by: Pavel Kopyl <pavelkopyl@gmail.com> Vladimir Radosavljevic <vr@matterlabs.dev> Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
This patch is a joint work by: Pavel Kopyl <pavelkopyl@gmail.com> Vladimir Radosavljevic <vr@matterlabs.dev> Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
|
Add stack depth limit to subtarget, and get it from there. This will allow to extend this for EOF ISA in a future. This patch is a joint work by: Pavel Kopyl <pavelkopyl@gmail.com> Vladimir Radosavljevic <vr@matterlabs.dev> Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
This also includes refactoring of 'Stack too deep' error output. This patch is a joint work by: Pavel Kopyl <pavelkopyl@gmail.com> Vladimir Radosavljevic <vr@matterlabs.dev>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This includes:
Code Review Checklist
Purpose
Ticket Number
Requirements
Implementation
Logic Errors and Bugs
code does not behave as intended?
that could break the code?
Error Handling and Logging
be added or removed?
written in a way that allows for easy
debugging?
Maintainability
Dependencies
Security
Performance
system performance?
performance of the code significantly?
Testing and Testability
that should be tested in addition?
Readability
smaller methods?
different function, method or variable names?
file/folder/package?
restructured to have a more intuitive control
flow?
better?
understandable?
Documentation
Best Practices
Experts' Opinion
expert or a usability expert, should look over
the code before it can be accepted?