From: Ian Rogers <irogers@google.com>
To: "Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Namhyung Kim" <namhyung@kernel.org>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Jiri Olsa" <jolsa@kernel.org>, "Ian Rogers" <irogers@google.com>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"James Clark" <james.clark@linaro.org>,
"John Garry" <john.g.garry@oracle.com>,
"Will Deacon" <will@kernel.org>, "Leo Yan" <leo.yan@linux.dev>,
"Guo Ren" <guoren@kernel.org>, "Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nick Desaulniers" <nick.desaulniers+lkml@gmail.com>,
"Bill Wendling" <morbo@google.com>,
"Justin Stitt" <justinstitt@google.com>,
"Zecheng Li" <zecheng@google.com>,
"Tianyou Li" <tianyou.li@intel.com>,
"Thomas Falcon" <thomas.falcon@intel.com>,
"Julia Lawall" <Julia.Lawall@inria.fr>,
"Suchit Karunakaran" <suchitkarunakaran@gmail.com>,
"Athira Rajeev" <atrajeev@linux.ibm.com>,
"Aditya Bodkhe" <aditya.b1@linux.ibm.com>,
"Howard Chu" <howardchu95@gmail.com>,
"Krzysztof Łopatowski" <krzysztof.m.lopatowski@gmail.com>,
"Dr. David Alan Gilbert" <linux@treblig.org>,
"Shimin Guo" <shimin.guo@skydio.com>,
"Sergei Trofimovich" <slyich@gmail.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org,
linux-riscv@lists.infradead.org
Subject: [PATCH v1 08/11] perf disasm: Refactor ins__is_call/jump to avoid exposing arch ins_ops
Date: Wed, 21 Jan 2026 23:31:24 -0800 [thread overview]
Message-ID: <20260122073127.375139-9-irogers@google.com> (raw)
In-Reply-To: <20260122073127.375139-1-irogers@google.com>
Add booleans indicating whether and ins_ops are call or jump and
return it. This avoids exposing loongarch and s390 ins_ops for the
sake of matching.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/util/annotate-arch/annotate-loongarch.c | 6 ++++--
tools/perf/util/annotate-arch/annotate-s390.c | 3 ++-
tools/perf/util/disasm.c | 6 ++++--
tools/perf/util/disasm.h | 5 ++---
4 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/tools/perf/util/annotate-arch/annotate-loongarch.c b/tools/perf/util/annotate-arch/annotate-loongarch.c
index 4bd651b63652..b95ae5d6657f 100644
--- a/tools/perf/util/annotate-arch/annotate-loongarch.c
+++ b/tools/perf/util/annotate-arch/annotate-loongarch.c
@@ -55,9 +55,10 @@ static int loongarch_call__parse(const struct arch *arch, struct ins_operands *o
return 0;
}
-const struct ins_ops loongarch_call_ops = {
+static const struct ins_ops loongarch_call_ops = {
.parse = loongarch_call__parse,
.scnprintf = call__scnprintf,
+ .is_call = true,
};
static int loongarch_jump__parse(const struct arch *arch, struct ins_operands *ops,
@@ -104,9 +105,10 @@ static int loongarch_jump__parse(const struct arch *arch, struct ins_operands *o
return 0;
}
-const struct ins_ops loongarch_jump_ops = {
+static const struct ins_ops loongarch_jump_ops = {
.parse = loongarch_jump__parse,
.scnprintf = jump__scnprintf,
+ .is_jump = true,
};
static
diff --git a/tools/perf/util/annotate-arch/annotate-s390.c b/tools/perf/util/annotate-arch/annotate-s390.c
index c1d06caa5f77..6d1a1da277e2 100644
--- a/tools/perf/util/annotate-arch/annotate-s390.c
+++ b/tools/perf/util/annotate-arch/annotate-s390.c
@@ -54,9 +54,10 @@ static int s390_call__parse(const struct arch *arch, struct ins_operands *ops,
return 0;
}
-const struct ins_ops s390_call_ops = {
+static const struct ins_ops s390_call_ops = {
.parse = s390_call__parse,
.scnprintf = call__scnprintf,
+ .is_call = true,
};
static int s390_mov__parse(const struct arch *arch __maybe_unused,
diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c
index c732b015f2e8..bc5323ecb5da 100644
--- a/tools/perf/util/disasm.c
+++ b/tools/perf/util/disasm.c
@@ -315,11 +315,12 @@ int call__scnprintf(const struct ins *ins, char *bf, size_t size,
const struct ins_ops call_ops = {
.parse = call__parse,
.scnprintf = call__scnprintf,
+ .is_call = true,
};
bool ins__is_call(const struct ins *ins)
{
- return ins->ops == &call_ops || ins->ops == &s390_call_ops || ins->ops == &loongarch_call_ops;
+ return ins->ops && ins->ops->is_call;
}
/*
@@ -469,11 +470,12 @@ const struct ins_ops jump_ops = {
.free = jump__delete,
.parse = jump__parse,
.scnprintf = jump__scnprintf,
+ .is_jump = true,
};
bool ins__is_jump(const struct ins *ins)
{
- return ins->ops == &jump_ops || ins->ops == &loongarch_jump_ops;
+ return ins->ops && ins->ops->is_jump;
}
static int comment__symbol(char *raw, char *comment, u64 *addrp, char **namep)
diff --git a/tools/perf/util/disasm.h b/tools/perf/util/disasm.h
index 83503c5075f9..b6a2a30fdf27 100644
--- a/tools/perf/util/disasm.h
+++ b/tools/perf/util/disasm.h
@@ -93,6 +93,8 @@ struct ins_ops {
struct disasm_line *dl);
int (*scnprintf)(const struct ins *ins, char *bf, size_t size,
struct ins_operands *ops, int max_ins_name);
+ bool is_jump;
+ bool is_call;
};
struct annotate_args {
@@ -139,9 +141,6 @@ bool ins__is_fused(const struct arch *arch, const char *ins1, const char *ins2);
bool ins__is_ret(const struct ins *ins);
bool ins__is_lock(const struct ins *ins);
-extern const struct ins_ops s390_call_ops;
-extern const struct ins_ops loongarch_call_ops;
-extern const struct ins_ops loongarch_jump_ops;
const struct ins_ops *check_ppc_insn(struct disasm_line *dl);
struct disasm_line *disasm_line__new(struct annotate_args *args);
--
2.52.0.457.g6b5491de43-goog
next prev parent reply other threads:[~2026-01-22 7:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 7:31 [PATCH v1 00/11] perf annotate arch clean up Ian Rogers
2026-01-22 7:31 ` [PATCH v1 01/11] perf maps: Fix reference count leak in maps__find_ams Ian Rogers
2026-01-22 7:31 ` [PATCH v1 02/11] perf annotate: Fix args leak of map_symbol Ian Rogers
2026-01-22 11:46 ` Suchit Karunakaran
2026-01-22 16:05 ` Ian Rogers
2026-01-22 7:31 ` [PATCH v1 03/11] perf disasm: Constify use of struct arch Ian Rogers
2026-01-22 7:31 ` [PATCH v1 04/11] perf disasm: Constify use of struct ins_op Ian Rogers
2026-01-22 7:31 ` [PATCH v1 05/11] perf disasm: Constify use of struct ins Ian Rogers
2026-01-22 7:31 ` [PATCH v1 06/11] perf disasm: Rework the string arch__is to use the ELF machine Ian Rogers
2026-01-22 7:31 ` [PATCH v1 07/11] perf disasm: Don't include C files from the arch directory Ian Rogers
2026-01-22 7:31 ` Ian Rogers [this message]
2026-01-22 7:31 ` [PATCH v1 09/11] perf map_symbol: Switch from holding maps to holding thread Ian Rogers
2026-01-22 7:31 ` [PATCH v1 10/11] perf disasm: Refactor arch__find and initialization of arch structs Ian Rogers
2026-01-22 7:31 ` [PATCH v1 11/11] perf disasm: Minor layout tweaks for struct arch Ian Rogers
2026-01-22 10:43 ` [PATCH v1 00/11] perf annotate arch clean up James Clark
2026-01-22 10:47 ` James Clark
2026-01-22 11:56 ` Suchit Karunakaran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260122073127.375139-9-irogers@google.com \
--to=irogers@google.com \
--cc=Julia.Lawall@inria.fr \
--cc=acme@kernel.org \
--cc=aditya.b1@linux.ibm.com \
--cc=adrian.hunter@intel.com \
--cc=alex@ghiti.fr \
--cc=alexander.shishkin@linux.intel.com \
--cc=aou@eecs.berkeley.edu \
--cc=atrajeev@linux.ibm.com \
--cc=guoren@kernel.org \
--cc=howardchu95@gmail.com \
--cc=james.clark@linaro.org \
--cc=john.g.garry@oracle.com \
--cc=jolsa@kernel.org \
--cc=justinstitt@google.com \
--cc=krzysztof.m.lopatowski@gmail.com \
--cc=leo.yan@linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-csky@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux@treblig.org \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=namhyung@kernel.org \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=palmer@dabbelt.com \
--cc=peterz@infradead.org \
--cc=pjw@kernel.org \
--cc=shimin.guo@skydio.com \
--cc=slyich@gmail.com \
--cc=suchitkarunakaran@gmail.com \
--cc=thomas.falcon@intel.com \
--cc=tianyou.li@intel.com \
--cc=will@kernel.org \
--cc=zecheng@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox