[llvm] [SPARC] Print target address when disassembling branches and calls (PR #140340)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat May 17 09:09:45 PDT 2025
================
@@ -263,3 +263,23 @@ void SparcInstPrinter::printPrefetchTag(const MCInst *MI, int opNum,
else
O << Imm;
}
+
+void SparcInstPrinter::printCTILabel(const MCInst *MI, uint64_t Address,
+ unsigned OpNum, const MCSubtargetInfo &STI,
+ raw_ostream &O) {
+ const MCOperand &Op = MI->getOperand(OpNum);
+
+ // If the label has already been resolved to an immediate offset (say, when
+ // we're running the disassembler), just print the immediate.
+ if (Op.isImm()) {
+ const int64_t Offset = Op.getImm();
+ if (PrintBranchImmAsAddress)
+ O << formatHex(Offset);
+ else
+ O << Offset;
----------------
MaskRay wrote:
In the isImm case when PrintBranchImmAsAddress is false, print `.+imm` or `.-imm` like PowerPC.
https://github.com/llvm/llvm-project/pull/140340
More information about the llvm-commits
mailing list