Commit ad399baa authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf annotate: Use ins__is_xxx() if possible

This is to prepare separation of disasm related code.  Use the public
ins API instead of checking the internal data structure.
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Tested-by: default avatarIan Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240329215812.537846-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 09d2056e
...@@ -3665,7 +3665,7 @@ int annotate_get_insn_location(struct arch *arch, struct disasm_line *dl, ...@@ -3665,7 +3665,7 @@ int annotate_get_insn_location(struct arch *arch, struct disasm_line *dl,
struct annotated_op_loc *op_loc; struct annotated_op_loc *op_loc;
int i; int i;
if (!strcmp(dl->ins.name, "lock")) if (ins__is_lock(&dl->ins))
ops = dl->ops.locked.ops; ops = dl->ops.locked.ops;
else else
ops = &dl->ops; ops = &dl->ops;
...@@ -3763,7 +3763,7 @@ static struct disasm_line *find_disasm_line(struct symbol *sym, u64 ip, ...@@ -3763,7 +3763,7 @@ static struct disasm_line *find_disasm_line(struct symbol *sym, u64 ip,
* llvm-objdump places "lock" in a separate line and * llvm-objdump places "lock" in a separate line and
* in that case, we want to get the next line. * in that case, we want to get the next line.
*/ */
if (!strcmp(dl->ins.name, "lock") && if (ins__is_lock(&dl->ins) &&
*dl->ops.raw == '\0' && allow_update) { *dl->ops.raw == '\0' && allow_update) {
ip++; ip++;
continue; continue;
...@@ -4093,10 +4093,10 @@ static bool process_basic_block(struct basic_block_data *bb_data, ...@@ -4093,10 +4093,10 @@ static bool process_basic_block(struct basic_block_data *bb_data,
if (dl == last_dl) if (dl == last_dl)
break; break;
/* 'return' instruction finishes the block */ /* 'return' instruction finishes the block */
if (dl->ins.ops == &ret_ops) if (ins__is_ret(&dl->ins))
break; break;
/* normal instructions are part of the basic block */ /* normal instructions are part of the basic block */
if (dl->ins.ops != &jump_ops) if (!ins__is_jump(&dl->ins))
continue; continue;
/* jump to a different function, tail call or return */ /* jump to a different function, tail call or return */
if (dl->ops.target.outside) if (dl->ops.target.outside)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment