xref: /linux/tools/perf/util/perf-regs-arch/perf_regs_loongarch.c (revision 5000e7f61a1eb82fed98d5d0c8f19477033f0914)
1*5000e7f6SLeo Yan // SPDX-License-Identifier: GPL-2.0
2*5000e7f6SLeo Yan 
3*5000e7f6SLeo Yan #ifdef HAVE_PERF_REGS_SUPPORT
4*5000e7f6SLeo Yan 
5*5000e7f6SLeo Yan #include "../perf_regs.h"
6*5000e7f6SLeo Yan #include "../../../arch/loongarch/include/uapi/asm/perf_regs.h"
7*5000e7f6SLeo Yan 
8*5000e7f6SLeo Yan const char *__perf_reg_name_loongarch(int id)
9*5000e7f6SLeo Yan {
10*5000e7f6SLeo Yan 	switch (id) {
11*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_PC:
12*5000e7f6SLeo Yan 		return "PC";
13*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R1:
14*5000e7f6SLeo Yan 		return "%r1";
15*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R2:
16*5000e7f6SLeo Yan 		return "%r2";
17*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R3:
18*5000e7f6SLeo Yan 		return "%r3";
19*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R4:
20*5000e7f6SLeo Yan 		return "%r4";
21*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R5:
22*5000e7f6SLeo Yan 		return "%r5";
23*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R6:
24*5000e7f6SLeo Yan 		return "%r6";
25*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R7:
26*5000e7f6SLeo Yan 		return "%r7";
27*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R8:
28*5000e7f6SLeo Yan 		return "%r8";
29*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R9:
30*5000e7f6SLeo Yan 		return "%r9";
31*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R10:
32*5000e7f6SLeo Yan 		return "%r10";
33*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R11:
34*5000e7f6SLeo Yan 		return "%r11";
35*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R12:
36*5000e7f6SLeo Yan 		return "%r12";
37*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R13:
38*5000e7f6SLeo Yan 		return "%r13";
39*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R14:
40*5000e7f6SLeo Yan 		return "%r14";
41*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R15:
42*5000e7f6SLeo Yan 		return "%r15";
43*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R16:
44*5000e7f6SLeo Yan 		return "%r16";
45*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R17:
46*5000e7f6SLeo Yan 		return "%r17";
47*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R18:
48*5000e7f6SLeo Yan 		return "%r18";
49*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R19:
50*5000e7f6SLeo Yan 		return "%r19";
51*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R20:
52*5000e7f6SLeo Yan 		return "%r20";
53*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R21:
54*5000e7f6SLeo Yan 		return "%r21";
55*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R22:
56*5000e7f6SLeo Yan 		return "%r22";
57*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R23:
58*5000e7f6SLeo Yan 		return "%r23";
59*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R24:
60*5000e7f6SLeo Yan 		return "%r24";
61*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R25:
62*5000e7f6SLeo Yan 		return "%r25";
63*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R26:
64*5000e7f6SLeo Yan 		return "%r26";
65*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R27:
66*5000e7f6SLeo Yan 		return "%r27";
67*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R28:
68*5000e7f6SLeo Yan 		return "%r28";
69*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R29:
70*5000e7f6SLeo Yan 		return "%r29";
71*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R30:
72*5000e7f6SLeo Yan 		return "%r30";
73*5000e7f6SLeo Yan 	case PERF_REG_LOONGARCH_R31:
74*5000e7f6SLeo Yan 		return "%r31";
75*5000e7f6SLeo Yan 	default:
76*5000e7f6SLeo Yan 		break;
77*5000e7f6SLeo Yan 	}
78*5000e7f6SLeo Yan 	return NULL;
79*5000e7f6SLeo Yan }
80*5000e7f6SLeo Yan 
81*5000e7f6SLeo Yan #endif
82