[PATCH] D76591: [PPCInstPrinter] Change printBranchOperand(calltarget) to print the target address in hexadecimal form

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 24 15:06:51 PDT 2020


MaskRay marked 2 inline comments as done.
MaskRay added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp:438
+      Target &= 0xffffffff;
+    O << formatHex(Target);
+  }
----------------
sfertile wrote:
> MaskRay wrote:
> > sfertile wrote:
> > > Do we have a way to print the hex value without a leading '0x'? If we are making the effort to match binutils objump,  why wouldn't we match exactly for this case?
> > Don't use formatHex then we are done. However, I actually think an explicit 0x is better.
> > 
> > A GNU objdump -d result (x86_64) cannot be re-assembled back. The omission of 0x is one of the reasons.
> I don't feel too strongly either way but I though the tools that are replicating binutils tools are meant to be exact drop-in replacements outside of replicating bugs. If this is one of many things that precludes objdumps output  from being disassembled then we should  prioritize compatibility, otherwise I have no reservations about keeping the leading `0x'.
Sorry, I was mistaken. GNU objdump -d on powerpc actually keeps the leading 0x. So we are actually consistent with GNU objdump.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76591





More information about the llvm-commits mailing list