]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf annotate-data: Add is_better_type() helper
authorNamhyung Kim <namhyung@kernel.org>
Fri, 16 Aug 2024 23:58:37 +0000 (16:58 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 19 Aug 2024 14:49:22 +0000 (11:49 -0300)
commitc663451f9239c89746b55f1a17ad62b014fa7905
tree860f113399e54c794415ac4b4c4137bf9e09fe82
parent98d1f1dc72fd6e0e85db4acc0b2dd591f4488216
perf annotate-data: Add is_better_type() helper

Sometimes more than one variables are located in the same register or a
stack slot.  Or it can overwrite existing information with others.  I
found this is not helpful in some cases so it needs to update the type
information from the variable only if it's better.

But it's hard to know which one is better, so we needs heuristics. :)

As it deals with memory accesses, the location should have a pointer or
something similar (like array or reference).  So if it had an integer
type and a variable is a pointer, we can take the variable's type to
resolve the target of the access.

If it has a pointer type and a variable with the same location has a
different pointer type, it'll take one with bigger target type.  This
can be useful when the target type embeds a smaller type (like list
header or RB-tree node) at the beginning so their location is same.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ian Rogers <irogers@google.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/20240816235840.2754937-8-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/annotate-data.c