All LLVM backends use MCDisassembler as a base class for their
instruction decoders. Use "const MCDisassembler *" for the decoder
instead of "const void *". Remove unnecessary static casts.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Remove unnecessary static casts.
Can you explain which ones are removed? In the AMDGPU backend it looks like they are all still required, to cast from MCDisassembler * to AMDGPUDisassembler *.
No objection to the patch btw.
Right, I removed casts where no further code changes were required. E.g., if the pointer was used to call an AMDGPUDisassembler-specific function, we still need to cast. It's possible I've missed some cases. Please let me know.
I think most of the removed casts are const void *->const MCDisassembler * b/c we use MCDisassembler as parameters explicitly in this patch , which seems reasonable to me. From the logs, I believe FixedLenDecoderEmitter.cpp defined the function prototype first, and then all the targets had to follow it.
Added @grosbach as a reviewer, who defined the interfaces of decodeToMCInst and decodeInstruction in https://reviews.llvm.org/rGecaef49f59bb4e414f95d89b7c6b35eb9adad314 in 2012.
After ten years, I believe we don't need such generic interface now.
LGTM generally.