[PATCH] D143345: [RFC][RISCV] Don't disassemble `addi`s with relocations as `mv`s

Luís Marques via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 15:45:57 PST 2023


luismarques added a comment.

In D143345#4129968 <https://reviews.llvm.org/D143345#4129968>, @craig.topper wrote:

> I think the reasoning makes sense to me. Do you also use `-r` when you disassemble object files? Or do you anticipate just knowing that an addi with 0 is some unrelocated address?

I often use the `-r` option to determine the symbol addresses being computed (in non-trivial disassemblies) or as a sanity check to verify that some immediate isn't actually zero. Sometimes I don't bother because it makes the output noisy or I just forget.

I'm not sure I understand your second question, though (it's late here...). I assume it's more than just a curiosity and it has some relation to this patch but it's not clear to me what the implication is. Yes, without `-r` the disassemblies can be a bit puzzling at times, and you need to anticipate that some 0 immediates are misleading, and they won't actually be zero in the final binary. You have the same problem with `mv`s, just exacerbated because then you have to think that they aren't even true `mv` instructions at all. Is your point that when you do use `-r` it should be clear that the `mv`s aren't actually moves and the `addi`s aren't actually zero? Apologies if I'm being dense.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143345/new/

https://reviews.llvm.org/D143345



More information about the llvm-commits mailing list