[llvm] [feature][riscv] handle target address calculation in llvm-objdump disassembly for riscv (PR #144620)

Arjun Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 4 00:18:25 PDT 2025


================
@@ -177,17 +177,12 @@ class LLVM_ABI MCInstrAnalysis {
     return false;
   }
 
-  /// Given a branch instruction try to get the address the branch
-  /// targets. Return true on success, and the address in Target.
-  virtual bool evaluateBranch(const MCInst &Inst, uint64_t Addr, uint64_t Size,
-                              uint64_t &Target,
-                              const MCSubtargetInfo *STI = nullptr) const;
-
-  /// Given an instruction that accesses a memory address, try to compute
-  /// the target address. Return true on success, and the address in \p Target.
-  virtual bool evaluateInstruction(const MCInst &Inst, uint64_t Addr,
-                                   uint64_t Size, uint64_t &Target,
-                                   const MCSubtargetInfo &STI) const;
+  /// Given an instruction that accesses memory, computes a memory address, or
+  // branches to another address, try to get the address these instructions
+  // target. Return true on success, and the address in \p Target.
----------------
arjunUpatel wrote:

Will "computes a memory address" not be relevant here because (lui|auipc|c.lui) + (addi|c.addi|addiw|c.addiw) sequence will not branch or access memory until the register that was written to is actually used to do just that. Currently, we print the target address when the add instruction is seen, not when the value written is actually used.

https://github.com/llvm/llvm-project/pull/144620


More information about the llvm-commits mailing list