diff options
| author | Ian Rogers <irogers@google.com> | 2026-01-22 13:35:12 -0800 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-01-23 16:58:38 -0300 |
| commit | 07b972ff09f45cfb7acd20cd9b3769c6975bc434 (patch) | |
| tree | f8cecf6a6a63113dd96b4305a42ef5af5eecef2b /tools/perf/arch/sparc | |
| parent | 9273085273103e5994952dc2725f1f0109af97d1 (diff) | |
perf disasm: Don't include C files from the arch directory
Move the arch instructions.c files into appropriately named files in
annotate-arch in the util directory.
Don't #include to compile the code, switch to building the files and fix
up the #includes accordingly.
Move powerpc specific disasm code out of disasm.c and into
annotate-powerpc.c.
Declarations and static removed as appropriate for the code to compile
as separate compilation units.
The e_machine and e_flags set up is moved to the disasm.c architectures
array so that later patches can sort by them.
Reviewed-by: James Clark <james.clark@linaro.org>
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Aditya Bodkhe <aditya.b1@linux.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Bill Wendling <morbo@google.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Julia Lawall <Julia.Lawall@inria.fr>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Krzysztof Ćopatowski <krzysztof.m.lopatowski@gmail.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sergei Trofimovich <slyich@gmail.com>
Cc: Shimin Guo <shimin.guo@skydio.com>
Cc: Suchit Karunakaran <suchitkarunakaran@gmail.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Tianyou Li <tianyou.li@intel.com>
Cc: Will Deacon <will@kernel.org>
Cc: Zecheng Li <zecheng@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/arch/sparc')
| -rw-r--r-- | tools/perf/arch/sparc/annotate/instructions.c | 171 |
1 files changed, 0 insertions, 171 deletions
diff --git a/tools/perf/arch/sparc/annotate/instructions.c b/tools/perf/arch/sparc/annotate/instructions.c deleted file mode 100644 index a08d8734c883..000000000000 --- a/tools/perf/arch/sparc/annotate/instructions.c +++ /dev/null @@ -1,171 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -static int is_branch_cond(const char *cond) -{ - if (cond[0] == '\0') - return 1; - - if (cond[0] == 'a' && cond[1] == '\0') - return 1; - - if (cond[0] == 'c' && - (cond[1] == 'c' || cond[1] == 's') && - cond[2] == '\0') - return 1; - - if (cond[0] == 'e' && - (cond[1] == '\0' || - (cond[1] == 'q' && cond[2] == '\0'))) - return 1; - - if (cond[0] == 'g' && - (cond[1] == '\0' || - (cond[1] == 't' && cond[2] == '\0') || - (cond[1] == 'e' && cond[2] == '\0') || - (cond[1] == 'e' && cond[2] == 'u' && cond[3] == '\0'))) - return 1; - - if (cond[0] == 'l' && - (cond[1] == '\0' || - (cond[1] == 't' && cond[2] == '\0') || - (cond[1] == 'u' && cond[2] == '\0') || - (cond[1] == 'e' && cond[2] == '\0') || - (cond[1] == 'e' && cond[2] == 'u' && cond[3] == '\0'))) - return 1; - - if (cond[0] == 'n' && - (cond[1] == '\0' || - (cond[1] == 'e' && cond[2] == '\0') || - (cond[1] == 'z' && cond[2] == '\0') || - (cond[1] == 'e' && cond[2] == 'g' && cond[3] == '\0'))) - return 1; - - if (cond[0] == 'b' && - cond[1] == 'p' && - cond[2] == 'o' && - cond[3] == 's' && - cond[4] == '\0') - return 1; - - if (cond[0] == 'v' && - (cond[1] == 'c' || cond[1] == 's') && - cond[2] == '\0') - return 1; - - if (cond[0] == 'b' && - cond[1] == 'z' && - cond[2] == '\0') - return 1; - - return 0; -} - -static int is_branch_reg_cond(const char *cond) -{ - if ((cond[0] == 'n' || cond[0] == 'l') && - cond[1] == 'z' && - cond[2] == '\0') - return 1; - - if (cond[0] == 'z' && - cond[1] == '\0') - return 1; - - if ((cond[0] == 'g' || cond[0] == 'l') && - cond[1] == 'e' && - cond[2] == 'z' && - cond[3] == '\0') - return 1; - - if (cond[0] == 'g' && - cond[1] == 'z' && - cond[2] == '\0') - return 1; - - return 0; -} - -static int is_branch_float_cond(const char *cond) -{ - if (cond[0] == '\0') - return 1; - - if ((cond[0] == 'a' || cond[0] == 'e' || - cond[0] == 'z' || cond[0] == 'g' || - cond[0] == 'l' || cond[0] == 'n' || - cond[0] == 'o' || cond[0] == 'u') && - cond[1] == '\0') - return 1; - - if (((cond[0] == 'g' && cond[1] == 'e') || - (cond[0] == 'l' && (cond[1] == 'e' || - cond[1] == 'g')) || - (cond[0] == 'n' && (cond[1] == 'e' || - cond[1] == 'z')) || - (cond[0] == 'u' && (cond[1] == 'e' || - cond[1] == 'g' || - cond[1] == 'l'))) && - cond[2] == '\0') - return 1; - - if (cond[0] == 'u' && - (cond[1] == 'g' || cond[1] == 'l') && - cond[2] == 'e' && - cond[3] == '\0') - return 1; - - return 0; -} - -static const struct ins_ops *sparc__associate_instruction_ops(struct arch *arch, const char *name) -{ - const struct ins_ops *ops = NULL; - - if (!strcmp(name, "call") || - !strcmp(name, "jmp") || - !strcmp(name, "jmpl")) { - ops = &call_ops; - } else if (!strcmp(name, "ret") || - !strcmp(name, "retl") || - !strcmp(name, "return")) { - ops = &ret_ops; - } else if (!strcmp(name, "mov")) { - ops = &mov_ops; - } else { - if (name[0] == 'c' && - (name[1] == 'w' || name[1] == 'x')) - name += 2; - - if (name[0] == 'b') { - const char *cond = name + 1; - - if (cond[0] == 'r') { - if (is_branch_reg_cond(cond + 1)) - ops = &jump_ops; - } else if (is_branch_cond(cond)) { - ops = &jump_ops; - } - } else if (name[0] == 'f' && name[1] == 'b') { - if (is_branch_float_cond(name + 2)) - ops = &jump_ops; - } - } - - if (ops) - arch__associate_ins_ops(arch, name, ops); - - return ops; -} - -static int sparc__annotate_init(struct arch *arch, char *cpuid __maybe_unused) -{ - if (!arch->initialized) { - arch->initialized = true; - arch->associate_instruction_ops = sparc__associate_instruction_ops; - arch->objdump.comment_char = '#'; - arch->e_machine = EM_SPARC; - arch->e_flags = 0; - } - - return 0; -} |
