riscv64: Split clobber save/restore SP adjustment for compressed instructions#13797
Open
rajeshgangam wants to merge 1 commit into
Open
riscv64: Split clobber save/restore SP adjustment for compressed instructions#13797rajeshgangam wants to merge 1 commit into
rajeshgangam wants to merge 1 commit into
Conversation
…ructions When the Zca extension is enabled, split the SP adjustment in function prologues/epilogues so callee-saved stores use small SP-relative offsets that fit in c.sdsp's 504-byte encoding range. This allows all callee-save stores/loads to compress from 4-byte sd/ld to 2-byte c.sdsp/c.ldsp. Without Zca, the original combined SP decrement is preserved to avoid adding an extra instruction with no compression benefit. Also adds isa_flags parameter to the ABIMachineSpec gen_clobber_save and gen_clobber_restore trait methods so implementations can make ISA-specific decisions. Fixes bytecodealliance#7190.
d447f39 to
f3d500e
Compare
Member
|
Hi, can you confirm that you are following our AI policy and have fully reviewed and understood the code here, and are willing to take responsibility for the code in the way that only a human can? Thanks. |
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
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.
Summary
c.sdsp's 504-byte encoding rangesd/ldto 2-bytec.sdsp/c.ldsp, saving ~28 bytes per function with 8 callee-savesisa_flagsparameter to theABIMachineSpec::gen_clobber_saveandgen_clobber_restoretrait methods so implementations can make ISA-specific decisionsBefore (main,
has_cenabled, 1KB frame + 8 callee-saves):After (with Zca):
Fixes #7190.
Test plan
c-clobber-save-restore.cliftest with 3 cases: 100KB frame, 512B boundary, max callee-saves