]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/source/Plugins/Process/Utility/RegisterInfos_s390x.h
Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / source / Plugins / Process / Utility / RegisterInfos_s390x.h
1 //===-- RegisterInfos_s390x.h -----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // C Includes
11 #include <stddef.h>
12
13 // C++ Includes
14 // Other libraries and framework includes
15 #include "llvm/Support/Compiler.h"
16
17 // Project includes
18
19 #ifdef DECLARE_REGISTER_INFOS_S390X_STRUCT
20
21 // Computes the offset of the given GPR in the user data area.
22 #define GPR_OFFSET(num) (16 + 8 * num)
23 // Computes the offset of the given ACR in the user data area.
24 #define ACR_OFFSET(num) (16 + 8 * 16 + 4 * num)
25 // Computes the offset of the given FPR in the extended data area.
26 #define FPR_OFFSET(num) (8 + 8 * num)
27
28 // RegisterKind: EHFrame, DWARF, Generic, Process Plugin, LLDB
29
30 #define DEFINE_GPR(name, size, offset, alt, generic)                           \
31   {                                                                            \
32     #name, alt, size, offset, eEncodingUint, eFormatHex,                       \
33         {dwarf_##name##_s390x, dwarf_##name##_s390x, generic,                  \
34          LLDB_INVALID_REGNUM, lldb_##name##_s390x },                           \
35          NULL, NULL, NULL, 0                                                   \
36   }
37
38 #define DEFINE_GPR_NODWARF(name, size, offset, alt, generic)                   \
39   {                                                                            \
40     #name, alt, size, offset, eEncodingUint, eFormatHex,                       \
41         {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, generic,                    \
42          LLDB_INVALID_REGNUM, lldb_##name##_s390x },                           \
43          NULL, NULL, NULL, 0                                                   \
44   }
45
46 #define DEFINE_FPR(name, size, offset)                                         \
47   {                                                                            \
48     #name, NULL, size, offset, eEncodingUint, eFormatHex,                      \
49         {dwarf_##name##_s390x, dwarf_##name##_s390x, LLDB_INVALID_REGNUM,      \
50          LLDB_INVALID_REGNUM, lldb_##name##_s390x },                           \
51          NULL, NULL, NULL, 0                                                   \
52   }
53
54 #define DEFINE_FPR_NODWARF(name, size, offset)                                 \
55   {                                                                            \
56     #name, NULL, size, offset, eEncodingUint, eFormatHex,                      \
57         {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,        \
58          LLDB_INVALID_REGNUM, lldb_##name##_s390x },                           \
59          NULL, NULL, NULL, 0                                                   \
60   }
61
62 static RegisterInfo g_register_infos_s390x[] = {
63     // General purpose registers.
64     DEFINE_GPR(r0, 8, GPR_OFFSET(0), nullptr, LLDB_INVALID_REGNUM),
65     DEFINE_GPR(r1, 8, GPR_OFFSET(1), nullptr, LLDB_INVALID_REGNUM),
66     DEFINE_GPR(r2, 8, GPR_OFFSET(2), "arg1", LLDB_REGNUM_GENERIC_ARG1),
67     DEFINE_GPR(r3, 8, GPR_OFFSET(3), "arg2", LLDB_REGNUM_GENERIC_ARG2),
68     DEFINE_GPR(r4, 8, GPR_OFFSET(4), "arg3", LLDB_REGNUM_GENERIC_ARG3),
69     DEFINE_GPR(r5, 8, GPR_OFFSET(5), "arg4", LLDB_REGNUM_GENERIC_ARG4),
70     DEFINE_GPR(r6, 8, GPR_OFFSET(6), "arg5", LLDB_REGNUM_GENERIC_ARG5),
71     DEFINE_GPR(r7, 8, GPR_OFFSET(7), nullptr, LLDB_INVALID_REGNUM),
72     DEFINE_GPR(r8, 8, GPR_OFFSET(8), nullptr, LLDB_INVALID_REGNUM),
73     DEFINE_GPR(r9, 8, GPR_OFFSET(9), nullptr, LLDB_INVALID_REGNUM),
74     DEFINE_GPR(r10, 8, GPR_OFFSET(10), nullptr, LLDB_INVALID_REGNUM),
75     DEFINE_GPR(r11, 8, GPR_OFFSET(11), "fp", LLDB_REGNUM_GENERIC_FP),
76     DEFINE_GPR(r12, 8, GPR_OFFSET(12), nullptr, LLDB_INVALID_REGNUM),
77     DEFINE_GPR(r13, 8, GPR_OFFSET(13), nullptr, LLDB_INVALID_REGNUM),
78     DEFINE_GPR(r14, 8, GPR_OFFSET(14), nullptr, LLDB_INVALID_REGNUM),
79     DEFINE_GPR(r15, 8, GPR_OFFSET(15), "sp", LLDB_REGNUM_GENERIC_SP),
80     DEFINE_GPR(acr0, 4, ACR_OFFSET(0), nullptr, LLDB_INVALID_REGNUM),
81     DEFINE_GPR(acr1, 4, ACR_OFFSET(1), nullptr, LLDB_INVALID_REGNUM),
82     DEFINE_GPR(acr2, 4, ACR_OFFSET(2), nullptr, LLDB_INVALID_REGNUM),
83     DEFINE_GPR(acr3, 4, ACR_OFFSET(3), nullptr, LLDB_INVALID_REGNUM),
84     DEFINE_GPR(acr4, 4, ACR_OFFSET(4), nullptr, LLDB_INVALID_REGNUM),
85     DEFINE_GPR(acr5, 4, ACR_OFFSET(5), nullptr, LLDB_INVALID_REGNUM),
86     DEFINE_GPR(acr6, 4, ACR_OFFSET(6), nullptr, LLDB_INVALID_REGNUM),
87     DEFINE_GPR(acr7, 4, ACR_OFFSET(7), nullptr, LLDB_INVALID_REGNUM),
88     DEFINE_GPR(acr8, 4, ACR_OFFSET(8), nullptr, LLDB_INVALID_REGNUM),
89     DEFINE_GPR(acr9, 4, ACR_OFFSET(9), nullptr, LLDB_INVALID_REGNUM),
90     DEFINE_GPR(acr10, 4, ACR_OFFSET(10), nullptr, LLDB_INVALID_REGNUM),
91     DEFINE_GPR(acr11, 4, ACR_OFFSET(11), nullptr, LLDB_INVALID_REGNUM),
92     DEFINE_GPR(acr12, 4, ACR_OFFSET(12), nullptr, LLDB_INVALID_REGNUM),
93     DEFINE_GPR(acr13, 4, ACR_OFFSET(13), nullptr, LLDB_INVALID_REGNUM),
94     DEFINE_GPR(acr14, 4, ACR_OFFSET(14), nullptr, LLDB_INVALID_REGNUM),
95     DEFINE_GPR(acr15, 4, ACR_OFFSET(15), nullptr, LLDB_INVALID_REGNUM),
96     DEFINE_GPR(pswm, 8, 0, "flags", LLDB_REGNUM_GENERIC_FLAGS),
97     DEFINE_GPR(pswa, 8, 8, "pc", LLDB_REGNUM_GENERIC_PC),
98
99     // Floating point registers.
100     DEFINE_FPR(f0, 8, FPR_OFFSET(0)), DEFINE_FPR(f1, 8, FPR_OFFSET(1)),
101     DEFINE_FPR(f2, 8, FPR_OFFSET(2)), DEFINE_FPR(f3, 8, FPR_OFFSET(3)),
102     DEFINE_FPR(f4, 8, FPR_OFFSET(4)), DEFINE_FPR(f5, 8, FPR_OFFSET(5)),
103     DEFINE_FPR(f6, 8, FPR_OFFSET(6)), DEFINE_FPR(f7, 8, FPR_OFFSET(7)),
104     DEFINE_FPR(f8, 8, FPR_OFFSET(8)), DEFINE_FPR(f9, 8, FPR_OFFSET(9)),
105     DEFINE_FPR(f10, 8, FPR_OFFSET(10)), DEFINE_FPR(f11, 8, FPR_OFFSET(11)),
106     DEFINE_FPR(f12, 8, FPR_OFFSET(12)), DEFINE_FPR(f13, 8, FPR_OFFSET(13)),
107     DEFINE_FPR(f14, 8, FPR_OFFSET(14)), DEFINE_FPR(f15, 8, FPR_OFFSET(15)),
108     DEFINE_FPR_NODWARF(fpc, 4, 0),
109
110     // Linux operating-specific info.
111     DEFINE_GPR_NODWARF(orig_r2, 8, 16 + 16 * 8 + 16 * 4, nullptr,
112                        LLDB_INVALID_REGNUM),
113     DEFINE_GPR_NODWARF(last_break, 8, 0, nullptr, LLDB_INVALID_REGNUM),
114     DEFINE_GPR_NODWARF(system_call, 4, 0, nullptr, LLDB_INVALID_REGNUM),
115 };
116
117 static_assert((sizeof(g_register_infos_s390x) /
118                sizeof(g_register_infos_s390x[0])) == k_num_registers_s390x,
119               "g_register_infos_s390x has wrong number of register infos");
120
121 #undef GPR_OFFSET
122 #undef ACR_OFFSET
123 #undef FPR_OFFSET
124 #undef DEFINE_GPR
125 #undef DEFINE_GPR_NODWARF
126 #undef DEFINE_FPR
127 #undef DEFINE_FPR_NODWARF
128
129 #endif // DECLARE_REGISTER_INFOS_S390X_STRUCT