[PATCH v3 15/21] perf annotate-arm64: Support store instruction tracking
From: Tengda Wu
Date: Wed Jul 01 2026 - 00:02:32 EST
Extend update_insn_state() for arm64 to handle store (STR) instructions.
Unlike load instructions, store operations do not change the data type
of the registers involved. However, arm64 store instructions sometimes
use pre-index or post-index addressing modes (e.g., str x1, [x0, #8]!),
which modify the base register as a side effect of the memory access.
Call adjust_reg_index_state() for store instructions to ensure the
base register's offset is correctly updated in the type state. This
maintains synchronization between the hardware register state and the
instruction tracker's model during sequential memory operations.
Signed-off-by: Tengda Wu <wutengda@xxxxxxxxxxxxxxx>
---
tools/perf/util/annotate-arch/annotate-arm64.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/annotate-arch/annotate-arm64.c b/tools/perf/util/annotate-arch/annotate-arm64.c
index b48545f35620..f283596bb058 100644
--- a/tools/perf/util/annotate-arch/annotate-arm64.c
+++ b/tools/perf/util/annotate-arch/annotate-arm64.c
@@ -430,7 +430,7 @@ static void update_insn_state_arm64(struct type_state *state,
* the destination register itself to prevent incorrect type propagation.
*/
if (has_reg_type(state, dst->reg1) &&
- strncmp(dl->ins.name, "ld", 2)) {
+ strncmp(dl->ins.name, "ld", 2) && strncmp(dl->ins.name, "st", 2)) {
pr_debug_dtp("%s [%x] invalidate reg%d\n",
dl->ins.name, insn_offset, dst->reg1);
invalidate_reg_state(&state->regs[dst->reg1]);
@@ -442,6 +442,16 @@ static void update_insn_state_arm64(struct type_state *state,
update_load_insn_state(state, dl, src, dst);
return;
}
+
+ /* Register to memory transfers */
+ if (!strncmp(dl->ins.name, "st", 2)) {
+ /*
+ * Store instructions do not change the register type,
+ * but the base register must be updated for pre/post-index
+ * modes.
+ */
+ adjust_reg_index_state(state, dst, "str", insn_offset);
+ }
}
#endif
--
2.34.1