1 //===-- RegisterInfos_s390x.h -----------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
11 #include "llvm/Support/Compiler.h"
14 #ifdef DECLARE_REGISTER_INFOS_S390X_STRUCT
16 // Computes the offset of the given GPR in the user data area.
17 #define GPR_OFFSET(num) (16 + 8 * num)
18 // Computes the offset of the given ACR in the user data area.
19 #define ACR_OFFSET(num) (16 + 8 * 16 + 4 * num)
20 // Computes the offset of the given FPR in the extended data area.
21 #define FPR_OFFSET(num) (8 + 8 * num)
23 // RegisterKind: EHFrame, DWARF, Generic, Process Plugin, LLDB
25 #define DEFINE_GPR(name, size, offset, alt, generic) \
27 #name, alt, size, offset, eEncodingUint, eFormatHex, \
28 {dwarf_##name##_s390x, dwarf_##name##_s390x, generic, \
29 LLDB_INVALID_REGNUM, lldb_##name##_s390x }, \
33 #define DEFINE_GPR_NODWARF(name, size, offset, alt, generic) \
35 #name, alt, size, offset, eEncodingUint, eFormatHex, \
36 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, generic, \
37 LLDB_INVALID_REGNUM, lldb_##name##_s390x }, \
41 #define DEFINE_FPR(name, size, offset) \
43 #name, NULL, size, offset, eEncodingUint, eFormatHex, \
44 {dwarf_##name##_s390x, dwarf_##name##_s390x, LLDB_INVALID_REGNUM, \
45 LLDB_INVALID_REGNUM, lldb_##name##_s390x }, \
49 #define DEFINE_FPR_NODWARF(name, size, offset) \
51 #name, NULL, size, offset, eEncodingUint, eFormatHex, \
52 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
53 LLDB_INVALID_REGNUM, lldb_##name##_s390x }, \
57 static RegisterInfo g_register_infos_s390x
[] = {
58 // General purpose registers.
59 DEFINE_GPR(r0
, 8, GPR_OFFSET(0), nullptr, LLDB_INVALID_REGNUM
),
60 DEFINE_GPR(r1
, 8, GPR_OFFSET(1), nullptr, LLDB_INVALID_REGNUM
),
61 DEFINE_GPR(r2
, 8, GPR_OFFSET(2), nullptr, LLDB_REGNUM_GENERIC_ARG1
),
62 DEFINE_GPR(r3
, 8, GPR_OFFSET(3), nullptr, LLDB_REGNUM_GENERIC_ARG2
),
63 DEFINE_GPR(r4
, 8, GPR_OFFSET(4), nullptr, LLDB_REGNUM_GENERIC_ARG3
),
64 DEFINE_GPR(r5
, 8, GPR_OFFSET(5), nullptr, LLDB_REGNUM_GENERIC_ARG4
),
65 DEFINE_GPR(r6
, 8, GPR_OFFSET(6), nullptr, LLDB_REGNUM_GENERIC_ARG5
),
66 DEFINE_GPR(r7
, 8, GPR_OFFSET(7), nullptr, LLDB_INVALID_REGNUM
),
67 DEFINE_GPR(r8
, 8, GPR_OFFSET(8), nullptr, LLDB_INVALID_REGNUM
),
68 DEFINE_GPR(r9
, 8, GPR_OFFSET(9), nullptr, LLDB_INVALID_REGNUM
),
69 DEFINE_GPR(r10
, 8, GPR_OFFSET(10), nullptr, LLDB_INVALID_REGNUM
),
70 DEFINE_GPR(r11
, 8, GPR_OFFSET(11), nullptr, LLDB_REGNUM_GENERIC_FP
),
71 DEFINE_GPR(r12
, 8, GPR_OFFSET(12), nullptr, LLDB_INVALID_REGNUM
),
72 DEFINE_GPR(r13
, 8, GPR_OFFSET(13), nullptr, LLDB_INVALID_REGNUM
),
73 DEFINE_GPR(r14
, 8, GPR_OFFSET(14), nullptr, LLDB_INVALID_REGNUM
),
74 DEFINE_GPR(r15
, 8, GPR_OFFSET(15), nullptr, LLDB_REGNUM_GENERIC_SP
),
75 DEFINE_GPR(acr0
, 4, ACR_OFFSET(0), nullptr, LLDB_INVALID_REGNUM
),
76 DEFINE_GPR(acr1
, 4, ACR_OFFSET(1), nullptr, LLDB_INVALID_REGNUM
),
77 DEFINE_GPR(acr2
, 4, ACR_OFFSET(2), nullptr, LLDB_INVALID_REGNUM
),
78 DEFINE_GPR(acr3
, 4, ACR_OFFSET(3), nullptr, LLDB_INVALID_REGNUM
),
79 DEFINE_GPR(acr4
, 4, ACR_OFFSET(4), nullptr, LLDB_INVALID_REGNUM
),
80 DEFINE_GPR(acr5
, 4, ACR_OFFSET(5), nullptr, LLDB_INVALID_REGNUM
),
81 DEFINE_GPR(acr6
, 4, ACR_OFFSET(6), nullptr, LLDB_INVALID_REGNUM
),
82 DEFINE_GPR(acr7
, 4, ACR_OFFSET(7), nullptr, LLDB_INVALID_REGNUM
),
83 DEFINE_GPR(acr8
, 4, ACR_OFFSET(8), nullptr, LLDB_INVALID_REGNUM
),
84 DEFINE_GPR(acr9
, 4, ACR_OFFSET(9), nullptr, LLDB_INVALID_REGNUM
),
85 DEFINE_GPR(acr10
, 4, ACR_OFFSET(10), nullptr, LLDB_INVALID_REGNUM
),
86 DEFINE_GPR(acr11
, 4, ACR_OFFSET(11), nullptr, LLDB_INVALID_REGNUM
),
87 DEFINE_GPR(acr12
, 4, ACR_OFFSET(12), nullptr, LLDB_INVALID_REGNUM
),
88 DEFINE_GPR(acr13
, 4, ACR_OFFSET(13), nullptr, LLDB_INVALID_REGNUM
),
89 DEFINE_GPR(acr14
, 4, ACR_OFFSET(14), nullptr, LLDB_INVALID_REGNUM
),
90 DEFINE_GPR(acr15
, 4, ACR_OFFSET(15), nullptr, LLDB_INVALID_REGNUM
),
91 DEFINE_GPR(pswm
, 8, 0, nullptr, LLDB_REGNUM_GENERIC_FLAGS
),
92 DEFINE_GPR(pswa
, 8, 8, nullptr, LLDB_REGNUM_GENERIC_PC
),
94 // Floating point registers.
95 DEFINE_FPR(f0
, 8, FPR_OFFSET(0)), DEFINE_FPR(f1
, 8, FPR_OFFSET(1)),
96 DEFINE_FPR(f2
, 8, FPR_OFFSET(2)), DEFINE_FPR(f3
, 8, FPR_OFFSET(3)),
97 DEFINE_FPR(f4
, 8, FPR_OFFSET(4)), DEFINE_FPR(f5
, 8, FPR_OFFSET(5)),
98 DEFINE_FPR(f6
, 8, FPR_OFFSET(6)), DEFINE_FPR(f7
, 8, FPR_OFFSET(7)),
99 DEFINE_FPR(f8
, 8, FPR_OFFSET(8)), DEFINE_FPR(f9
, 8, FPR_OFFSET(9)),
100 DEFINE_FPR(f10
, 8, FPR_OFFSET(10)), DEFINE_FPR(f11
, 8, FPR_OFFSET(11)),
101 DEFINE_FPR(f12
, 8, FPR_OFFSET(12)), DEFINE_FPR(f13
, 8, FPR_OFFSET(13)),
102 DEFINE_FPR(f14
, 8, FPR_OFFSET(14)), DEFINE_FPR(f15
, 8, FPR_OFFSET(15)),
103 DEFINE_FPR_NODWARF(fpc
, 4, 0),
105 // Linux operating-specific info.
106 DEFINE_GPR_NODWARF(orig_r2
, 8, 16 + 16 * 8 + 16 * 4, nullptr,
107 LLDB_INVALID_REGNUM
),
108 DEFINE_GPR_NODWARF(last_break
, 8, 0, nullptr, LLDB_INVALID_REGNUM
),
109 DEFINE_GPR_NODWARF(system_call
, 4, 0, nullptr, LLDB_INVALID_REGNUM
),
112 static_assert((sizeof(g_register_infos_s390x
) /
113 sizeof(g_register_infos_s390x
[0])) == k_num_registers_s390x
,
114 "g_register_infos_s390x has wrong number of register infos");
120 #undef DEFINE_GPR_NODWARF
122 #undef DEFINE_FPR_NODWARF
124 #endif // DECLARE_REGISTER_INFOS_S390X_STRUCT