Find writeback registers#2960
Conversation
Detection of writebacks was only partially implemented: - MCInst_handleWriteback() was not called, so tied_op_idx was not filled - map_get_op_access() in RISCV_add_cs_detail_0() queried tied_op_idx unnecessarily, because all elements were -1 (initialization value)
Rot127
left a comment
There was a problem hiding this comment.
Please add the instruction which let you find the bug as test.
|
I didn't, i could run a lot of instructions in the hope of finding a discrepancy between manually setting RW access (as it was) and relying on auto-sync. I came across this accidentally, and i thought it's neater and more robust... |
|
@moste00 Can you please take a look. Maybe there was a reason you did it like that? |
|
This is correct, thank you @slate5 ! @Rot127 No, there was no any particular reason except that I just didn't know the writeback function existed, so I wrote a very narrow fix and moved on. I think Slate5 fix is probably better, if nothing else it net-removes code which is always a good thing. I tested it manually on 2 instruction that were fixed up by my narrow function and it worked, producing the same LGTM. |
|
@slate5 @Rot127 Just FYI, the original I just commented it in my So I'm not sure what |
|
LLVM defines what registers are read + written. In the .td files they are in the |
To your defense, I don't think it was dead logic. It did its job properly (detecting writebacks), but it relied on more hard-coded LLVM output (the first op has to be RISCV_OP_INVALID), so I don't know if that would be robust in the future :) |
Your checklist for this pull request
Detailed description
Detection of writebacks was only partially implemented:
This uses auto-sync to find writebacks instead of having a custom function in arch/RISCV/
Test plan
...
Closing issues
...