LLDB mainline
RegisterInfos_loongarch64.h
Go to the documentation of this file.
1//===-- RegisterInfos_loongarch64.h -----------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifdef DECLARE_REGISTER_INFOS_LOONGARCH64_STRUCT
10
11#include <stddef.h>
12
13#include "lldb/lldb-defines.h"
15#include "lldb/lldb-private.h"
16
19
20#ifndef GPR_OFFSET
21#error GPR_OFFSET must be defined before including this header file
22#endif
23
24#ifndef FPR_OFFSET
25#error FPR_OFFSET must be defined before including this header file
26#endif
27
28using namespace loongarch_dwarf;
29
30// clang-format off
31
32// I suppose EHFrame and DWARF are the same.
33#define KIND_HELPER(reg, generic_kind) \
34 { \
35 loongarch_dwarf::dwarf_##reg, loongarch_dwarf::dwarf_##reg, generic_kind, \
36 LLDB_INVALID_REGNUM, reg##_loongarch \
37 }
38
39// Generates register kinds array for generic purpose registers
40#define GPR64_KIND(reg, generic_kind) KIND_HELPER(reg, generic_kind)
41
42// Generates register kinds array for floating point registers
43#define FPR64_KIND(reg, generic_kind) KIND_HELPER(reg, generic_kind)
44
45// Defines a 64-bit general purpose register
46#define DEFINE_GPR64(reg, generic_kind) DEFINE_GPR64_ALT(reg, reg, generic_kind)
47#define DEFINE_GPR64_ALT(reg, alt, generic_kind) \
48 { \
49 #reg, #alt, 8, GPR_OFFSET(gpr_##reg##_loongarch - gpr_first_loongarch), \
50 lldb::eEncodingUint, lldb::eFormatHex, \
51 GPR64_KIND(gpr_##reg, generic_kind), nullptr, nullptr, nullptr, \
52 }
53
54// Defines a 64-bit floating point register
55#define DEFINE_FPR64(reg, generic_kind) DEFINE_FPR64_ALT(reg, reg, generic_kind)
56#define DEFINE_FPR64_ALT(reg, alt, generic_kind) \
57 { \
58 #reg, #alt, 8, FPR_OFFSET(fpr_##reg##_loongarch - fpr_first_loongarch), \
59 lldb::eEncodingUint, lldb::eFormatHex, \
60 FPR64_KIND(fpr_##reg, generic_kind), nullptr, nullptr, nullptr, \
61 }
62
63#define DEFINE_FCC(reg, generic_kind) \
64 { \
65 #reg, nullptr, 1, FCC_OFFSET(fpr_##reg##_loongarch - fpr_fcc0_loongarch), \
66 lldb::eEncodingUint, lldb::eFormatHex, \
67 FPR64_KIND(fpr_##reg, generic_kind), nullptr, nullptr, nullptr, \
68 }
69
70#define DEFINE_FCSR(reg, generic_kind) \
71 { \
72 #reg, nullptr, 4, FCSR_OFFSET, \
73 lldb::eEncodingUint, lldb::eFormatHex, \
74 FPR64_KIND(fpr_##reg, generic_kind), nullptr, nullptr, nullptr, \
75 }
76
77// clang-format on
78
79static lldb_private::RegisterInfo g_register_infos_loongarch64[] = {
80 DEFINE_GPR64_ALT(r0, zero, LLDB_INVALID_REGNUM),
81 DEFINE_GPR64_ALT(r1, ra, LLDB_REGNUM_GENERIC_RA),
82 DEFINE_GPR64_ALT(r2, tp, LLDB_INVALID_REGNUM),
83 DEFINE_GPR64_ALT(r3, sp, LLDB_REGNUM_GENERIC_SP),
84 DEFINE_GPR64_ALT(r4, a0, LLDB_REGNUM_GENERIC_ARG1),
85 DEFINE_GPR64_ALT(r5, a1, LLDB_REGNUM_GENERIC_ARG2),
86 DEFINE_GPR64_ALT(r6, a2, LLDB_REGNUM_GENERIC_ARG3),
87 DEFINE_GPR64_ALT(r7, a3, LLDB_REGNUM_GENERIC_ARG4),
88 DEFINE_GPR64_ALT(r8, a4, LLDB_REGNUM_GENERIC_ARG5),
89 DEFINE_GPR64_ALT(r9, a5, LLDB_REGNUM_GENERIC_ARG6),
90 DEFINE_GPR64_ALT(r10, a6, LLDB_REGNUM_GENERIC_ARG7),
91 DEFINE_GPR64_ALT(r11, a7, LLDB_REGNUM_GENERIC_ARG8),
92 DEFINE_GPR64_ALT(r12, t0, LLDB_INVALID_REGNUM),
93 DEFINE_GPR64_ALT(r13, t1, LLDB_INVALID_REGNUM),
94 DEFINE_GPR64_ALT(r14, t2, LLDB_INVALID_REGNUM),
95 DEFINE_GPR64_ALT(r15, t3, LLDB_INVALID_REGNUM),
96 DEFINE_GPR64_ALT(r16, t4, LLDB_INVALID_REGNUM),
97 DEFINE_GPR64_ALT(r17, t5, LLDB_INVALID_REGNUM),
98 DEFINE_GPR64_ALT(r18, t6, LLDB_INVALID_REGNUM),
99 DEFINE_GPR64_ALT(r19, t7, LLDB_INVALID_REGNUM),
100 DEFINE_GPR64_ALT(r20, t8, LLDB_INVALID_REGNUM),
101 DEFINE_GPR64(r21, LLDB_INVALID_REGNUM),
102 DEFINE_GPR64_ALT(r22, fp, LLDB_REGNUM_GENERIC_FP),
103 DEFINE_GPR64_ALT(r23, s0, LLDB_INVALID_REGNUM),
104 DEFINE_GPR64_ALT(r24, s1, LLDB_INVALID_REGNUM),
105 DEFINE_GPR64_ALT(r25, s2, LLDB_INVALID_REGNUM),
106 DEFINE_GPR64_ALT(r26, s3, LLDB_INVALID_REGNUM),
107 DEFINE_GPR64_ALT(r27, s4, LLDB_INVALID_REGNUM),
108 DEFINE_GPR64_ALT(r28, s5, LLDB_INVALID_REGNUM),
109 DEFINE_GPR64_ALT(r29, s6, LLDB_INVALID_REGNUM),
110 DEFINE_GPR64_ALT(r30, s7, LLDB_INVALID_REGNUM),
111 DEFINE_GPR64_ALT(r31, s8, LLDB_INVALID_REGNUM),
112
113 DEFINE_GPR64(orig_a0, LLDB_INVALID_REGNUM),
114 DEFINE_GPR64(pc, LLDB_REGNUM_GENERIC_PC),
115 DEFINE_GPR64(badv, LLDB_INVALID_REGNUM),
116 DEFINE_GPR64(reserved0, LLDB_INVALID_REGNUM),
117 DEFINE_GPR64(reserved1, LLDB_INVALID_REGNUM),
118 DEFINE_GPR64(reserved2, LLDB_INVALID_REGNUM),
119 DEFINE_GPR64(reserved3, LLDB_INVALID_REGNUM),
120 DEFINE_GPR64(reserved4, LLDB_INVALID_REGNUM),
121 DEFINE_GPR64(reserved5, LLDB_INVALID_REGNUM),
122 DEFINE_GPR64(reserved6, LLDB_INVALID_REGNUM),
123 DEFINE_GPR64(reserved7, LLDB_INVALID_REGNUM),
124 DEFINE_GPR64(reserved8, LLDB_INVALID_REGNUM),
125 DEFINE_GPR64(reserved9, LLDB_INVALID_REGNUM),
126
127 DEFINE_FPR64_ALT(f0, fa0, LLDB_INVALID_REGNUM),
128 DEFINE_FPR64_ALT(f1, fa1, LLDB_INVALID_REGNUM),
129 DEFINE_FPR64_ALT(f2, fa2, LLDB_INVALID_REGNUM),
130 DEFINE_FPR64_ALT(f3, fa3, LLDB_INVALID_REGNUM),
131 DEFINE_FPR64_ALT(f4, fa4, LLDB_INVALID_REGNUM),
132 DEFINE_FPR64_ALT(f5, fa5, LLDB_INVALID_REGNUM),
133 DEFINE_FPR64_ALT(f6, fa6, LLDB_INVALID_REGNUM),
134 DEFINE_FPR64_ALT(f7, fa7, LLDB_INVALID_REGNUM),
135 DEFINE_FPR64_ALT(f8, ft0, LLDB_INVALID_REGNUM),
136 DEFINE_FPR64_ALT(f9, ft1, LLDB_INVALID_REGNUM),
137 DEFINE_FPR64_ALT(f10, ft2, LLDB_INVALID_REGNUM),
138 DEFINE_FPR64_ALT(f11, ft3, LLDB_INVALID_REGNUM),
139 DEFINE_FPR64_ALT(f12, ft4, LLDB_INVALID_REGNUM),
140 DEFINE_FPR64_ALT(f13, ft5, LLDB_INVALID_REGNUM),
141 DEFINE_FPR64_ALT(f14, ft6, LLDB_INVALID_REGNUM),
142 DEFINE_FPR64_ALT(f15, ft7, LLDB_INVALID_REGNUM),
143 DEFINE_FPR64_ALT(f16, ft8, LLDB_INVALID_REGNUM),
144 DEFINE_FPR64_ALT(f17, ft9, LLDB_INVALID_REGNUM),
145 DEFINE_FPR64_ALT(f18, ft10, LLDB_INVALID_REGNUM),
146 DEFINE_FPR64_ALT(f19, ft11, LLDB_INVALID_REGNUM),
147 DEFINE_FPR64_ALT(f20, ft12, LLDB_INVALID_REGNUM),
148 DEFINE_FPR64_ALT(f21, ft13, LLDB_INVALID_REGNUM),
149 DEFINE_FPR64_ALT(f22, ft14, LLDB_INVALID_REGNUM),
150 DEFINE_FPR64_ALT(f23, ft15, LLDB_INVALID_REGNUM),
151 DEFINE_FPR64_ALT(f24, fs0, LLDB_INVALID_REGNUM),
152 DEFINE_FPR64_ALT(f25, fs1, LLDB_INVALID_REGNUM),
153 DEFINE_FPR64_ALT(f26, fs2, LLDB_INVALID_REGNUM),
154 DEFINE_FPR64_ALT(f27, fs3, LLDB_INVALID_REGNUM),
155 DEFINE_FPR64_ALT(f28, fs4, LLDB_INVALID_REGNUM),
156 DEFINE_FPR64_ALT(f29, fs5, LLDB_INVALID_REGNUM),
157 DEFINE_FPR64_ALT(f30, fs6, LLDB_INVALID_REGNUM),
158 DEFINE_FPR64_ALT(f31, fs7, LLDB_INVALID_REGNUM),
159
160 DEFINE_FCC(fcc0, LLDB_INVALID_REGNUM),
161 DEFINE_FCC(fcc1, LLDB_INVALID_REGNUM),
162 DEFINE_FCC(fcc2, LLDB_INVALID_REGNUM),
163 DEFINE_FCC(fcc3, LLDB_INVALID_REGNUM),
164 DEFINE_FCC(fcc4, LLDB_INVALID_REGNUM),
165 DEFINE_FCC(fcc5, LLDB_INVALID_REGNUM),
166 DEFINE_FCC(fcc6, LLDB_INVALID_REGNUM),
167 DEFINE_FCC(fcc7, LLDB_INVALID_REGNUM),
168 DEFINE_FCSR(fcsr, LLDB_INVALID_REGNUM),
169};
170
171#endif // DECLARE_REGISTER_INFOS_LOONGARCH64_STRUCT
#define LLDB_REGNUM_GENERIC_RA
Definition: lldb-defines.h:59
#define LLDB_REGNUM_GENERIC_ARG8
Definition: lldb-defines.h:75
#define LLDB_REGNUM_GENERIC_ARG6
Definition: lldb-defines.h:71
#define LLDB_REGNUM_GENERIC_SP
Definition: lldb-defines.h:57
#define LLDB_REGNUM_GENERIC_ARG4
Definition: lldb-defines.h:67
#define LLDB_REGNUM_GENERIC_ARG3
Definition: lldb-defines.h:65
#define LLDB_REGNUM_GENERIC_ARG1
Definition: lldb-defines.h:61
#define LLDB_REGNUM_GENERIC_ARG7
Definition: lldb-defines.h:73
#define LLDB_INVALID_REGNUM
Definition: lldb-defines.h:87
#define LLDB_REGNUM_GENERIC_ARG2
Definition: lldb-defines.h:63
#define LLDB_REGNUM_GENERIC_PC
Definition: lldb-defines.h:56
#define LLDB_REGNUM_GENERIC_FP
Definition: lldb-defines.h:58
#define LLDB_REGNUM_GENERIC_ARG5
Definition: lldb-defines.h:69
Every register is described in detail including its name, alternate name (optional),...