aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2015-12-06 18:07:13 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-12-07 16:13:00 -0500
commitcfef25b8daf7e4b49c84e174a904af9d89dc7c46 (patch)
tree53148198f44c9a68efd82fca60133d0ba4903406 /tools/perf/util/annotate.c
parentc8280cec2a196f2ffea83dd755b17eb020ca1b83 (diff)
perf annotate: ARM support
Add basic support to parse ARM assembly. This: * enables perf to correctly show the disassembly, rather than chopping some constants off at the '#' (which is not a comment character on ARM). * allows perf to identify ARM instructions that branch to other parts within the same function, thereby properly annotating them. * allows perf to identify function calls, allowing called functions to be followed in the annotated view. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Will Deacon <will.deacon@arm.com> Link: http://lkml.kernel.org/n/tip-owp1uj0nmcgfrlppfyeetuyf@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r--tools/perf/util/annotate.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 1dd1949b0e79..b795b6994144 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -65,6 +65,11 @@ static int call__parse(struct ins_operands *ops)
65 65
66 name++; 66 name++;
67 67
68#ifdef __arm__
69 if (strchr(name, '+'))
70 return -1;
71#endif
72
68 tok = strchr(name, '>'); 73 tok = strchr(name, '>');
69 if (tok == NULL) 74 if (tok == NULL)
70 return -1; 75 return -1;
@@ -246,7 +251,11 @@ static int mov__parse(struct ins_operands *ops)
246 return -1; 251 return -1;
247 252
248 target = ++s; 253 target = ++s;
254#ifdef __arm__
255 comment = strchr(s, ';');
256#else
249 comment = strchr(s, '#'); 257 comment = strchr(s, '#');
258#endif
250 259
251 if (comment != NULL) 260 if (comment != NULL)
252 s = comment - 1; 261 s = comment - 1;
@@ -354,6 +363,20 @@ static struct ins instructions[] = {
354 { .name = "addq", .ops = &mov_ops, }, 363 { .name = "addq", .ops = &mov_ops, },
355 { .name = "addw", .ops = &mov_ops, }, 364 { .name = "addw", .ops = &mov_ops, },
356 { .name = "and", .ops = &mov_ops, }, 365 { .name = "and", .ops = &mov_ops, },
366#ifdef __arm__
367 { .name = "b", .ops = &jump_ops, }, // might also be a call
368 { .name = "bcc", .ops = &jump_ops, },
369 { .name = "bcs", .ops = &jump_ops, },
370 { .name = "beq", .ops = &jump_ops, },
371 { .name = "bge", .ops = &jump_ops, },
372 { .name = "bgt", .ops = &jump_ops, },
373 { .name = "bhi", .ops = &jump_ops, },
374 { .name = "bl", .ops = &call_ops, },
375 { .name = "blt", .ops = &jump_ops, },
376 { .name = "bls", .ops = &jump_ops, },
377 { .name = "blx", .ops = &call_ops, },
378 { .name = "bne", .ops = &jump_ops, },
379#endif
357 { .name = "bts", .ops = &mov_ops, }, 380 { .name = "bts", .ops = &mov_ops, },
358 { .name = "call", .ops = &call_ops, }, 381 { .name = "call", .ops = &call_ops, },
359 { .name = "callq", .ops = &call_ops, }, 382 { .name = "callq", .ops = &call_ops, },