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
[DO NOT MERGE] Implement mov and movptr pseudoinstructions #403
Open
sayon
wants to merge
625
commits into
main
Choose a base branch
from
iz-experiment-mov
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
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
When converting bytes to cell cache the result of the conversion and reuse it instead of recalculating.
Replace lower switch pass with stich loweing in DAG builder The patch turns off lowerswitch pass, and change Selection DAG Builder so that it creates a tree with ult rather than slt branching for a switch.
Propagate constants to stack address In case a fuction access to an external frame outside of the entry basic block, the DAG is constructed so that the address is computed in entry and copied to a register. SelectAddress therefore can't infer that a constant could be involved in the computation and use Reg + Imm addressing mode. The patch introduces a pass that replicates the logic of propagation constants to a memory accessing operation. If the inital address is computed by expression 1, and none of it's patrital results is used more than once, the pass attempts to find expression 2, so that expression 1 is equal to expression 2 + constant. Then it replaces a memory access by expression 1 to a memory access by expression 2 + constant.
* Add the MUSL build script * Install ninja * Install the Rust target for MUSL * Install musl-gcc * Fix the LLVM output path * Fix the LLVM unit test path and target * Re-enable unit tests building * Remove the unit tests CI step Co-authored-by: Alex Z <a.zarudnyy@matterlabs.dev>
* Test only opt-modes for nightly * Cleanup the build scripts Co-authored-by: Alex Z <a.zarudnyy@matterlabs.dev>
Selection DAG Builder used to build jump tables for minsize attributed function when switch cases are dense. SyncVM doesn't allow jump tables yet.
SyncVMCodegenPrepare pass now eliminates such calls.
Despite the command-line option, LLVM unconditioally enables lookup table building for switch. These tables are global constants and thus every record there is 4 times as bigger as a single instruction.
Expand memcpy using gep instead of pointer arithrmetic to access elements, and move the logic to SyncVM target instead of making local changes in LowerMemIntrinsics. The patch also corrects the data layout for SyncVM.
Update runtime library to return iN as(3)* when appropriate.
The compiler put all the globals into `.data` section regardless of the initializer. Linker is to map `.data` to the beggining of the stack.
* adding ptr.add and ptr.pack * adding corresponding intrinsics * GEP on AS 3 pointers will be converted to intrinsics before lowering Co-authored with Dmitry Borisenkov <dmitriy.borisenkov89@gmail.com>
SyncVM threats generic address space pointers as a special data type. Only VM can produce them, and there are 3 operations that allowed: * ptr.add pointer, i256 * ptr.sub pointer, i256 * ptr.pack pointer, i256 Any other operation on a pointer would implicitly convert it to i256. The patch supports fat pointers in backen without introducing a EVT for them: * Select load/store iN as(3)** as ptr.add * Identify via the def-chain that pointer value is to be spilled, and generate ptr.add instead of add for the spill * Identify that pointer is to be reloaded and use ptr.add for that * Identify that pointer is to be moved and use ptr.add
* Make a copy of each far call runtime function and make each copy to take i8 addrspace(3)* as the first argument. * Handle COPY from a function parameter to a register when the parameter is a generic pointer.
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>
This is mainly used to test this pass by running it with opt. Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
…s issue Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
…umulativeByteOffset Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Set that offset is signed to fix calculation for large BitWidth. Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Signed-off-by: Pavel Kopyl <pavelkopyl@gmail.com>
sayon
force-pushed
the
iz-experiment-mov
branch
2 times, most recently
from
February 26, 2024 09:17
c805ce0
to
1e46ec0
Compare
Benchmark results:
|
sayon
force-pushed
the
iz-experiment-mov
branch
2 times, most recently
from
February 27, 2024 17:02
e6a2d16
to
57c35de
Compare
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
Signed-off-by: Vladimir Radosavljevic <vr@matterlabs.dev>
sayon
force-pushed
the
iz-experiment-mov
branch
from
February 28, 2024 12:57
57c35de
to
f03d4ea
Compare
sayon
force-pushed
the
iz-experiment-mov
branch
from
February 28, 2024 15:22
f03d4ea
to
64b0157
Compare
sayon
force-pushed
the
iz-experiment-mov
branch
from
February 28, 2024 16:04
64b0157
to
6aa3ab6
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.
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?