Fix cmp register access on aarch64 #1655
Merged
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 pr fixes #1653
I noticed that the problem relies on the fact that
cmp x0, x1is in fact alias forsubs xzr, x0, x1.Now, when the method
printAliasInstructioncallsprintOperand, it passes the correct operand number (skips the first register xzr, and asks for x0); howeverprintOperandthen usesMI->ac_idxto address which reg access information to return back - and this is wrong, as MI->ac_idx is initialized with 0 and it should use the properOpNumargument that is passed toprintOperandIMHO
MI->ac_idxis an artifact from arm32 that got carried over to the arm64 implementation, and as we don't need to deal with multiple register edge cases likepop {r1,r2,r3,r4...}I don't see the need forMI->ac_idxat all for arch64, but I am probably wrong (this is my first contribution to the project), let me know what do you think @aquynh .This pr will fix also register access for other instructions that are actually aliases and hide a register like
tst x0, x1.