[PATCH] D93241: [AArch64InstPrinter] Change printADRPLabel to print the target address in hexadecimal form

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 15 02:55:14 PST 2020


psmith added inline comments.


================
Comment at: llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp:1391
+    if (PrintBranchImmAsAddress)
+      O << formatHex((Address & -4096) + Offset);
+    else
----------------
jhenderson wrote:
> What's this calculation about?
It looks we are doing more than just change the display the immediate in hex, we are calculating the destination of the instruction. Personally I think that's fine as the destination is almost always more useful than the raw immediate. It also matches GNU objdump in this area.

ADRP is a bit of strange instruction (https://developer.arm.com/docs/ddi0596/i/base-instructions-alphabetic-order/adrp-form-pc-relative-address-to-4kb-page) . It is scaled PC-relative offset from the 4Kib page address of the ADRP instruction.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93241



More information about the llvm-commits mailing list