Fix 68000 MOVE post increment destination pcode order#9222
Open
EmirX3D wants to merge 1 commit into
Open
Conversation
Author
Contributor
|
oh wow, interesting analysis. I had looked at the sleigh code looking for an obvious problem, but it makes sense that it would be a bit more subtle. Do you think other opcodes could be similarly affected ? |
Author
@fenugrec Possibly. I haven't taken a look at them though, I was focused on your issue. |
5700770 to
0cc909d
Compare
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.
This fixes a decompiler issue with 68000 move.* ..., (An)+ instructions where changing the destination pointer type could make the generated C look like a pre increment happened before the store. The underlying pcode was technically SSA correct, though the generic destination effective address handling ended up emitting the post increment before the write through the saved address. During type recovery, the decompiler could then merge the original and incremented pointer values together, leading to confusing output for typed byte pointers. To fix this, dedicated post increment destination operands were added for move.b, move.w, and move.l. These now emit the store first and only update the address register afterward, matching the expected instruction semantics more clearly in decompiled output. The special byte sized SP post increment behaviour is unchanged and still advances by 2
To validate, I compiled 68020.slaspec, 68030.slaspec, 68040.slaspec, and coldfire.slaspec
Related discussions/issues: