• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Capstone Disassembly Engine */
2 /* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */
3 
4 #ifdef CAPSTONE_HAS_SYSZ
5 
6 #include <stdio.h>	// debug
7 #include <string.h>
8 
9 #include "../../utils.h"
10 
11 #include "SystemZMapping.h"
12 
13 #define GET_INSTRINFO_ENUM
14 #include "SystemZGenInstrInfo.inc"
15 
16 #ifndef CAPSTONE_DIET
17 static const name_map reg_name_maps[] = {
18 	{ SYSZ_REG_INVALID, NULL },
19 
20 	{ SYSZ_REG_0, "0" },
21 	{ SYSZ_REG_1, "1" },
22 	{ SYSZ_REG_2, "2" },
23 	{ SYSZ_REG_3, "3" },
24 	{ SYSZ_REG_4, "4" },
25 	{ SYSZ_REG_5, "5" },
26 	{ SYSZ_REG_6, "6" },
27 	{ SYSZ_REG_7, "7" },
28 	{ SYSZ_REG_8, "8" },
29 	{ SYSZ_REG_9, "9" },
30 	{ SYSZ_REG_10, "10" },
31 	{ SYSZ_REG_11, "11" },
32 	{ SYSZ_REG_12, "12" },
33 	{ SYSZ_REG_13, "13" },
34 	{ SYSZ_REG_14, "14" },
35 	{ SYSZ_REG_15, "15" },
36 	{ SYSZ_REG_CC, "cc"},
37 	{ SYSZ_REG_F0, "f0" },
38 	{ SYSZ_REG_F1, "f1" },
39 	{ SYSZ_REG_F2, "f2" },
40 	{ SYSZ_REG_F3, "f3" },
41 	{ SYSZ_REG_F4, "f4" },
42 	{ SYSZ_REG_F5, "f5" },
43 	{ SYSZ_REG_F6, "f6" },
44 	{ SYSZ_REG_F7, "f7" },
45 	{ SYSZ_REG_F8, "f8" },
46 	{ SYSZ_REG_F9, "f9" },
47 	{ SYSZ_REG_F10, "f10" },
48 	{ SYSZ_REG_F11, "f11" },
49 	{ SYSZ_REG_F12, "f12" },
50 	{ SYSZ_REG_F13, "f13" },
51 	{ SYSZ_REG_F14, "f14" },
52 	{ SYSZ_REG_F15, "f15" },
53 	{ SYSZ_REG_R0L, "r0l" },
54 	{ SYSZ_REG_A0, "a0" },
55 	{ SYSZ_REG_A1, "a1" },
56 	{ SYSZ_REG_A2, "a2" },
57 	{ SYSZ_REG_A3, "a3" },
58 	{ SYSZ_REG_A4, "a4" },
59 	{ SYSZ_REG_A5, "a5" },
60 	{ SYSZ_REG_A6, "a6" },
61 	{ SYSZ_REG_A7, "a7" },
62 	{ SYSZ_REG_A8, "a8" },
63 	{ SYSZ_REG_A9, "a9" },
64 	{ SYSZ_REG_A10, "a10" },
65 	{ SYSZ_REG_A11, "a11" },
66 	{ SYSZ_REG_A12, "a12" },
67 	{ SYSZ_REG_A13, "a13" },
68 	{ SYSZ_REG_A14, "a14" },
69 	{ SYSZ_REG_A15, "a15" },
70 	{ SYSZ_REG_C0, "c0" },
71 	{ SYSZ_REG_C1, "c1" },
72 	{ SYSZ_REG_C2, "c2" },
73 	{ SYSZ_REG_C3, "c3" },
74 	{ SYSZ_REG_C4, "c4" },
75 	{ SYSZ_REG_C5, "c5" },
76 	{ SYSZ_REG_C6, "c6" },
77 	{ SYSZ_REG_C7, "c7" },
78 	{ SYSZ_REG_C8, "c8" },
79 	{ SYSZ_REG_C9, "c9" },
80 	{ SYSZ_REG_C10, "c10" },
81 	{ SYSZ_REG_C11, "c11" },
82 	{ SYSZ_REG_C12, "c12" },
83 	{ SYSZ_REG_C13, "c13" },
84 	{ SYSZ_REG_C14, "c14" },
85 	{ SYSZ_REG_C15, "c15" },
86 	{ SYSZ_REG_V0, "v0" },
87 	{ SYSZ_REG_V1, "v1" },
88 	{ SYSZ_REG_V2, "v2" },
89 	{ SYSZ_REG_V3, "v3" },
90 	{ SYSZ_REG_V4, "v4" },
91 	{ SYSZ_REG_V5, "v5" },
92 	{ SYSZ_REG_V6, "v6" },
93 	{ SYSZ_REG_V7, "v7" },
94 	{ SYSZ_REG_V8, "v8" },
95 	{ SYSZ_REG_V9, "v9" },
96 	{ SYSZ_REG_V10, "v10" },
97 	{ SYSZ_REG_V11, "v11" },
98 	{ SYSZ_REG_V12, "v12" },
99 	{ SYSZ_REG_V13, "v13" },
100 	{ SYSZ_REG_V14, "v14" },
101 	{ SYSZ_REG_V15, "v15" },
102 	{ SYSZ_REG_V16, "v16" },
103 	{ SYSZ_REG_V17, "v17" },
104 	{ SYSZ_REG_V18, "v18" },
105 	{ SYSZ_REG_V19, "v19" },
106 	{ SYSZ_REG_V20, "v20" },
107 	{ SYSZ_REG_V21, "v21" },
108 	{ SYSZ_REG_V22, "v22" },
109 	{ SYSZ_REG_V23, "v23" },
110 	{ SYSZ_REG_V24, "v24" },
111 	{ SYSZ_REG_V25, "v25" },
112 	{ SYSZ_REG_V26, "v26" },
113 	{ SYSZ_REG_V27, "v27" },
114 	{ SYSZ_REG_V28, "v28" },
115 	{ SYSZ_REG_V29, "v29" },
116 	{ SYSZ_REG_V30, "v30" },
117 	{ SYSZ_REG_V31, "v31" },
118 	{ SYSZ_REG_F16, "f16" },
119 	{ SYSZ_REG_F17, "f17" },
120 	{ SYSZ_REG_F18, "f18" },
121 	{ SYSZ_REG_F19, "f19" },
122 	{ SYSZ_REG_F20, "f20" },
123 	{ SYSZ_REG_F21, "f21" },
124 	{ SYSZ_REG_F22, "f22" },
125 	{ SYSZ_REG_F23, "f23" },
126 	{ SYSZ_REG_F24, "f24" },
127 	{ SYSZ_REG_F25, "f25" },
128 	{ SYSZ_REG_F26, "f26" },
129 	{ SYSZ_REG_F27, "f27" },
130 	{ SYSZ_REG_F28, "f28" },
131 	{ SYSZ_REG_F29, "f29" },
132 	{ SYSZ_REG_F30, "f30" },
133 	{ SYSZ_REG_F31, "f31" },
134 	{ SYSZ_REG_F0Q, "f0q" },
135 	{ SYSZ_REG_F4Q, "f4q" },
136 };
137 #endif
138 
SystemZ_reg_name(csh handle,unsigned int reg)139 const char *SystemZ_reg_name(csh handle, unsigned int reg)
140 {
141 #ifndef CAPSTONE_DIET
142 	if (reg >= ARR_SIZE(reg_name_maps))
143 		return NULL;
144 
145 	return reg_name_maps[reg].name;
146 #else
147 	return NULL;
148 #endif
149 }
150 
151 static const insn_map insns[] = {
152 	// dummy item
153 	{
154 		0, 0,
155 #ifndef CAPSTONE_DIET
156 		{ 0 }, { 0 }, { 0 }, 0, 0
157 #endif
158 	},
159 
160 #include "SystemZMappingInsn.inc"
161 };
162 
163 // given internal insn id, return public instruction info
SystemZ_get_insn_id(cs_struct * h,cs_insn * insn,unsigned int id)164 void SystemZ_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
165 {
166 	unsigned short i;
167 
168 	i = insn_find(insns, ARR_SIZE(insns), id, &h->insn_cache);
169 	if (i != 0) {
170 		insn->id = insns[i].mapid;
171 
172 		if (h->detail) {
173 #ifndef CAPSTONE_DIET
174 			memcpy(insn->detail->regs_read, insns[i].regs_use, sizeof(insns[i].regs_use));
175 			insn->detail->regs_read_count = (uint8_t)count_positive(insns[i].regs_use);
176 
177 			memcpy(insn->detail->regs_write, insns[i].regs_mod, sizeof(insns[i].regs_mod));
178 			insn->detail->regs_write_count = (uint8_t)count_positive(insns[i].regs_mod);
179 
180 			memcpy(insn->detail->groups, insns[i].groups, sizeof(insns[i].groups));
181 			insn->detail->groups_count = (uint8_t)count_positive8(insns[i].groups);
182 
183 			if (insns[i].branch || insns[i].indirect_branch) {
184 				// this insn also belongs to JUMP group. add JUMP group
185 				insn->detail->groups[insn->detail->groups_count] = SYSZ_GRP_JUMP;
186 				insn->detail->groups_count++;
187 			}
188 #endif
189 		}
190 	}
191 }
192 
193 #ifndef CAPSTONE_DIET
194 static const name_map insn_name_maps[] = {
195 	{ SYSZ_INS_INVALID, NULL },
196 
197 #include "SystemZGenInsnNameMaps.inc"
198 };
199 
200 // special alias insn
201 static const name_map alias_insn_names[] = {
202 	{ 0, NULL }
203 };
204 #endif
205 
SystemZ_insn_name(csh handle,unsigned int id)206 const char *SystemZ_insn_name(csh handle, unsigned int id)
207 {
208 #ifndef CAPSTONE_DIET
209 	unsigned int i;
210 
211 	if (id >= SYSZ_INS_ENDING)
212 		return NULL;
213 
214 	// handle special alias first
215 	for (i = 0; i < ARR_SIZE(alias_insn_names); i++) {
216 		if (alias_insn_names[i].id == id)
217 			return alias_insn_names[i].name;
218 	}
219 
220 	return insn_name_maps[id].name;
221 #else
222 	return NULL;
223 #endif
224 }
225 
226 #ifndef CAPSTONE_DIET
227 static const name_map group_name_maps[] = {
228 	// generic groups
229 	{ SYSZ_GRP_INVALID, NULL },
230 	{ SYSZ_GRP_JUMP, "jump" },
231 
232 	// architecture-specific groups
233 	{ SYSZ_GRP_DFPPACKEDCONVERSION, "dfppackedconversion" },
234 	{ SYSZ_GRP_DFPZONEDCONVERSION, "dfpzonedconversion" },
235 	{ SYSZ_GRP_DISTINCTOPS, "distinctops" },
236 	{ SYSZ_GRP_ENHANCEDDAT2, "enhanceddat2" },
237 	{ SYSZ_GRP_EXECUTIONHINT, "executionhint" },
238 	{ SYSZ_GRP_FPEXTENSION, "fpextension" },
239 	{ SYSZ_GRP_GUARDEDSTORAGE, "guardedstorage" },
240 	{ SYSZ_GRP_HIGHWORD, "highword" },
241 	{ SYSZ_GRP_INSERTREFERENCEBITSMULTIPLE, "insertreferencebitsmultiple" },
242 	{ SYSZ_GRP_INTERLOCKEDACCESS1, "interlockedaccess1" },
243 	{ SYSZ_GRP_LOADANDTRAP, "loadandtrap" },
244 	{ SYSZ_GRP_LOADANDZERORIGHTMOSTBYTE, "loadandzerorightmostbyte" },
245 	{ SYSZ_GRP_LOADSTOREONCOND, "loadstoreoncond" },
246 	{ SYSZ_GRP_LOADSTOREONCOND2, "loadstoreoncond2" },
247 	{ SYSZ_GRP_MESSAGESECURITYASSIST3, "messagesecurityassist3" },
248 	{ SYSZ_GRP_MESSAGESECURITYASSIST4, "messagesecurityassist4" },
249 	{ SYSZ_GRP_MESSAGESECURITYASSIST5, "messagesecurityassist5" },
250 	{ SYSZ_GRP_MESSAGESECURITYASSIST7, "messagesecurityassist7" },
251 	{ SYSZ_GRP_MESSAGESECURITYASSIST8, "messagesecurityassist8" },
252 	{ SYSZ_GRP_MISCELLANEOUSEXTENSIONS, "miscellaneousextensions" },
253 	{ SYSZ_GRP_MISCELLANEOUSEXTENSIONS2, "miscellaneousextensions2" },
254 	{ SYSZ_GRP_POPULATIONCOUNT, "populationcount" },
255 	{ SYSZ_GRP_PROCESSORASSIST, "processorassist" },
256 	{ SYSZ_GRP_RESETREFERENCEBITSMULTIPLE, "resetreferencebitsmultiple" },
257 	{ SYSZ_GRP_TRANSACTIONALEXECUTION, "transactionalexecution" },
258 	{ SYSZ_GRP_VECTOR, "vector" },
259 	{ SYSZ_GRP_VECTORENHANCEMENTS1, "vectorenhancements1" },
260 	{ SYSZ_GRP_VECTORPACKEDDECIMAL, "vectorpackeddecimal" },
261 };
262 #endif
263 
SystemZ_group_name(csh handle,unsigned int id)264 const char *SystemZ_group_name(csh handle, unsigned int id)
265 {
266 #ifndef CAPSTONE_DIET
267 	return id2name(group_name_maps, ARR_SIZE(group_name_maps), id);
268 #else
269 	return NULL;
270 #endif
271 }
272 
273 // map internal raw register to 'public' register
SystemZ_map_register(unsigned int r)274 sysz_reg SystemZ_map_register(unsigned int r)
275 {
276 	static const unsigned int map[] = { 0,
277 		/* SystemZ_CC = 1 */ SYSZ_REG_CC,
278 		/* SystemZ_A0 = 2 */ SYSZ_REG_A0,
279 		/* SystemZ_A1 = 3 */ SYSZ_REG_A1,
280 		/* SystemZ_A2 = 4 */ SYSZ_REG_A2,
281 		/* SystemZ_A3 = 5 */ SYSZ_REG_A3,
282 		/* SystemZ_A4 = 6 */ SYSZ_REG_A4,
283 		/* SystemZ_A5 = 7 */ SYSZ_REG_A5,
284 		/* SystemZ_A6 = 8 */ SYSZ_REG_A6,
285 		/* SystemZ_A7 = 9 */ SYSZ_REG_A7,
286 		/* SystemZ_A8 = 10 */ SYSZ_REG_A8,
287 		/* SystemZ_A9 = 11 */ SYSZ_REG_A9,
288 		/* SystemZ_A10 = 12 */ SYSZ_REG_A10,
289 		/* SystemZ_A11 = 13 */ SYSZ_REG_A11,
290 		/* SystemZ_A12 = 14 */ SYSZ_REG_A12,
291 		/* SystemZ_A13 = 15 */ SYSZ_REG_A13,
292 		/* SystemZ_A14 = 16 */ SYSZ_REG_A14,
293 		/* SystemZ_A15 = 17 */ SYSZ_REG_A15,
294 		/* SystemZ_C0 = 18 */ SYSZ_REG_C0,
295 		/* SystemZ_C1 = 19 */ SYSZ_REG_C1,
296 		/* SystemZ_C2 = 20 */ SYSZ_REG_C2,
297 		/* SystemZ_C3 = 21 */ SYSZ_REG_C3,
298 		/* SystemZ_C4 = 22 */ SYSZ_REG_C4,
299 		/* SystemZ_C5 = 23 */ SYSZ_REG_C5,
300 		/* SystemZ_C6 = 24 */ SYSZ_REG_C6,
301 		/* SystemZ_C7 = 25 */ SYSZ_REG_C7,
302 		/* SystemZ_C8 = 26 */ SYSZ_REG_C8,
303 		/* SystemZ_C9 = 27 */ SYSZ_REG_C9,
304 		/* SystemZ_C10 = 28 */ SYSZ_REG_C10,
305 		/* SystemZ_C11 = 29 */ SYSZ_REG_C11,
306 		/* SystemZ_C12 = 30 */ SYSZ_REG_C12,
307 		/* SystemZ_C13 = 31 */ SYSZ_REG_C13,
308 		/* SystemZ_C14 = 32 */ SYSZ_REG_C14,
309 		/* SystemZ_C15 = 33 */ SYSZ_REG_C15,
310 		/* SystemZ_V0 = 34 */ SYSZ_REG_V0,
311 		/* SystemZ_V1 = 35 */ SYSZ_REG_V1,
312 		/* SystemZ_V2 = 36 */ SYSZ_REG_V2,
313 		/* SystemZ_V3 = 37 */ SYSZ_REG_V3,
314 		/* SystemZ_V4 = 38 */ SYSZ_REG_V4,
315 		/* SystemZ_V5 = 39 */ SYSZ_REG_V5,
316 		/* SystemZ_V6 = 40 */ SYSZ_REG_V6,
317 		/* SystemZ_V7 = 41 */ SYSZ_REG_V7,
318 		/* SystemZ_V8 = 42 */ SYSZ_REG_V8,
319 		/* SystemZ_V9 = 43 */ SYSZ_REG_V9,
320 		/* SystemZ_V10 = 44 */ SYSZ_REG_V10,
321 		/* SystemZ_V11 = 45 */ SYSZ_REG_V11,
322 		/* SystemZ_V12 = 46 */ SYSZ_REG_V12,
323 		/* SystemZ_V13 = 47 */ SYSZ_REG_V13,
324 		/* SystemZ_V14 = 48 */ SYSZ_REG_V14,
325 		/* SystemZ_V15 = 49 */ SYSZ_REG_V15,
326 		/* SystemZ_V16 = 50 */ SYSZ_REG_V16,
327 		/* SystemZ_V17 = 51 */ SYSZ_REG_V17,
328 		/* SystemZ_V18 = 52 */ SYSZ_REG_V18,
329 		/* SystemZ_V19 = 53 */ SYSZ_REG_V19,
330 		/* SystemZ_V20 = 54 */ SYSZ_REG_V20,
331 		/* SystemZ_V21 = 55 */ SYSZ_REG_V21,
332 		/* SystemZ_V22 = 56 */ SYSZ_REG_V22,
333 		/* SystemZ_V23 = 57 */ SYSZ_REG_V23,
334 		/* SystemZ_V24 = 58 */ SYSZ_REG_V24,
335 		/* SystemZ_V25 = 59 */ SYSZ_REG_V25,
336 		/* SystemZ_V26 = 60 */ SYSZ_REG_V26,
337 		/* SystemZ_V27 = 61 */ SYSZ_REG_V27,
338 		/* SystemZ_V28 = 62 */ SYSZ_REG_V28,
339 		/* SystemZ_V29 = 63 */ SYSZ_REG_V29,
340 		/* SystemZ_V30 = 64 */ SYSZ_REG_V30,
341 		/* SystemZ_V31 = 65 */ SYSZ_REG_V31,
342 		/* SystemZ_F0D = 66 */ SYSZ_REG_F0,
343 		/* SystemZ_F1D = 67 */ SYSZ_REG_F1,
344 		/* SystemZ_F2D = 68 */ SYSZ_REG_F2,
345 		/* SystemZ_F3D = 69 */ SYSZ_REG_F3,
346 		/* SystemZ_F4D = 70 */ SYSZ_REG_F4,
347 		/* SystemZ_F5D = 71 */ SYSZ_REG_F5,
348 		/* SystemZ_F6D = 72 */ SYSZ_REG_F6,
349 		/* SystemZ_F7D = 73 */ SYSZ_REG_F7,
350 		/* SystemZ_F8D = 74 */ SYSZ_REG_F8,
351 		/* SystemZ_F9D = 75 */ SYSZ_REG_F9,
352 		/* SystemZ_F10D = 76 */ SYSZ_REG_F10,
353 		/* SystemZ_F11D = 77 */ SYSZ_REG_F11,
354 		/* SystemZ_F12D = 78 */ SYSZ_REG_F12,
355 		/* SystemZ_F13D = 79 */ SYSZ_REG_F13,
356 		/* SystemZ_F14D = 80 */ SYSZ_REG_F14,
357 		/* SystemZ_F15D = 81 */ SYSZ_REG_F15,
358 		/* SystemZ_F16D = 82 */ SYSZ_REG_F16,
359 		/* SystemZ_F17D = 83 */ SYSZ_REG_F17,
360 		/* SystemZ_F18D = 84 */ SYSZ_REG_F18,
361 		/* SystemZ_F19D = 85 */ SYSZ_REG_F19,
362 		/* SystemZ_F20D = 86 */ SYSZ_REG_F20,
363 		/* SystemZ_F21D = 87 */ SYSZ_REG_F21,
364 		/* SystemZ_F22D = 88 */ SYSZ_REG_F22,
365 		/* SystemZ_F23D = 89 */ SYSZ_REG_F23,
366 		/* SystemZ_F24D = 90 */ SYSZ_REG_F24,
367 		/* SystemZ_F25D = 91 */ SYSZ_REG_F25,
368 		/* SystemZ_F26D = 92 */ SYSZ_REG_F26,
369 		/* SystemZ_F27D = 93 */ SYSZ_REG_F27,
370 		/* SystemZ_F28D = 94 */ SYSZ_REG_F28,
371 		/* SystemZ_F29D = 95 */ SYSZ_REG_F29,
372 		/* SystemZ_F30D = 96 */ SYSZ_REG_F30,
373 		/* SystemZ_F31D = 97 */ SYSZ_REG_F31,
374 		/* SystemZ_F0Q = 98 */ SYSZ_REG_F0,
375 		/* SystemZ_F1Q = 99 */ SYSZ_REG_F1,
376 		/* SystemZ_F4Q = 100 */ SYSZ_REG_F4,
377 		/* SystemZ_F5Q = 101 */ SYSZ_REG_F5,
378 		/* SystemZ_F8Q = 102 */ SYSZ_REG_F8,
379 		/* SystemZ_F9Q = 103 */ SYSZ_REG_F9,
380 		/* SystemZ_F12Q = 104 */ SYSZ_REG_F12,
381 		/* SystemZ_F13Q = 105 */ SYSZ_REG_F13,
382 		/* SystemZ_F0S = 106 */ SYSZ_REG_F0,
383 		/* SystemZ_F1S = 107 */ SYSZ_REG_F1,
384 		/* SystemZ_F2S = 108 */ SYSZ_REG_F2,
385 		/* SystemZ_F3S = 109 */ SYSZ_REG_F3,
386 		/* SystemZ_F4S = 110 */ SYSZ_REG_F4,
387 		/* SystemZ_F5S = 111 */ SYSZ_REG_F5,
388 		/* SystemZ_F6S = 112 */ SYSZ_REG_F6,
389 		/* SystemZ_F7S = 113 */ SYSZ_REG_F7,
390 		/* SystemZ_F8S = 114 */ SYSZ_REG_F8,
391 		/* SystemZ_F9S = 115 */ SYSZ_REG_F9,
392 		/* SystemZ_F10S = 116 */ SYSZ_REG_F10,
393 		/* SystemZ_F11S = 117 */ SYSZ_REG_F11,
394 		/* SystemZ_F12S = 118 */ SYSZ_REG_F12,
395 		/* SystemZ_F13S = 119 */ SYSZ_REG_F13,
396 		/* SystemZ_F14S = 120 */ SYSZ_REG_F14,
397 		/* SystemZ_F15S = 121 */ SYSZ_REG_F15,
398 		/* SystemZ_F16S = 122 */ SYSZ_REG_F16,
399 		/* SystemZ_F17S = 123 */ SYSZ_REG_F17,
400 		/* SystemZ_F18S = 124 */ SYSZ_REG_F18,
401 		/* SystemZ_F19S = 125 */ SYSZ_REG_F19,
402 		/* SystemZ_F20S = 126 */ SYSZ_REG_F20,
403 		/* SystemZ_F21S = 127 */ SYSZ_REG_F21,
404 		/* SystemZ_F22S = 128 */ SYSZ_REG_F22,
405 		/* SystemZ_F23S = 129 */ SYSZ_REG_F23,
406 		/* SystemZ_F24S = 130 */ SYSZ_REG_F24,
407 		/* SystemZ_F25S = 131 */ SYSZ_REG_F25,
408 		/* SystemZ_F26S = 132 */ SYSZ_REG_F26,
409 		/* SystemZ_F27S = 133 */ SYSZ_REG_F27,
410 		/* SystemZ_F28S = 134 */ SYSZ_REG_F28,
411 		/* SystemZ_F29S = 135 */ SYSZ_REG_F29,
412 		/* SystemZ_F30S = 136 */ SYSZ_REG_F30,
413 		/* SystemZ_F31S = 137 */ SYSZ_REG_F31,
414 		/* SystemZ_R0D = 138 */ SYSZ_REG_0,
415 		/* SystemZ_R1D = 139 */ SYSZ_REG_1,
416 		/* SystemZ_R2D = 140 */ SYSZ_REG_2,
417 		/* SystemZ_R3D = 141 */ SYSZ_REG_3,
418 		/* SystemZ_R4D = 142 */ SYSZ_REG_4,
419 		/* SystemZ_R5D = 143 */ SYSZ_REG_5,
420 		/* SystemZ_R6D = 144 */ SYSZ_REG_6,
421 		/* SystemZ_R7D = 145 */ SYSZ_REG_7,
422 		/* SystemZ_R8D = 146 */ SYSZ_REG_8,
423 		/* SystemZ_R9D = 147 */ SYSZ_REG_9,
424 		/* SystemZ_R10D = 148 */ SYSZ_REG_10,
425 		/* SystemZ_R11D = 149 */ SYSZ_REG_11,
426 		/* SystemZ_R12D = 150 */ SYSZ_REG_12,
427 		/* SystemZ_R13D = 151 */ SYSZ_REG_13,
428 		/* SystemZ_R14D = 152 */ SYSZ_REG_14,
429 		/* SystemZ_R15D = 153 */ SYSZ_REG_15,
430 		/* SystemZ_R0H = 154 */ SYSZ_REG_0,
431 		/* SystemZ_R1H = 155 */ SYSZ_REG_1,
432 		/* SystemZ_R2H = 156 */ SYSZ_REG_2,
433 		/* SystemZ_R3H = 157 */ SYSZ_REG_3,
434 		/* SystemZ_R4H = 158 */ SYSZ_REG_4,
435 		/* SystemZ_R5H = 159 */ SYSZ_REG_5,
436 		/* SystemZ_R6H = 160 */ SYSZ_REG_6,
437 		/* SystemZ_R7H = 161 */ SYSZ_REG_7,
438 		/* SystemZ_R8H = 162 */ SYSZ_REG_8,
439 		/* SystemZ_R9H = 163 */ SYSZ_REG_9,
440 		/* SystemZ_R10H = 164 */ SYSZ_REG_10,
441 		/* SystemZ_R11H = 165 */ SYSZ_REG_11,
442 		/* SystemZ_R12H = 166 */ SYSZ_REG_12,
443 		/* SystemZ_R13H = 167 */ SYSZ_REG_13,
444 		/* SystemZ_R14H = 168 */ SYSZ_REG_14,
445 		/* SystemZ_R15H = 169 */ SYSZ_REG_15,
446 		/* SystemZ_R0L = 170 */ SYSZ_REG_0,
447 		/* SystemZ_R1L = 171 */ SYSZ_REG_1,
448 		/* SystemZ_R2L = 172 */ SYSZ_REG_2,
449 		/* SystemZ_R3L = 173 */ SYSZ_REG_3,
450 		/* SystemZ_R4L = 174 */ SYSZ_REG_4,
451 		/* SystemZ_R5L = 175 */ SYSZ_REG_5,
452 		/* SystemZ_R6L = 176 */ SYSZ_REG_6,
453 		/* SystemZ_R7L = 177 */ SYSZ_REG_7,
454 		/* SystemZ_R8L = 178 */ SYSZ_REG_8,
455 		/* SystemZ_R9L = 179 */ SYSZ_REG_9,
456 		/* SystemZ_R10L = 180 */ SYSZ_REG_10,
457 		/* SystemZ_R11L = 181 */ SYSZ_REG_11,
458 		/* SystemZ_R12L = 182 */ SYSZ_REG_12,
459 		/* SystemZ_R13L = 183 */ SYSZ_REG_13,
460 		/* SystemZ_R14L = 184 */ SYSZ_REG_14,
461 		/* SystemZ_R15L = 185 */ SYSZ_REG_15,
462 		/* SystemZ_R0Q = 186 */ SYSZ_REG_0,
463 		/* SystemZ_R2Q = 187 */ SYSZ_REG_2,
464 		/* SystemZ_R4Q = 188 */ SYSZ_REG_4,
465 		/* SystemZ_R6Q = 189 */ SYSZ_REG_6,
466 		/* SystemZ_R8Q = 190 */ SYSZ_REG_8,
467 		/* SystemZ_R10Q = 191 */ SYSZ_REG_10,
468 		/* SystemZ_R12Q = 192 */ SYSZ_REG_12,
469 		/* SystemZ_R14Q = 193 */ SYSZ_REG_14,
470 	};
471 
472 	if (r < ARR_SIZE(map))
473 		return map[r];
474 
475 	// cannot find this register
476 	return 0;
477 }
478 
479 #endif
480