GNU Linux-libre 4.14.303-gnu1
[releases.git] / tools / perf / arch / s390 / annotate / instructions.c
1 // SPDX-License-Identifier: GPL-2.0
2 static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *name)
3 {
4         struct ins_ops *ops = NULL;
5
6         /* catch all kind of jumps */
7         if (strchr(name, 'j') ||
8             !strncmp(name, "bct", 3) ||
9             !strncmp(name, "br", 2))
10                 ops = &jump_ops;
11         /* override call/returns */
12         if (!strcmp(name, "bras") ||
13             !strcmp(name, "brasl") ||
14             !strcmp(name, "basr"))
15                 ops = &call_ops;
16         if (!strcmp(name, "br"))
17                 ops = &ret_ops;
18
19         if (ops)
20                 arch__associate_ins_ops(arch, name, ops);
21         return ops;
22 }
23
24 static int s390__annotate_init(struct arch *arch)
25 {
26         if (!arch->initialized) {
27                 arch->initialized = true;
28                 arch->associate_instruction_ops = s390__associate_ins_ops;
29         }
30
31         return 0;
32 }