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

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 24 02:39:51 PDT 2020


jhenderson added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp:421
     return printOperand(MI, OpNo, O);
-
-  // Branches can take an immediate operand. This is used by the branch
-  // selection pass to print, for example `.+8` (for ELF) or `$+8` (for AIX) to
-  // express an eight byte displacement from the program counter.
-  if (!TT.isOSAIX())
-    O << ".";
-  else
-    O << "$";
-
   int32_t Imm = SignExtend32<32>((unsigned)MI->getOperand(OpNo).getImm() << 2);
+  if (RelativeForm) {
----------------
Not being a PPC expert, what is the `<< 2` all about?


================
Comment at: llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.h:68
+  void printBranchOperand(const MCInst *MI, uint64_t Address, unsigned OpNo,
+    raw_ostream &O, bool RelativeForm = false);
+  void printBranchOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) {
----------------
Don't miss this clang-format request!


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