xref: /openbmc/linux/tools/perf/arch/s390/annotate/instructions.c (revision b24413180f5600bcb3bb70fbed5cf186b60864bd)
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 	arch__associate_ins_ops(arch, name, ops);
20 	return ops;
21 }
22 
23 static int s390__annotate_init(struct arch *arch)
24 {
25 	if (!arch->initialized) {
26 		arch->initialized = true;
27 		arch->associate_instruction_ops = s390__associate_ins_ops;
28 	}
29 
30 	return 0;
31 }
32