[PATCH] D76580: [X86InstPrinter] Change printPCRelImm to print the target address in hexadecimal form

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 24 09:39:21 PDT 2020


MaskRay added inline comments.


================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp:302-303
+    uint64_t Target = Address + Op.getImm();
+    if (MAI.getCodePointerSize() == 4)
+      Target &= 0xffffffff;
+    O << formatHex(Target);
----------------
jhenderson wrote:
> This might be a dumb question, since I'm not familiar with the disassembly stuff, but why is this here?
x86-32's address space is 32-bit. `call .-4` at address 0 shall be displayed as 0xfffffffc, instead of 0xfffffffffffffffc. There are several tests relying on the behavior.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76580





More information about the llvm-commits mailing list