Commit cfef25b8 authored by Russell King's avatar Russell King Committed by Arnaldo Carvalho de Melo

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: default avatarRussell 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c8280cec
...@@ -65,6 +65,11 @@ static int call__parse(struct ins_operands *ops) ...@@ -65,6 +65,11 @@ static int call__parse(struct ins_operands *ops)
name++; name++;
#ifdef __arm__
if (strchr(name, '+'))
return -1;
#endif
tok = strchr(name, '>'); tok = strchr(name, '>');
if (tok == NULL) if (tok == NULL)
return -1; return -1;
...@@ -246,7 +251,11 @@ static int mov__parse(struct ins_operands *ops) ...@@ -246,7 +251,11 @@ static int mov__parse(struct ins_operands *ops)
return -1; return -1;
target = ++s; target = ++s;
#ifdef __arm__
comment = strchr(s, ';');
#else
comment = strchr(s, '#'); comment = strchr(s, '#');
#endif
if (comment != NULL) if (comment != NULL)
s = comment - 1; s = comment - 1;
...@@ -354,6 +363,20 @@ static struct ins instructions[] = { ...@@ -354,6 +363,20 @@ static struct ins instructions[] = {
{ .name = "addq", .ops = &mov_ops, }, { .name = "addq", .ops = &mov_ops, },
{ .name = "addw", .ops = &mov_ops, }, { .name = "addw", .ops = &mov_ops, },
{ .name = "and", .ops = &mov_ops, }, { .name = "and", .ops = &mov_ops, },
#ifdef __arm__
{ .name = "b", .ops = &jump_ops, }, // might also be a call
{ .name = "bcc", .ops = &jump_ops, },
{ .name = "bcs", .ops = &jump_ops, },
{ .name = "beq", .ops = &jump_ops, },
{ .name = "bge", .ops = &jump_ops, },
{ .name = "bgt", .ops = &jump_ops, },
{ .name = "bhi", .ops = &jump_ops, },
{ .name = "bl", .ops = &call_ops, },
{ .name = "blt", .ops = &jump_ops, },
{ .name = "bls", .ops = &jump_ops, },
{ .name = "blx", .ops = &call_ops, },
{ .name = "bne", .ops = &jump_ops, },
#endif
{ .name = "bts", .ops = &mov_ops, }, { .name = "bts", .ops = &mov_ops, },
{ .name = "call", .ops = &call_ops, }, { .name = "call", .ops = &call_ops, },
{ .name = "callq", .ops = &call_ops, }, { .name = "callq", .ops = &call_ops, },
......
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