Fix "call" pseudo instruction that uselessly modified register "t1" #104
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.
The assembler translates
call label
as aauipc
/jalr
pair:It uses register
x6
(t1
) to do so while registerx1
(ra
) is available and must indeed be modified anyway to store the return address. Although the ILP32 Application Binary Interface (ABI) and other ABIs considerx6
as non-saved, I do not see any reason to enforce an ABI in RARS more than strictly needed. So, I suggest to translatecall label
as:Note: one could claim that this is still ABI-related because we use
x1
(ra
). But using a register is unavoidable if one wants acall
pseudo-instruction. Choosingx1
makes sense as it is the preferred register for this purpose in ILP32 and alike.Note: another pseudo-instruction (and only one) also silently modifies a non-saved register:
tail label
. As its target register isx0
we cannot fix it as we did forcall
. My intuition is thattail
shall be removed completely but this breaks backward compatibility. We should maybe add a warning in its brief description?