[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
Thu Mar 26 02:07:52 PDT 2020
jhenderson accepted this revision.
jhenderson added a comment.
LGTM too.
================
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) {
----------------
nemanjai wrote:
> jhenderson wrote:
> > Not being a PPC expert, what is the `<< 2` all about?
> The branches on PPC must branch to word-aligned (4-byte word) addresses. So the branch address is the encoded value shifted two bits to the left (plus PC for the PC-relative ones).
Thanks!
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