aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
authorNamhyung Kim <[email protected]>2024-03-29 21:58:09 +0000
committerArnaldo Carvalho de Melo <[email protected]>2024-04-03 14:48:57 +0000
commit10adbf777622e22323abbf9f7861c26deb373199 (patch)
tree76841edbc2e79300027c739dd276984be55489fa /tools/perf/util/annotate.c
parentperf annotate: Use ins__is_xxx() if possible (diff)
downloadkernel-10adbf777622e22323abbf9f7861c26deb373199.tar.gz
kernel-10adbf777622e22323abbf9f7861c26deb373199.zip
perf annotate: Add and use ins__is_nop()
Likewise, add ins__is_nop() to check if the current instruction is NOP. Signed-off-by: Namhyung Kim <[email protected]> Tested-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r--tools/perf/util/annotate.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 986c499150ef..5d0ca004dcfb 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -757,6 +757,11 @@ static struct ins_ops ret_ops = {
.scnprintf = ins__raw_scnprintf,
};
+bool ins__is_nop(const struct ins *ins)
+{
+ return ins->ops == &nop_ops;
+}
+
bool ins__is_ret(const struct ins *ins)
{
return ins->ops == &ret_ops;
@@ -1785,7 +1790,7 @@ static void delete_last_nop(struct symbol *sym)
dl = list_entry(list->prev, struct disasm_line, al.node);
if (dl->ins.ops) {
- if (dl->ins.ops != &nop_ops)
+ if (!ins__is_nop(&dl->ins))
return;
} else {
if (!strstr(dl->al.line, " nop ") &&