-
Notifications
You must be signed in to change notification settings - Fork 16
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
[EVM] [DO NOT MERGE] Add Ethereum stackification #714
Draft
PavelKopyl
wants to merge
7
commits into
main
Choose a base branch
from
ef-stackification
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
PavelKopyl
changed the title
[EVM] Add Ethereum stackification
[EVM] [DO NOT MERGE] Add Ethereum stackification
Oct 9, 2024
✅ With the latest revision this PR passed the C/C++ code formatter. |
PavelKopyl
force-pushed
the
ef-stackification
branch
from
October 9, 2024 18:55
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
PavelKopyl
force-pushed
the
ef-stackification
branch
from
November 16, 2024 09:05
4bedd23
to
ff232c6
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.
PavelKopyl
force-pushed
the
ef-stackification
branch
from
November 16, 2024 09:07
ff232c6
to
5771d35
Compare
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?