[PATCH v2 10/16] perf annotate-arm64: Support store instruction tracking

From: Tengda Wu

Date: Fri Apr 03 2026 - 05:49:15 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 | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/tools/perf/util/annotate-arch/annotate-arm64.c b/tools/perf/util/annotate-arch/annotate-arm64.c
index cac2bf0021c9..28647a778802 100644
--- a/tools/perf/util/annotate-arch/annotate-arm64.c
+++ b/tools/perf/util/annotate-arch/annotate-arm64.c
@@ -335,6 +335,16 @@ static void update_insn_state_arm64(struct type_state *state,
}
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, dreg, dst, "str", insn_offset);
+ }
}
#endif

--
2.34.1