aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/browsers/annotate.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2016-11-24 09:16:06 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-11-25 08:24:16 -0500
commit75b49202d87c142a646e37edb466462ea6fbe0fb (patch)
treeaff7e428622c52271ae0b4052281082f5c413132 /tools/perf/ui/browsers/annotate.c
parent47414424c53a70eceb0fc6e0a35a31a2b763d5b2 (diff)
perf annotate: Remove duplicate 'name' field from disasm_line
The disasm_line::name field is always equal to ins::name, being used just to locate the instruction's ins_ops from the per-arch instructions table. Eliminate this duplication, nuking that field and instead make ins__find() return an ins_ops, store it in disasm_line::ins.ops, and keep just in disasm_line::ins.name what was in disasm_line::name, this way we end up not keeping a reference to entries in the per-arch instructions table. This in turn will help supporting multiple ways to manage the per-arch instructions table, allowing resorting that array, for instance, when the entries will move after references to its addresses were made. The same problem is avoided when one grows the array with realloc. So architectures simply keeping a constant array will work as well as architectures building the table using regular expressions or other logic that involves resorting the table. Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Chris Riyder <chris.ryder@arm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kim Phillips <kim.phillips@arm.com> Cc: Markus Trippelsdorf <markus@trippelsdorf.de> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Cc: Pawel Moll <pawel.moll@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Russell King <rmk+kernel@arm.linux.org.uk> Cc: Taeung Song <treeze.taeung@gmail.com> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-vr899azvabnw9gtuepuqfd9t@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/browsers/annotate.c')
-rw-r--r--tools/perf/ui/browsers/annotate.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index e6e9f7d80dbd..cee0eee31ce6 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -213,17 +213,17 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
213 ui_browser__write_nstring(browser, bf, printed); 213 ui_browser__write_nstring(browser, bf, printed);
214 if (change_color) 214 if (change_color)
215 ui_browser__set_color(browser, color); 215 ui_browser__set_color(browser, color);
216 if (dl->ins && dl->ins->ops->scnprintf) { 216 if (dl->ins.ops && dl->ins.ops->scnprintf) {
217 if (ins__is_jump(dl->ins)) { 217 if (ins__is_jump(&dl->ins)) {
218 bool fwd = dl->ops.target.offset > (u64)dl->offset; 218 bool fwd = dl->ops.target.offset > (u64)dl->offset;
219 219
220 ui_browser__write_graph(browser, fwd ? SLSMG_DARROW_CHAR : 220 ui_browser__write_graph(browser, fwd ? SLSMG_DARROW_CHAR :
221 SLSMG_UARROW_CHAR); 221 SLSMG_UARROW_CHAR);
222 SLsmg_write_char(' '); 222 SLsmg_write_char(' ');
223 } else if (ins__is_call(dl->ins)) { 223 } else if (ins__is_call(&dl->ins)) {
224 ui_browser__write_graph(browser, SLSMG_RARROW_CHAR); 224 ui_browser__write_graph(browser, SLSMG_RARROW_CHAR);
225 SLsmg_write_char(' '); 225 SLsmg_write_char(' ');
226 } else if (ins__is_ret(dl->ins)) { 226 } else if (ins__is_ret(&dl->ins)) {
227 ui_browser__write_graph(browser, SLSMG_LARROW_CHAR); 227 ui_browser__write_graph(browser, SLSMG_LARROW_CHAR);
228 SLsmg_write_char(' '); 228 SLsmg_write_char(' ');
229 } else { 229 } else {
@@ -243,7 +243,7 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
243 243
244static bool disasm_line__is_valid_jump(struct disasm_line *dl, struct symbol *sym) 244static bool disasm_line__is_valid_jump(struct disasm_line *dl, struct symbol *sym)
245{ 245{
246 if (!dl || !dl->ins || !ins__is_jump(dl->ins) 246 if (!dl || !dl->ins.ops || !ins__is_jump(&dl->ins)
247 || !disasm_line__has_offset(dl) 247 || !disasm_line__has_offset(dl)
248 || dl->ops.target.offset >= symbol__size(sym)) 248 || dl->ops.target.offset >= symbol__size(sym))
249 return false; 249 return false;
@@ -492,7 +492,7 @@ static bool annotate_browser__callq(struct annotate_browser *browser,
492 }; 492 };
493 char title[SYM_TITLE_MAX_SIZE]; 493 char title[SYM_TITLE_MAX_SIZE];
494 494
495 if (!ins__is_call(dl->ins)) 495 if (!ins__is_call(&dl->ins))
496 return false; 496 return false;
497 497
498 if (map_groups__find_ams(&target) || 498 if (map_groups__find_ams(&target) ||
@@ -545,7 +545,7 @@ static bool annotate_browser__jump(struct annotate_browser *browser)
545 struct disasm_line *dl = browser->selection; 545 struct disasm_line *dl = browser->selection;
546 s64 idx; 546 s64 idx;
547 547
548 if (!ins__is_jump(dl->ins)) 548 if (!ins__is_jump(&dl->ins))
549 return false; 549 return false;
550 550
551 dl = annotate_browser__find_offset(browser, dl->ops.target.offset, &idx); 551 dl = annotate_browser__find_offset(browser, dl->ops.target.offset, &idx);
@@ -841,9 +841,9 @@ show_help:
841 ui_helpline__puts("Huh? No selection. Report to linux-kernel@vger.kernel.org"); 841 ui_helpline__puts("Huh? No selection. Report to linux-kernel@vger.kernel.org");
842 else if (browser->selection->offset == -1) 842 else if (browser->selection->offset == -1)
843 ui_helpline__puts("Actions are only available for assembly lines."); 843 ui_helpline__puts("Actions are only available for assembly lines.");
844 else if (!browser->selection->ins) 844 else if (!browser->selection->ins.ops)
845 goto show_sup_ins; 845 goto show_sup_ins;
846 else if (ins__is_ret(browser->selection->ins)) 846 else if (ins__is_ret(&browser->selection->ins))
847 goto out; 847 goto out;
848 else if (!(annotate_browser__jump(browser) || 848 else if (!(annotate_browser__jump(browser) ||
849 annotate_browser__callq(browser, evsel, hbt))) { 849 annotate_browser__callq(browser, evsel, hbt))) {