Fix incorrect behavior between $pseudo_op and $import#213
Closed
charlie-rivos wants to merge 1 commit intoriscv:masterfrom
Closed
Fix incorrect behavior between $pseudo_op and $import#213charlie-rivos wants to merge 1 commit intoriscv:masterfrom
charlie-rivos wants to merge 1 commit intoriscv:masterfrom
Conversation
The passes for parsing $pseudo_op and $import are currently swapped, resulting in incorrect behavior. Pseudo ops are defined as: "The pseudo op is only added to the overall dictionary is the dependent instruction is not present in the dictionary, else its skipped." However, this is not the case if the dependent instruction has been imported. Take the following examples: rv_pseudo ``` $pseudo_op rv_op::op pseudo rd rs1 rs2 bs 29..25=0b11000 14..12=0 6..0=0x33 ``` rv_import ``` $import rv_op::op ``` rv_op ``` op rd rs1 rs2 bs 29..25=0b11000 14..12=0 6..0=0x33 ``` If we parse rv_pseudo and rv_op, the output is the single instruction "op". This is expected, as op is the "dependent instruction" and thus the pseudo is not included. If we instead parse rv_pseudo and rv_import, the output is instead "op" and "pseudo". However, he output in this case should be the same as if the instruction was directly included. The "pseudo" instruction should not be included. This change simply swaps the pseudo_ops and import passes, causing the behavior in both of these cases to be consistent with each other. Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #213 +/- ##
=======================================
Coverage 92.83% 92.83%
=======================================
Files 3 3
Lines 642 642
=======================================
Hits 596 596
Misses 46 46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
|
This one has gone stale (sorry) but was woken up by the codecov bot for some reason. I'm closing it, but feel free to reopen it as needed. |
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.
The passes for parsing $pseudo_op and $import are currently swapped, resulting in incorrect behavior. Pseudo ops are defined as:
"The pseudo op is only added to the overall dictionary is the dependent instruction is not present in the dictionary, else its skipped."
However, this is not the case if the dependent instruction has been imported.
Take the following examples:
rv_pseudo
rv_import
rv_op
If we parse rv_pseudo and rv_op, the output is the single instruction "op". This is expected, as op is the "dependent instruction" and thus the pseudo is not included.
If we instead parse rv_pseudo and rv_import, the output is instead "op" and "pseudo". However, he output in this case should be the same as if the instruction was directly included. The "pseudo" instruction should not be included.
This change simply swaps the pseudo_ops and import passes, causing the behavior in both of these cases to be consistent with each other.