diff options
| author | Namhyung Kim <namhyung@kernel.org> | 2024-03-18 22:50:59 -0700 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2024-03-21 10:41:28 -0300 |
| commit | 5cdd3fd7995a7a07b1654ea37e0fcc3c64f0cc44 (patch) | |
| tree | acc3ce02ab831ec1864e43ea6ce7b9c773bcb1dd /tools/perf/util/annotate.h | |
| parent | perf annotate-data: Introduce 'struct data_loc_info' (diff) | |
| download | linux-5cdd3fd7995a7a07b1654ea37e0fcc3c64f0cc44.tar.gz linux-5cdd3fd7995a7a07b1654ea37e0fcc3c64f0cc44.zip | |
perf annotate: Add annotate_get_basic_blocks()
The annotate_get_basic_blocks() is to find a list of basic blocks from
the source instruction to the destination instruction in a function.
It'll be used to find variables in a scope. Use BFS (Breadth First
Search) to find a shortest path to carry the variable/register state
minimally.
Also change find_disasm_line() to be used in annotate_get_basic_blocks()
and add 'allow_update' argument to control if it can update the IP.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20240319055115.4063940-8-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.h')
| -rw-r--r-- | tools/perf/util/annotate.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index 13cc659e508c..0928663fddee 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h @@ -561,4 +561,20 @@ extern struct list_head ann_insn_stat; u64 annotate_calc_pcrel(struct map_symbol *ms, u64 ip, int offset, struct disasm_line *dl); +/** + * struct annotated_basic_block - Basic block of instructions + * @list: List node + * @begin: start instruction in the block + * @end: end instruction in the block + */ +struct annotated_basic_block { + struct list_head list; + struct disasm_line *begin; + struct disasm_line *end; +}; + +/* Get a list of basic blocks from src to dst addresses */ +int annotate_get_basic_blocks(struct symbol *sym, s64 src, s64 dst, + struct list_head *head); + #endif /* __PERF_ANNOTATE_H */ |
