libstand: gzipfs unused variable
[unleashed.git] / usr / src / cmd / geniconvtbl / disassemble.c
blob717f1f62454ad98822e8bb08ce364426a7307fd9
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright (c) 1999 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <stddef.h>
33 #include <fcntl.h>
34 #include <unistd.h>
35 #include <libintl.h>
36 #include <sys/types.h>
37 #include <sys/stat.h>
38 #include <sys/mman.h>
39 #include <errno.h>
40 #include <stdarg.h>
41 #include <string.h>
43 #include "iconv_tm.h"
44 #include "itm_util.h"
47 * function prototype
50 static itm_hdr_t *itm_attach(const char *);
51 static void dump_tables(itm_hdr_t *, itm_info_hdr_t *);
52 static void dump_direc_tbl(itm_hdr_t *, itm_place_t);
53 static void dump_map(itm_hdr_t *, itm_place_t, int);
54 static void dump_map_i_f(itm_hdr_t *, itm_place_t, int);
55 static void dump_map_l_f(itm_hdr_t *, itm_place_t, int);
56 static void dump_map_hash(itm_hdr_t *, itm_place_t, int);
57 static void dump_map_dense_enc(itm_hdr_t *, itm_place_t, int);
58 static void dump_cond_tbl(itm_hdr_t *, itm_place_t, int);
59 static void dump_op_tbl(itm_hdr_t *, itm_place_t, int);
60 static void dump_op(itm_hdr_t *, itm_place2_t);
61 static void dump_expr(itm_hdr_t *, itm_place_t);
62 static void dump_range(itm_hdr_t *, itm_place_t);
63 static void dump_escapeseq(itm_hdr_t *, itm_place_t);
65 static char *tbl_name(itm_hdr_t *, itm_tbl_hdr_t *);
66 static char *reg_name(itm_hdr_t *itm_hdr, itm_place_t op);
68 static void printi(int, char *, ...);
72 * macro definition
75 #define ADDR(place) ((void *)(((char *)(itm_hdr)) + \
76 ((itm_place2_t)((place).itm_ptr))))
77 #define DADDR(n) (((n)->size <= (sizeof ((n)->place))) ? \
78 ((char *)(&((n)->place))) :\
79 ((char *)(ADDR((n)->place))))
80 #define ADDR2(place2) ((void *)(((char *)(itm_hdr)) + \
81 ((itm_place2_t)(place2))))
82 #define INFO_HDR(pa) ((void *)(((char *)pa) + \
83 ((itm_hdr_t *)(pa))->info_hdr.itm_ptr))
86 #if defined(RESERVED_NAME_PREFIX)
87 #define RNPREF RESERVED_NAME_PREFIX
88 #else /* !defined(RESERVED_NAME_PREFIX) */
89 #define RNPREF /* null strings */
90 #endif /* !defined(RESERVED_NAME_PREFIX) */
93 void
94 disassemble(char *file)
96 itm_hdr_t *itm_hdr;
97 itm_info_hdr_t *info_hdr;
98 itm_data_t type_id;
100 TRACE_MESSAGE('d', ("disassemble %s\n", file));
102 itm_hdr = itm_attach(file);
104 if (NULL == itm_hdr) {
105 exit(3);
108 if (0 == itm_hdr->info_hdr.itm_ptr) {
109 itm_error(gettext("binarytable is stripped\n"));
110 exit(4);
113 if (0 == itm_hdr->info_hdr.itm_ptr) {
114 info_hdr = malloc_vital(sizeof (itm_info_hdr_t));
115 (void) memset(info_hdr, 0, sizeof (itm_info_hdr_t));
116 } else {
117 info_hdr = INFO_HDR(itm_hdr);
120 #if defined(ENABLE_TRACE)
121 dump_itm_header(itm_hdr, info_hdr);
122 #endif
123 printi(0, "//\n", file);
124 printi(0, "// %s\n", file);
125 printi(0, "//\n", file);
127 type_id = itm_hdr->type_id;
128 if ((NULL != cmd_opt.disassemble) &&
129 ((sizeof (itm_place_t)) < type_id.size)) {
130 type_id.place.itm_ptr += (itm_place2_t)itm_hdr;
132 printi(1, "%s {\n", name_to_str(&type_id));
133 dump_tables(itm_hdr, info_hdr);
134 printi(-1, "}\n");
137 #if defined(ENABLE_TRACE)
138 void
139 dump_itm_header(itm_hdr_t *itm_header, itm_info_hdr_t *info_header)
141 char *str_type_id;
142 char *str_interpreter;
144 itm_data_t type_id;
145 itm_data_t interpreter;
147 type_id = itm_header->type_id;
148 str_type_id = malloc_vital(itm_header->type_id.size + 1);
149 if ((NULL != cmd_opt.disassemble) &&
150 ((sizeof (itm_place_t)) < type_id.size)) {
151 type_id.place.itm_ptr += (itm_place2_t)itm_header;
153 (void) memcpy(str_type_id, name_to_str(&type_id), type_id.size + 1);
155 interpreter = itm_header->interpreter;
156 str_interpreter = malloc_vital(itm_header->interpreter.size + 1);
157 if ((NULL != cmd_opt.disassemble) &&
158 ((sizeof (itm_place_t)) < interpreter.size)) {
159 interpreter.place.itm_ptr += (itm_place2_t)itm_header;
161 (void) memcpy(str_interpreter, name_to_str(&interpreter),
162 interpreter.size + 1);
164 TRACE_MESSAGE('D',
165 ("\n"
166 "------\n"
167 "Sizeof Data Structures \n"
168 " sizeof(int) = %ld\n"
169 " sizeof(long) = %ld\n"
170 " sizeof(uintptr_t) = %ld\n"
171 " sizeof(struct itm_place_t) = %ld\n"
172 " sizeof(struct itm_data_t) = %ld\n"
173 " sizeof(struct itm_hdr_t) = %ld\n"
174 " sizeof(struct itm_place_tbl_info_t) = %ld\n"
175 " sizeof(struct itm_section_info_t) = %ld\n"
176 " sizeof(struct itm_action_type_t) = %ld\n"
177 " sizeof(struct itm_direct_t) = %ld\n"
178 " sizeof(struct itm_cond_t) = %ld\n"
179 " sizeof(struct itm_range_hdr_t) = %ld\n"
180 " sizeof(struct itm_escapeseq_hdr_t) = %ld\n"
181 " sizeof(struct itm_map_idx_fix_hdr_t) = %ld\n"
182 " sizeof(struct itm_map_lookup_hdr_t) = %ld\n"
183 " sizeof(struct itm_map_hash_hdr_t) = %ld\n"
184 " sizeof(struct itm_map_dense_enc_hdr_t) = %ld\n"
185 " sizeof(struct itm_expr_t) = %ld\n"
186 " sizeof(enum itm_op_type_t) = %ld\n"
187 " sizeof(struct itm_op_t) u= %ld\n"
188 " sizeof(enum itm_expr_type_t)= %ld\n"
189 "\n",
191 sizeof (int),
192 sizeof (long),
193 sizeof (uintptr_t),
194 sizeof (itm_place_t),
195 sizeof (itm_data_t),
196 sizeof (itm_hdr_t),
197 sizeof (itm_place_tbl_info_t),
198 sizeof (itm_section_info_t),
199 sizeof (itm_action_type_t),
200 sizeof (itm_direc_t),
201 sizeof (itm_cond_t),
202 sizeof (itm_range_hdr_t),
203 sizeof (itm_escapeseq_hdr_t),
204 sizeof (itm_map_idx_fix_hdr_t),
205 sizeof (itm_map_lookup_hdr_t),
206 sizeof (itm_map_hash_hdr_t),
207 sizeof (itm_map_dense_enc_hdr_t),
208 sizeof (itm_expr_t),
209 sizeof (itm_op_type_t),
210 sizeof (itm_op_t),
211 sizeof (itm_expr_type_t)));
213 TRACE_MESSAGE('H',
214 ("ident = %c%c%c\n"
215 "spec = %02x%02x%02x%02x\n"
216 "version = %02x%02x%02x%02x\n"
217 "itm_size = %ld\n"
218 "type_id = %s\n"
219 "interpreter = %s\n"
220 "op_init_tbl = %ld\n"
221 "op_reset_tbl = %ld\n"
222 "direc_init_tbl = %ld\n"
223 "reg_num = %ld\n"
224 "itm_hdr_size = %ld\n"
225 "info_hdr = %ld\n"
226 "info_hdr_size = %ld\n",
228 itm_header->ident[0],
229 itm_header->ident[1],
230 itm_header->ident[2],
231 /* itm_header->ident[3], */
232 itm_header->spec[0],
233 itm_header->spec[1],
234 itm_header->spec[2],
235 itm_header->spec[3],
236 itm_header->version[0],
237 itm_header->version[1],
238 itm_header->version[2],
239 itm_header->version[3],
240 itm_header->itm_size.itm_ptr,
241 str_type_id,
242 str_interpreter,
243 itm_header->op_init_tbl.itm_ptr,
244 itm_header->op_reset_tbl.itm_ptr,
245 itm_header->direc_init_tbl.itm_ptr,
246 itm_header->reg_num,
247 itm_header->itm_hdr_size,
248 itm_header->info_hdr.itm_ptr,
249 (sizeof (itm_info_hdr_t))));
251 TRACE_MESSAGE('H',
252 (" str_sec = (%4ld %4ld %4ld) "
253 " str_plc_tbl = (%4ld %4ld %4ld)\n"
254 "direc_sec_tbl = (%4ld %4ld %4ld) "
255 "direc_plc_tbl = (%4ld %4ld %4ld)\n"
256 " cond_sec_tbl = (%4ld %4ld %4ld) "
257 " cond_plc_tbl = (%4ld %4ld %4ld)\n"
258 " map_sec_tbl = (%4ld %4ld %4ld) "
259 " map_plc_tbl = (%4ld %4ld %4ld)\n"
260 " op_sec_tbl = (%4ld %4ld %4ld) "
261 " op_plc_tbl = (%4ld %4ld %4ld)\n"
262 "range_sec_tbl = (%4ld %4ld %4ld) "
263 "range_plc_tbl = (%4ld %4ld %4ld)\n"
264 "escsq_sec_tbl = (%4ld %4ld %4ld) "
265 "escsq_plc_tbl = (%4ld %4ld %4ld)\n"
266 " data_sec = (%4ld %4ld %4ld) "
267 " data_plc_tbl = (%4ld %4ld %4ld)\n"
268 " name_sec = (%4ld %4ld %4ld) "
269 " name_plc_tbl = (%4ld %4ld %4ld)\n"
271 " reg_plc_tbl = (%4ld %4ld %4ld)\n"
272 "%s\n",
273 info_header->str_sec.place.itm_ptr,
274 info_header->str_sec.size,
275 info_header->str_sec.number,
276 info_header->str_plc_tbl.place.itm_ptr,
277 info_header->str_plc_tbl.size,
278 info_header->str_plc_tbl.number,
279 info_header->direc_tbl_sec.place.itm_ptr,
280 info_header->direc_tbl_sec.size,
281 info_header->direc_tbl_sec.number,
282 info_header->direc_plc_tbl.place.itm_ptr,
283 info_header->direc_plc_tbl.size,
284 info_header->direc_plc_tbl.number,
285 info_header->cond_tbl_sec.place.itm_ptr,
286 info_header->cond_tbl_sec.size,
287 info_header->cond_tbl_sec.number,
288 info_header->cond_plc_tbl.place.itm_ptr,
289 info_header->cond_plc_tbl.size,
290 info_header->cond_plc_tbl.number,
291 info_header->map_tbl_sec.place.itm_ptr,
292 info_header->map_tbl_sec.size,
293 info_header->map_tbl_sec.number,
294 info_header->map_plc_tbl.place.itm_ptr,
295 info_header->map_plc_tbl.size,
296 info_header->map_plc_tbl.number,
297 info_header->op_tbl_sec.place.itm_ptr,
298 info_header->op_tbl_sec.size,
299 info_header->op_tbl_sec.number,
300 info_header->op_plc_tbl.place.itm_ptr,
301 info_header->op_plc_tbl.size,
302 info_header->op_plc_tbl.number,
303 info_header->range_tbl_sec.place.itm_ptr,
304 info_header->range_tbl_sec.size,
305 info_header->range_tbl_sec.number,
306 info_header->range_plc_tbl.place.itm_ptr,
307 info_header->range_plc_tbl.size,
308 info_header->range_plc_tbl.number,
309 info_header->escapeseq_tbl_sec.place.itm_ptr,
310 info_header->escapeseq_tbl_sec.size,
311 info_header->escapeseq_tbl_sec.number,
312 info_header->escapeseq_plc_tbl.place.itm_ptr,
313 info_header->escapeseq_plc_tbl.size,
314 info_header->escapeseq_plc_tbl.number,
315 info_header->data_sec.place.itm_ptr,
316 info_header->data_sec.size,
317 info_header->data_sec.number,
318 info_header->data_plc_tbl.place.itm_ptr,
319 info_header->data_plc_tbl.size,
320 info_header->data_plc_tbl.number,
321 info_header->name_sec.place.itm_ptr,
322 info_header->name_sec.size,
323 info_header->name_sec.number,
324 info_header->name_plc_tbl.place.itm_ptr,
325 info_header->name_plc_tbl.size,
326 info_header->name_plc_tbl.number,
327 info_header->reg_plc_tbl.place.itm_ptr,
328 info_header->reg_plc_tbl.size,
329 info_header->reg_plc_tbl.number,
330 "--------"));
332 #endif
335 * Dump tables
337 static void
338 dump_tables(itm_hdr_t *itm_hdr, itm_info_hdr_t *info_hdr)
340 itm_num_t n;
341 itm_data_t *data;
342 itm_place_t *place;
343 itm_place2_t place2;
344 itm_data_t d;
346 data = (itm_data_t *)(ADDR(info_hdr->reg_plc_tbl.place));
347 for (n = 0; n < info_hdr->reg_plc_tbl.number; n++, data += 1) {
348 d = *(data);
349 if ((sizeof (itm_place_t)) < d.size) {
350 d.place.itm_ptr = (itm_place2_t)ADDR(d.place);
352 printi(0, "// register: %s\n", name_to_str(&d));
355 data = (itm_data_t *)(ADDR(info_hdr->name_plc_tbl.place));
356 for (n = 0, place2 = info_hdr->name_plc_tbl.place.itm_ptr;
357 n < info_hdr->name_plc_tbl.number;
358 n++, data += 1, place2 += sizeof (itm_data_t)) {
359 d = *(data);
361 if ((sizeof (itm_place_t)) < d.size) {
362 d.place.itm_ptr = (itm_place2_t)ADDR(d.place);
364 TRACE_MESSAGE('p', ("(*)name=%ld",
365 ((sizeof (itm_place_t)) < d.size) ?
366 d.place.itm_ptr:
367 (place2 + offsetof(itm_data_t, place))));
368 printi(0, "// name: %s\n", name_to_str(&d));
372 place = (itm_place_t *)(ADDR(info_hdr->cond_plc_tbl.place));
373 for (n = 0; n < info_hdr->cond_plc_tbl.number; n++, place += 1) {
374 dump_cond_tbl(itm_hdr, *place, 1);
376 place = (itm_place_t *)(ADDR(info_hdr->map_plc_tbl.place));
377 for (n = 0; n < info_hdr->map_plc_tbl.number;
378 n++, place += 1) {
379 dump_map(itm_hdr, *place, 1);
381 place = (itm_place_t *)(ADDR(info_hdr->op_plc_tbl.place));
382 for (n = 0; n < info_hdr->op_plc_tbl.number;
383 n++, place += 1) {
384 dump_op_tbl(itm_hdr, *place, 1);
386 place = (itm_place_t *)(ADDR(info_hdr->direc_plc_tbl.place));
387 for (n = 0; n < info_hdr->direc_plc_tbl.number; n++, place += 1) {
388 dump_direc_tbl(itm_hdr, *place);
394 * Dump direction
396 static void
397 dump_direc_tbl(itm_hdr_t *itm_hdr, itm_place_t direc_place)
399 itm_tbl_hdr_t *direc_hdr;
400 itm_direc_t *direc;
401 itm_type_t type;
402 long i;
403 char *name;
405 direc_hdr = (itm_tbl_hdr_t *)ADDR(direc_place);
406 direc = (itm_direc_t *)(direc_hdr + 1);
408 TRACE_MESSAGE('p', ("(&)direc=%ld ", direc_place.itm_ptr));
410 printi(1, RNPREF "direction");
411 if (0 != direc_hdr->name.itm_ptr) {
412 name = tbl_name(itm_hdr, direc_hdr);
413 if (NULL != name) {
414 printi(0, " %s", name);
417 printi(0, " {\n");
419 for (i = 0; i < direc_hdr->number; i++, direc++) {
420 dump_cond_tbl(itm_hdr, direc->condition, 0);
422 printi(0, "\t");
424 type = (ITM_TBL_MASK &
425 (((itm_tbl_hdr_t *)(ADDR(direc->action)))->type));
427 if (ITM_TBL_OP == type) {
428 dump_op_tbl(itm_hdr, direc->action, 0);
429 } else if (ITM_TBL_DIREC == type) {
430 printi(0, "direction: action: %ld\n",
431 direc->action.itm_ptr);
432 } else if (ITM_TBL_MAP == type) {
433 dump_map(itm_hdr, direc->action, 0);
434 } else {
435 printi(0, RNPREF
436 "error ELIBBAD // unknown operation (%lx)\n",
437 type);
441 printi(-1, "};\n");
445 static void
446 dump_map(itm_hdr_t *itm_hdr, itm_place_t map_place, int standalone)
448 itm_tbl_hdr_t *tbl_hdr;
450 tbl_hdr = (itm_tbl_hdr_t *)ADDR(map_place);
452 switch (tbl_hdr->type) {
453 case ITM_TBL_MAP_INDEX_FIXED_1_1:
454 case ITM_TBL_MAP_INDEX_FIXED:
455 dump_map_i_f(itm_hdr, map_place, standalone);
456 break;
457 case ITM_TBL_MAP_LOOKUP:
458 dump_map_l_f(itm_hdr, map_place, standalone);
459 break;
460 case ITM_TBL_MAP_HASH:
461 dump_map_hash(itm_hdr, map_place, standalone);
462 break;
463 case ITM_TBL_MAP_DENSE_ENC:
464 dump_map_dense_enc(itm_hdr, map_place, standalone);
465 break;
466 default:
467 break;
473 * Dump map-indexed-fixed
475 static void
476 dump_map_i_f(itm_hdr_t *itm_hdr, itm_place_t map_place, int standalone)
478 itm_tbl_hdr_t *tbl_hdr;
479 itm_map_idx_fix_hdr_t *map_hdr;
480 itm_num_t i;
481 itm_num_t j;
482 unsigned char *p;
483 unsigned char *map_error;
484 char *name;
485 int error_flag;
487 TRACE_MESSAGE('d', ("dump_map_i_f\n"));
489 tbl_hdr = (itm_tbl_hdr_t *)ADDR(map_place);
490 map_hdr = (itm_map_idx_fix_hdr_t *)(tbl_hdr + 1);
492 if (0 < map_hdr->error_num) {
493 p = (unsigned char *)(map_hdr + 1);
494 map_error = p + (map_hdr->result_len * (tbl_hdr->number));
495 if (0 == map_hdr->default_error) {
496 map_error += map_hdr->result_len;
498 } else if (1 == map_hdr->default_error) {
499 p = (unsigned char *)(map_hdr + 1);
500 map_error = p + (map_hdr->result_len * (tbl_hdr->number));
501 } else {
502 map_error = NULL;
505 if ((standalone) &&
506 (0 == tbl_hdr->name.itm_ptr) &&
507 (map_place.itm_ptr != itm_hdr->direc_init_tbl.itm_ptr)) {
508 return;
511 TRACE_MESSAGE('p', ("(&)map=%ld ", map_place.itm_ptr));
513 if (0 == tbl_hdr->name.itm_ptr) {
514 name = NULL;
515 } else {
516 name = tbl_name(itm_hdr, tbl_hdr);
519 if ((0 == standalone) && (0 != tbl_hdr->name.itm_ptr)) {
520 if (NULL != name) {
521 printi(0, "%s;\n", name);
522 } else {
523 printi(0, RNPREF "unknown;\n", name);
525 return;
526 } else {
527 printi(1, RNPREF "map");
528 if (NULL != name) {
529 printi(0, " %s", name);
531 printi(0, " {\n");
534 printi(0, "// simple indexed map\n");
535 printi(0, "// source_len=%ld result_len=%ld\n",
536 map_hdr->source_len, map_hdr->result_len);
537 printi(0, "// start=0x%p end=0x%p\n", /* DO NOT CHANGE to %ld */
538 map_hdr->start.itm_ptr, map_hdr->end.itm_ptr);
539 if (0 < map_hdr->error_num) {
540 printi(0, "// error_num=%ld\n",
541 map_hdr->error_num);
543 if (0 == map_hdr->default_error) {
544 p = (((unsigned char *)(map_hdr + 1)) +
545 (map_hdr->result_len *
546 (map_hdr->end.itm_ptr - map_hdr->start.itm_ptr + 1)));
547 printi(0, RNPREF "default 0x");
548 for (j = 0; j < map_hdr->result_len; j++) {
549 printi(0, "%02x", *(p + j));
551 printi(0, "\n");
552 } else if (-1 == map_hdr->default_error) {
553 printi(0, RNPREF "default\t" RNPREF "default\n");
555 error_flag = 0;
556 for (i = 0; i <= (map_hdr->end.itm_ptr - map_hdr->start.itm_ptr); i++) {
557 p = (((unsigned char *)(map_hdr + 1)) +
558 (map_hdr->result_len * i));
559 if ((NULL == map_error) ||
560 (0 == *(map_error + i))) {
561 printi(0, "0x%0*p\t",
562 (map_hdr->source_len * 2), i + map_hdr->start.itm_ptr);
563 printi(0, "0x");
564 for (j = 0; j < map_hdr->result_len; j++) {
565 printi(0, "%02x", *(p + j));
567 error_flag = 0;
568 printi(0, "\n");
569 } else if (0 >= map_hdr->default_error) {
570 if (0 == error_flag) {
571 printi(0, "0x%0*p\t",
572 (map_hdr->source_len * 2),
573 i + map_hdr->start.itm_ptr);
574 printi(0, "error\n");
575 error_flag = 1;
576 } else if (error_flag == 1) {
577 printi(0, " :\t:\n");
578 error_flag = 2;
582 printi(-1, "};\n");
587 * Dump map-lookup-fixed
589 static void
590 dump_map_l_f(itm_hdr_t *itm_hdr, itm_place_t map_place, int standalone)
592 itm_tbl_hdr_t *tbl_hdr;
593 itm_map_lookup_hdr_t *map_hdr;
594 itm_num_t i;
595 itm_num_t j;
596 unsigned char *p;
597 char *name;
599 TRACE_MESSAGE('d', ("dump_map_l_f\n"));
601 tbl_hdr = (itm_tbl_hdr_t *)ADDR(map_place);
602 map_hdr = (itm_map_lookup_hdr_t *)(tbl_hdr + 1);
604 if ((standalone) &&
605 (0 == tbl_hdr->name.itm_ptr) &&
606 (map_place.itm_ptr != itm_hdr->direc_init_tbl.itm_ptr)) {
607 return;
610 TRACE_MESSAGE('p', ("(&)map=%ld ", map_place.itm_ptr));
612 if (0 == tbl_hdr->name.itm_ptr) {
613 name = NULL;
614 } else {
615 name = tbl_name(itm_hdr, tbl_hdr);
618 if ((0 == standalone) && (0 != tbl_hdr->name.itm_ptr)) {
619 if (NULL != name) {
620 printi(0, "%s;\n", name);
621 } else {
622 printi(0, RNPREF "unknown;\n", name);
624 return;
625 } else {
626 printi(1, RNPREF "map");
627 if (NULL != name) {
628 printi(0, " %s", name);
630 printi(0, " {\n");
633 printi(0, "// binary search map\n");
634 printi(0, "// source_len=%ld result_len=%ld\n",
635 map_hdr->source_len, map_hdr->result_len);
636 if (0 < map_hdr->error_num) {
637 printi(0, "// error_num=%ld\n",
638 map_hdr->error_num);
641 if (0 == map_hdr->default_error) {
642 printi(0, RNPREF "default\t0x");
643 p = ((unsigned char *)(map_hdr + 1) +
644 (tbl_hdr->number *
645 (map_hdr->source_len + map_hdr->result_len + 1)) +
646 map_hdr->source_len + 1);
647 for (j = 0; j < map_hdr->result_len; j++, p++) {
648 printi(0, "%02x", *p);
650 printi(0, "\n");
651 } else if (-1 == map_hdr->default_error) {
652 printi(0, RNPREF "default\t" RNPREF "default\n");
654 p = (unsigned char *)(map_hdr + 1);
655 for (i = 0; i < tbl_hdr->number; i++) {
656 printi(0, "0x");
657 for (j = 0; j < map_hdr->source_len; j++, p++) {
658 printi(0, "%02x", *p);
661 if (0 != (*p)) {
662 p += map_hdr->result_len + 1;
663 printi(0, "\terror");
664 } else {
665 p++;
666 printi(0, "\t0x");
667 for (j = 0; j < map_hdr->result_len; j++, p++) {
668 printi(0, "%02x", *p);
671 printi(0, "\n");
673 printi(-1, "};\n");
677 * Dump map-hash
679 static void
680 dump_map_hash(itm_hdr_t *itm_hdr, itm_place_t map_place, int standalone)
682 itm_tbl_hdr_t *tbl_hdr;
683 itm_map_hash_hdr_t *map_hdr;
684 itm_num_t i;
685 itm_num_t j;
686 unsigned char *p;
687 unsigned char *map_hash;
688 unsigned char *map_error;
689 char *name;
691 TRACE_MESSAGE('d', ("dump_map_hash\n"));
693 tbl_hdr = (itm_tbl_hdr_t *)ADDR(map_place);
694 map_hdr = (itm_map_hash_hdr_t *)(tbl_hdr + 1);
695 map_error = (unsigned char *)(map_hdr + 1);
696 map_hash = (map_error + map_hdr->hash_tbl_num);
698 if ((standalone) &&
699 (0 == tbl_hdr->name.itm_ptr) &&
700 (map_place.itm_ptr != itm_hdr->direc_init_tbl.itm_ptr)) {
701 return;
704 TRACE_MESSAGE('p', ("(&)map=%ld ", map_place.itm_ptr));
706 if (0 == tbl_hdr->name.itm_ptr) {
707 name = NULL;
708 } else {
709 name = tbl_name(itm_hdr, tbl_hdr);
712 if ((0 == standalone) && (0 != tbl_hdr->name.itm_ptr)) {
713 if (NULL != name) {
714 printi(0, "%s;\n", name);
715 } else {
716 printi(0, RNPREF "unknown;\n", name);
718 return;
719 } else {
720 printi(1, RNPREF "map");
721 if (NULL != name) {
722 printi(0, " %s", name);
724 printi(0, " {\n");
727 printi(0, "// hashed map\n");
728 printi(0, "// number=%ld\n",
729 tbl_hdr->number);
730 printi(0, "// source_len=%ld result_len=%ld\n",
731 map_hdr->source_len, map_hdr->result_len);
732 printi(0, "// hash_tbl_size=%ld hash_of_size=%ld hash_of_num=%ld\n",
733 map_hdr->hash_tbl_size,
734 map_hdr->hash_of_size, map_hdr->hash_of_num);
735 if (0 < map_hdr->error_num) {
736 printi(0, "// error_num=%ld\n",
737 map_hdr->error_num);
741 if (0 == map_hdr->default_error) {
742 printi(0, RNPREF "default\t0x");
743 p = map_hash + map_hdr->hash_tbl_size +
744 map_hdr->hash_of_size;
745 for (j = 0; j < map_hdr->result_len; j++, p++) {
746 printi(0, "%02x", *p);
748 printi(0, "\n");
749 } else if (-1 == map_hdr->default_error) {
750 printi(0, RNPREF "default\t" RNPREF "default\n");
752 p = map_hash;
753 TRACE_MESSAGE('d', ("dump_map_hash: %ld %ld\n",
754 tbl_hdr->number, map_hdr->hash_of_num));
755 for (i = 0; i < map_hdr->hash_tbl_num; i++) {
756 TRACE_MESSAGE('d', ("dump_map_hash: %x (0x%08p)\n", *p, p));
757 if (0 == *(map_error + i)) {
758 p += (map_hdr->source_len + 1 + map_hdr->result_len);
759 continue;
761 printi(0, "0x");
762 for (j = 0; j < map_hdr->source_len; j++, p++) {
763 printi(0, "%02x", *p);
766 if (0 != (*p)) {
767 p += map_hdr->result_len + 1;
768 printi(0, "\terror");
769 } else {
770 p++;
771 printi(0, "\t0x");
772 for (j = 0; j < map_hdr->result_len; j++, p++) {
773 printi(0, "%02x", *p);
776 printi(0, "\n");
778 printi(0, "// of table\n");
779 for (i = 0; i < map_hdr->hash_of_num; i++) {
780 printi(0, "0x");
781 for (j = 0; j < map_hdr->source_len; j++, p++) {
782 printi(0, "%02x", *p);
784 if (0 != (*p)) {
785 p += map_hdr->result_len + 1;
786 printi(0, "\terror\n");
787 } else {
788 p++;
789 printi(0, "\t0x");
790 for (j = 0; j < map_hdr->result_len; j++, p++) {
791 printi(0, "%02x", *p);
793 printi(0, "\n");
796 printi(-1, "};\n");
801 * Dump map-dense-encoding
803 static void
804 dump_map_dense_enc(itm_hdr_t *itm_hdr, itm_place_t map_place, int standalone)
806 itm_tbl_hdr_t *tbl_hdr;
807 itm_map_dense_enc_hdr_t *map_hdr;
808 itm_num_t i;
809 itm_num_t j;
810 unsigned char *p;
811 unsigned char *map_ptr;
812 unsigned char *map_error;
813 unsigned char *byte_seq_min;
814 unsigned char *byte_seq_max;
815 char *name;
816 int error_flag;
818 TRACE_MESSAGE('d', ("dump_map_dense_enc\n"));
820 tbl_hdr = (itm_tbl_hdr_t *)ADDR(map_place);
821 map_hdr = (itm_map_dense_enc_hdr_t *)(tbl_hdr + 1);
822 map_ptr = ((unsigned char *)(map_hdr + 1) +
823 map_hdr->source_len + map_hdr->source_len);
825 if (0 < map_hdr->error_num) {
826 map_error = (map_ptr +
827 (tbl_hdr->number * map_hdr->result_len));
828 if (0 == map_hdr->default_error) {
829 map_error += map_hdr->result_len;
831 } else if (1 == map_hdr->default_error) {
832 map_error = (map_ptr +
833 (tbl_hdr->number * map_hdr->result_len));
834 } else {
835 map_error = NULL;
837 byte_seq_min = (unsigned char *)(map_hdr + 1);
838 byte_seq_max = byte_seq_min + map_hdr->source_len;
840 if ((standalone) &&
841 (0 == tbl_hdr->name.itm_ptr) &&
842 (map_place.itm_ptr != itm_hdr->direc_init_tbl.itm_ptr)) {
843 return;
846 TRACE_MESSAGE('p', ("(&)map=%ld ", map_place.itm_ptr));
848 if (0 == tbl_hdr->name.itm_ptr) {
849 name = NULL;
850 } else {
851 name = tbl_name(itm_hdr, tbl_hdr);
854 if ((0 == standalone) && (0 != tbl_hdr->name.itm_ptr)) {
855 if (NULL != name) {
856 printi(0, "%s;\n", name);
857 } else {
858 printi(0, RNPREF "unknown;\n", name);
860 return;
861 } else {
862 printi(1, RNPREF "map");
863 if (NULL != name) {
864 printi(0, " %s", name);
866 printi(0, " {\n");
869 printi(0, "// dense encoded map\n");
870 printi(0, "// entry_number=%ld\n", tbl_hdr->number);
871 printi(0, "// source_len=%ld result_len=%ld\n",
872 map_hdr->source_len, map_hdr->result_len);
873 printi(0, "// byte_seq_min=0x");
874 p = byte_seq_min;
875 for (i = 0; i < map_hdr->source_len; i++, p++) {
876 printi(0, "%02x", *p);
878 printi(0, "\n");
879 printi(0, "// byte_seq_max=0x");
880 p = byte_seq_max;
881 for (i = 0; i < map_hdr->source_len; i++, p++) {
882 printi(0, "%02x", *p);
884 printi(0, "\n");
885 if (0 < map_hdr->error_num) {
886 printi(0, "// error_num=%ld\n",
887 map_hdr->error_num);
889 if (0 == map_hdr->default_error) {
890 p = (map_ptr + (tbl_hdr->number * map_hdr->result_len));
891 printi(0, RNPREF "default 0x");
892 for (j = 0; j < map_hdr->result_len; j++) {
893 printi(0, "%02x", *(p + j));
895 printi(0, "\n");
896 } else if (-1 == map_hdr->default_error) {
897 printi(0, RNPREF "default\t" RNPREF "default\n");
900 error_flag = 0;
901 for (i = 0, p = map_ptr; i < tbl_hdr->number;
902 i++, p += map_hdr->result_len) {
903 if ((NULL == map_error) || (0 == *(map_error + i))) {
904 printi(0, "%s\t",
905 dense_enc_index_to_byte_seq(
906 i, map_hdr->source_len,
907 byte_seq_min, byte_seq_max));
908 printi(0, "0x");
909 for (j = 0; j < map_hdr->result_len; j++) {
910 printi(0, "%02x", *(p + j));
912 printi(0, "\n");
913 error_flag = 0;
914 } else if (0 >= map_hdr->default_error) {
915 if (0 == error_flag) {
916 printi(0, "%s\t",
917 dense_enc_index_to_byte_seq(
918 i, map_hdr->source_len,
919 byte_seq_min, byte_seq_max));
920 printi(0, "error\n");
921 error_flag = 1;
922 } else if (error_flag == 1) {
923 printi(0, " :\t:\n");
924 error_flag = 2;
928 printi(-1, "};\n");
933 * Evaluate condition table
935 static void
936 dump_cond_tbl(itm_hdr_t *itm_hdr, itm_place_t cond_place, int standalone)
938 itm_tbl_hdr_t *cond_hdr;
939 itm_cond_t *cond;
940 long i;
941 char *name;
943 TRACE_MESSAGE('p', ("(&)cond_tbl=%ld ", cond_place.itm_ptr));
944 cond_hdr = (itm_tbl_hdr_t *)(ADDR(cond_place));
945 cond = (itm_cond_t *)(cond_hdr + 1);
947 if ((standalone) && (0 == cond_hdr->name.itm_ptr)) {
948 TRACE_MESSAGE('t', ("skip condition(%d, %ld)\n",
949 standalone, cond_hdr->name.itm_ptr));
950 return;
953 if (0 == cond_place.itm_ptr) {
954 printi(0, RNPREF "true");
955 return;
958 if (0 == cond_hdr->name.itm_ptr) {
959 name = NULL;
960 } else {
961 name = tbl_name(itm_hdr, cond_hdr);
964 if ((0 == standalone) && (0 != cond_hdr->name.itm_ptr)) {
965 if (NULL != name) {
966 printi(0, "%s", name);
967 } else {
968 printi(0, RNPREF "unknown");
970 return;
971 } else {
972 printi(1, RNPREF "condition");
973 if (NULL != name) {
974 printi(0, " %s", name);
976 printi(0, " {\n");
979 for (i = 0; i < cond_hdr->number; i++, cond++) {
980 switch (cond->type) {
981 case ITM_COND_BETWEEN:
982 dump_range(itm_hdr, cond->operand.place);
983 break;
984 case ITM_COND_EXPR:
985 dump_expr(itm_hdr, cond->operand.place);
986 printi(0, ";\n");
987 break;
988 case ITM_COND_ESCAPESEQ:
989 dump_escapeseq(itm_hdr, cond->operand.place);
990 break;
991 default:
992 printi(0, "// unknown %d\n", cond->type);
993 break;
997 if (standalone) {
998 printi(-1, "};\n");
999 } else {
1000 printi(-1, "}");
1006 * Dump operation table
1008 static void
1009 dump_op_tbl(itm_hdr_t *itm_hdr, itm_place_t op_tbl_place, int standalone)
1011 itm_tbl_hdr_t *op_hdr;
1012 itm_op_t *operation;
1013 itm_place2_t op_place;
1014 long i;
1015 char *name;
1016 static int op_tbl_level;
1018 op_hdr = (itm_tbl_hdr_t *)(ADDR(op_tbl_place));
1019 operation = (itm_op_t *)(op_hdr + 1);
1020 TRACE_MESSAGE('p', ("(&)op_tbl=%ld ", op_tbl_place));
1022 name = tbl_name(itm_hdr, op_hdr);
1024 if ((standalone) && (NULL == name))
1025 return;
1027 if (0 == op_tbl_level) {
1028 if ((0 == standalone) && (0 != op_hdr->name.itm_ptr)) {
1029 if (NULL != name) {
1030 printi(0, "%s;\n", name);
1031 } else {
1032 printi(0, RNPREF "unknown;", name);
1034 return;
1035 } else {
1036 printi(1, RNPREF "operation");
1037 if (NULL != name) {
1038 printi(0, " %s", name);
1040 printi(0, " {\n");
1044 op_tbl_level += 1;
1046 op_place = op_tbl_place.itm_ptr + (sizeof (itm_tbl_hdr_t));
1047 for (i = 0; i < op_hdr->number;
1048 i++, operation++, op_place += (sizeof (itm_op_t))) {
1049 dump_op(itm_hdr, op_place);
1052 op_tbl_level -= 1;
1054 if (0 == op_tbl_level) {
1055 printi(-1, "};\n");
1061 * Evaluate single operation
1063 static void
1064 dump_op(itm_hdr_t *itm_hdr, itm_place2_t op_place)
1066 itm_op_t *operation;
1067 itm_tbl_hdr_t *op_hdr;
1069 operation = (itm_op_t *)ADDR2(op_place);
1070 TRACE_MESSAGE('p', ("(&)op=%ld ", op_place));
1072 switch (operation->type) {
1073 case ITM_OP_EXPR:
1074 dump_expr(itm_hdr, operation->data.operand[0]);
1075 printi(0, ";\n");
1076 break;
1077 case ITM_OP_ERROR:
1078 printi(0, RNPREF "error ");
1079 dump_expr(itm_hdr, operation->data.operand[0]);
1080 printi(0, ";\n");
1081 break;
1082 case ITM_OP_ERROR_D:
1083 printi(0, RNPREF "error %d;",
1084 operation->data.operand[0].itm_ptr);
1085 printi(0, "\n");
1086 break;
1087 case ITM_OP_DISCARD:
1088 printi(0, RNPREF "discard ");
1089 dump_expr(itm_hdr, operation->data.operand[0]);
1090 printi(0, ";\n");
1091 break;
1092 case ITM_OP_DISCARD_D:
1093 printi(0, RNPREF "discard %ld;\n",
1094 operation->data.operand[0].itm_ptr);
1095 break;
1096 case ITM_OP_OUT:
1097 case ITM_OP_OUT_D:
1098 case ITM_OP_OUT_R:
1099 case ITM_OP_OUT_S:
1100 case ITM_OP_OUT_INVD:
1101 printi(0, RNPREF "out = ");
1102 dump_expr(itm_hdr, operation->data.operand[0]);
1103 printi(0, ";\n");
1104 break;
1105 case ITM_OP_IF:
1106 printi(0, RNPREF "if ");
1107 dump_expr(itm_hdr, operation->data.operand[0]);
1108 printi(1, " {\n");
1109 dump_op_tbl(itm_hdr, operation->data.operand[1], 0);
1110 printi(-1, "}\n");
1111 break;
1112 case ITM_OP_IF_ELSE:
1113 printi(0, RNPREF "if ");
1114 dump_expr(itm_hdr, operation->data.operand[0]);
1115 printi(1, " {\n");
1116 dump_op_tbl(itm_hdr, operation->data.operand[1], 0);
1117 printi(-1, "} ");
1118 op_hdr = ADDR(operation->data.operand[2]);
1119 if ((1 == op_hdr->number) &&
1120 ((ITM_OP_IF_ELSE == ((itm_op_t *)(op_hdr + 1))->type) ||
1121 (ITM_OP_IF == ((itm_op_t *)(op_hdr + 1))->type))) {
1122 printi(0, RNPREF "else ");
1123 dump_op_tbl(itm_hdr, operation->data.operand[2], 0);
1124 } else {
1125 printi(1, RNPREF "else {\n");
1126 dump_op_tbl(itm_hdr, operation->data.operand[2], 0);
1127 printi(-1, "}\n");
1129 break;
1130 case ITM_OP_DIRECTION: /* switch direction */
1131 printi(0, RNPREF "direction %1$s;\n", tbl_name(itm_hdr,
1132 (itm_tbl_hdr_t *)ADDR(operation->data.operand[0])));
1133 break;
1134 case ITM_OP_MAP: /* use map */
1135 printi(0, RNPREF "map %1$s", tbl_name(itm_hdr,
1136 (itm_tbl_hdr_t *)ADDR(operation->data.operand[0])));
1137 if (0 != operation->data.operand[1].itm_ptr) {
1138 printi(0, " ");
1139 dump_expr(itm_hdr, operation->data.operand[1]);
1141 printi(0, ";\n");
1142 break;
1143 case ITM_OP_OPERATION: /* invoke operation */
1144 printi(0, RNPREF "operation %1$s;\n",
1145 tbl_name(itm_hdr,
1146 (itm_tbl_hdr_t *)ADDR(operation->data.operand[0])));
1147 break;
1148 case ITM_OP_INIT: /* invoke init operation */
1149 printi(0, RNPREF "operation " RNPREF "init;\n");
1150 break;
1151 case ITM_OP_RESET: /* invoke reset operation */
1152 printi(0, RNPREF "operation " RNPREF "reset;\n");
1153 break;
1154 case ITM_OP_BREAK: /* break */
1155 printi(0, RNPREF "break;\n");
1156 break;
1157 case ITM_OP_RETURN: /* return */
1158 printi(0, RNPREF "return;\n");
1159 break;
1160 case ITM_OP_PRINTCHR:
1161 printi(0, RNPREF "printchr ");
1162 dump_expr(itm_hdr, operation->data.operand[0]);
1163 printi(0, ";\n");
1164 break;
1165 case ITM_OP_PRINTHD:
1166 printi(0, RNPREF "printhd ");
1167 dump_expr(itm_hdr, operation->data.operand[0]);
1168 printi(0, ";\n");
1169 break;
1170 case ITM_OP_PRINTINT:
1171 printi(0, RNPREF "printint ");
1172 dump_expr(itm_hdr, operation->data.operand[0]);
1173 printi(0, ";\n");
1174 break;
1175 default:
1176 printi(0, "// unknown operation: %lx\n", operation->type);
1177 break;
1183 * Dump expression
1185 static void
1186 dump_expr(itm_hdr_t *itm_hdr, itm_place_t expr_place)
1188 itm_expr_t *expr;
1189 itm_data_t data;
1191 expr = (itm_expr_t *)ADDR(expr_place);
1192 TRACE_MESSAGE('p', ("(*)ex=%ld ", expr_place.itm_ptr));
1194 switch (expr->type) {
1195 case ITM_EXPR_NONE: /* not used */
1196 printi(0, "none");
1197 break;
1198 case ITM_EXPR_NOP: /* not used */
1199 printi(0, "NOP");
1200 break;
1201 case ITM_EXPR_NAME: /* not used */
1202 printi(0, "NAME");
1203 break;
1204 case ITM_EXPR_INT: /* integer */
1205 printi(0, "%ld", expr->data.itm_exnum);
1206 break;
1207 case ITM_EXPR_SEQ: /* byte sequence */
1208 data = expr->data.value;
1209 if ((sizeof (itm_place_t)) < data.size) {
1210 data.place.itm_ptr = (itm_place2_t)ADDR(data.place);
1212 printi(0, "0x%s", data_to_hexadecimal(&data));
1213 break;
1214 case ITM_EXPR_REG: /* register */
1215 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1216 break;
1217 case ITM_EXPR_IN_VECTOR: /* in[expr] */
1218 printi(0, RNPREF "in[");
1219 dump_expr(itm_hdr, expr->data.operand[0]);
1220 printi(0, "]");
1221 break;
1222 case ITM_EXPR_IN_VECTOR_D: /* in[num] */
1223 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1224 if (0 == expr->data.operand[0].itm_ptr) {
1225 printi(0, " // inputsize");
1227 break;
1228 case ITM_EXPR_OUT: /* out */
1229 printi(0, RNPREF "out");
1230 break;
1231 case ITM_EXPR_TRUE: /* true */
1232 printi(0, RNPREF "true");
1233 break;
1234 case ITM_EXPR_FALSE: /* false */
1235 printi(0, RNPREF "false");
1236 break;
1237 case ITM_EXPR_UMINUS: /* unary minus */
1238 printi(0, "-");
1239 dump_expr(itm_hdr, expr->data.operand[0]);
1240 break;
1241 case ITM_EXPR_PLUS: /* A + B */
1242 printi(0, "(");
1243 dump_expr(itm_hdr, expr->data.operand[0]);
1244 printi(0, " + ");
1245 dump_expr(itm_hdr, expr->data.operand[1]);
1246 printi(0, ")");
1247 break;
1248 case ITM_EXPR_PLUS_E_D: /* exprA + B */
1249 printi(0, "(");
1250 dump_expr(itm_hdr, expr->data.operand[0]);
1251 printi(0, " + ");
1252 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1253 printi(0, ")");
1254 break;
1255 case ITM_EXPR_PLUS_E_R: /* exprA + varB */
1256 printi(0, "(");
1257 dump_expr(itm_hdr, expr->data.operand[0]);
1258 printi(0, " + ");
1259 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1260 printi(0, ")");
1261 break;
1262 case ITM_EXPR_PLUS_E_INVD: /* exprA + in[B] */
1263 printi(0, "(");
1264 dump_expr(itm_hdr, expr->data.operand[0]);
1265 printi(0, " + ");
1266 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1267 printi(0, ")");
1268 break;
1269 case ITM_EXPR_PLUS_D_E: /* intA + exprB */
1270 printi(0, "(");
1271 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1272 printi(0, " + ");
1273 dump_expr(itm_hdr, expr->data.operand[1]);
1274 printi(0, ")");
1275 break;
1276 case ITM_EXPR_PLUS_D_D: /* intA + B */
1277 printi(0, "(");
1278 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1279 printi(0, " + ");
1280 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1281 printi(0, ")");
1282 break;
1283 case ITM_EXPR_PLUS_D_R: /* intA + varB */
1284 printi(0, "(");
1285 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1286 printi(0, " + ");
1287 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1288 printi(0, ")");
1289 break;
1290 case ITM_EXPR_PLUS_D_INVD: /* intA + in[B] */
1291 printi(0, "(");
1292 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1293 printi(0, " + ");
1294 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1295 printi(0, ")");
1296 break;
1297 case ITM_EXPR_PLUS_R_E: /* varA + exprB */
1298 printi(0, "(");
1299 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1300 printi(0, " + ");
1301 dump_expr(itm_hdr, expr->data.operand[1]);
1302 printi(0, ")");
1303 break;
1304 case ITM_EXPR_PLUS_R_D: /* varA + B */
1305 printi(0, "(");
1306 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1307 printi(0, " + ");
1308 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1309 printi(0, ")");
1310 break;
1311 case ITM_EXPR_PLUS_R_R: /* varA + varB */
1312 printi(0, "(");
1313 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1314 printi(0, " + ");
1315 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1316 printi(0, ")");
1317 break;
1318 case ITM_EXPR_PLUS_R_INVD: /* varA + in[B] */
1319 printi(0, "(");
1320 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1321 printi(0, " + ");
1322 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1323 printi(0, ")");
1324 break;
1325 case ITM_EXPR_PLUS_INVD_E: /* in[A] + exprB */
1326 printi(0, "(");
1327 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1328 printi(0, " + ");
1329 dump_expr(itm_hdr, expr->data.operand[1]);
1330 printi(0, ")");
1331 break;
1332 case ITM_EXPR_PLUS_INVD_D: /* in[A] + B */
1333 printi(0, "(");
1334 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1335 printi(0, " + ");
1336 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1337 printi(0, ")");
1338 break;
1339 case ITM_EXPR_PLUS_INVD_R: /* in[A] + varB */
1340 printi(0, "(");
1341 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1342 printi(0, " + ");
1343 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1344 printi(0, ")");
1345 break;
1346 case ITM_EXPR_PLUS_INVD_INVD: /* in[A] + in[B] */
1347 printi(0, "(");
1348 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1349 printi(0, " + ");
1350 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1351 printi(0, ")");
1352 break;
1353 case ITM_EXPR_MINUS: /* A - B */
1354 printi(0, "(");
1355 dump_expr(itm_hdr, expr->data.operand[0]);
1356 printi(0, " - ");
1357 dump_expr(itm_hdr, expr->data.operand[1]);
1358 printi(0, ")");
1359 break;
1360 case ITM_EXPR_MINUS_E_D: /* exprA - B */
1361 printi(0, "(");
1362 dump_expr(itm_hdr, expr->data.operand[0]);
1363 printi(0, " - ");
1364 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1365 printi(0, ")");
1366 break;
1367 case ITM_EXPR_MINUS_E_R: /* exprA - varB */
1368 printi(0, "(");
1369 dump_expr(itm_hdr, expr->data.operand[0]);
1370 printi(0, " - ");
1371 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1372 printi(0, ")");
1373 break;
1374 case ITM_EXPR_MINUS_E_INVD: /* exprA - in[B] */
1375 printi(0, "(");
1376 dump_expr(itm_hdr, expr->data.operand[0]);
1377 printi(0, " - ");
1378 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1379 printi(0, ")");
1380 break;
1381 case ITM_EXPR_MINUS_D_E: /* intA - exprB */
1382 printi(0, "(");
1383 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1384 printi(0, " - ");
1385 dump_expr(itm_hdr, expr->data.operand[1]);
1386 printi(0, ")");
1387 break;
1388 case ITM_EXPR_MINUS_D_D: /* intA - B */
1389 printi(0, "(");
1390 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1391 printi(0, " - ");
1392 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1393 printi(0, ")");
1394 break;
1395 case ITM_EXPR_MINUS_D_R: /* intA - varB */
1396 printi(0, "(");
1397 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1398 printi(0, " - ");
1399 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1400 printi(0, ")");
1401 break;
1402 case ITM_EXPR_MINUS_D_INVD: /* intA - in[B] */
1403 printi(0, "(");
1404 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1405 printi(0, " - ");
1406 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1407 printi(0, ")");
1408 break;
1409 case ITM_EXPR_MINUS_R_E: /* varA - exprB */
1410 printi(0, "(");
1411 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1412 printi(0, " - ");
1413 dump_expr(itm_hdr, expr->data.operand[1]);
1414 printi(0, ")");
1415 break;
1416 case ITM_EXPR_MINUS_R_D: /* varA - B */
1417 printi(0, "(");
1418 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1419 printi(0, " - ");
1420 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1421 printi(0, ")");
1422 break;
1423 case ITM_EXPR_MINUS_R_R: /* varA - varB */
1424 printi(0, "(");
1425 printi(0, " - ");
1426 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1427 printi(0, ")");
1428 break;
1429 case ITM_EXPR_MINUS_R_INVD: /* varA - in[B] */
1430 printi(0, "(");
1431 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1432 printi(0, " - ");
1433 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1434 printi(0, ")");
1435 break;
1436 case ITM_EXPR_MINUS_INVD_E: /* in[A] - exprB */
1437 printi(0, "(");
1438 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1439 printi(0, " - ");
1440 dump_expr(itm_hdr, expr->data.operand[1]);
1441 printi(0, ")");
1442 break;
1443 case ITM_EXPR_MINUS_INVD_D: /* in[A] - B */
1444 printi(0, "(");
1445 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1446 printi(0, " - ");
1447 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1448 printi(0, ")");
1449 break;
1450 case ITM_EXPR_MINUS_INVD_R: /* in[A] - varB */
1451 printi(0, "(");
1452 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1453 printi(0, " - ");
1454 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1455 printi(0, ")");
1456 break;
1457 case ITM_EXPR_MINUS_INVD_INVD: /* in[A] - in[B] */
1458 printi(0, "(");
1459 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1460 printi(0, " - ");
1461 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1462 printi(0, ")");
1463 break;
1464 case ITM_EXPR_MUL: /* A * B */
1465 printi(0, "(");
1466 dump_expr(itm_hdr, expr->data.operand[0]);
1467 printi(0, " * ");
1468 dump_expr(itm_hdr, expr->data.operand[1]);
1469 printi(0, ")");
1470 break;
1471 case ITM_EXPR_MUL_E_D: /* exprA * B */
1472 printi(0, "(");
1473 dump_expr(itm_hdr, expr->data.operand[0]);
1474 printi(0, " * ");
1475 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1476 printi(0, ")");
1477 break;
1478 case ITM_EXPR_MUL_E_R: /* exprA * varB */
1479 printi(0, "(");
1480 dump_expr(itm_hdr, expr->data.operand[0]);
1481 printi(0, " * ");
1482 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1483 printi(0, ")");
1484 break;
1485 case ITM_EXPR_MUL_E_INVD: /* exprA * in[B] */
1486 printi(0, "(");
1487 dump_expr(itm_hdr, expr->data.operand[0]);
1488 printi(0, " * ");
1489 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1490 printi(0, ")");
1491 break;
1492 case ITM_EXPR_MUL_D_E: /* intA * exprB */
1493 printi(0, "(");
1494 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1495 printi(0, " * ");
1496 dump_expr(itm_hdr, expr->data.operand[1]);
1497 printi(0, ")");
1498 break;
1499 case ITM_EXPR_MUL_D_D: /* intA * B */
1500 printi(0, "(");
1501 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1502 printi(0, " * ");
1503 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1504 printi(0, ")");
1505 break;
1506 case ITM_EXPR_MUL_D_R: /* intA * varB */
1507 printi(0, "(");
1508 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1509 printi(0, " * ");
1510 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1511 printi(0, ")");
1512 break;
1513 case ITM_EXPR_MUL_D_INVD: /* intA * in[B] */
1514 printi(0, "(");
1515 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1516 printi(0, " * ");
1517 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1518 printi(0, ")");
1519 break;
1520 case ITM_EXPR_MUL_R_E: /* varA * exprB */
1521 printi(0, "(");
1522 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1523 printi(0, " * ");
1524 dump_expr(itm_hdr, expr->data.operand[1]);
1525 printi(0, ")");
1526 break;
1527 case ITM_EXPR_MUL_R_D: /* varA * B */
1528 printi(0, "(");
1529 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1530 printi(0, " * ");
1531 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1532 printi(0, ")");
1533 break;
1534 case ITM_EXPR_MUL_R_R: /* varA * varB */
1535 printi(0, "(");
1536 printi(0, " * ");
1537 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1538 printi(0, ")");
1539 break;
1540 case ITM_EXPR_MUL_R_INVD: /* varA * in[B] */
1541 printi(0, "(");
1542 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1543 printi(0, " * ");
1544 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1545 printi(0, ")");
1546 break;
1547 case ITM_EXPR_MUL_INVD_E: /* in[A] * exprB */
1548 printi(0, "(");
1549 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1550 printi(0, " * ");
1551 dump_expr(itm_hdr, expr->data.operand[1]);
1552 printi(0, ")");
1553 break;
1554 case ITM_EXPR_MUL_INVD_D: /* in[A] * B */
1555 printi(0, "(");
1556 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1557 printi(0, " * ");
1558 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1559 printi(0, ")");
1560 break;
1561 case ITM_EXPR_MUL_INVD_R: /* in[A] * varB */
1562 printi(0, "(");
1563 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1564 printi(0, " * ");
1565 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1566 printi(0, ")");
1567 break;
1568 case ITM_EXPR_MUL_INVD_INVD: /* in[A] * in[B] */
1569 printi(0, "(");
1570 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1571 printi(0, " * ");
1572 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1573 printi(0, ")");
1574 break;
1575 case ITM_EXPR_DIV: /* A / B */
1576 printi(0, "(");
1577 dump_expr(itm_hdr, expr->data.operand[0]);
1578 printi(0, " / ");
1579 dump_expr(itm_hdr, expr->data.operand[1]);
1580 printi(0, ")");
1581 break;
1582 case ITM_EXPR_DIV_E_D: /* exprA / B */
1583 printi(0, "(");
1584 dump_expr(itm_hdr, expr->data.operand[0]);
1585 printi(0, " / ");
1586 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1587 printi(0, ")");
1588 break;
1589 case ITM_EXPR_DIV_E_R: /* exprA / varB */
1590 printi(0, "(");
1591 dump_expr(itm_hdr, expr->data.operand[0]);
1592 printi(0, " / ");
1593 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1594 printi(0, ")");
1595 break;
1596 case ITM_EXPR_DIV_E_INVD: /* exprA / in[B] */
1597 printi(0, "(");
1598 dump_expr(itm_hdr, expr->data.operand[0]);
1599 printi(0, " / ");
1600 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1601 printi(0, ")");
1602 break;
1603 case ITM_EXPR_DIV_D_E: /* intA / exprB */
1604 printi(0, "(");
1605 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1606 printi(0, " / ");
1607 dump_expr(itm_hdr, expr->data.operand[1]);
1608 printi(0, ")");
1609 break;
1610 case ITM_EXPR_DIV_D_D: /* intA / B */
1611 printi(0, "(");
1612 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1613 printi(0, " / ");
1614 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1615 printi(0, ")");
1616 break;
1617 case ITM_EXPR_DIV_D_R: /* intA / varB */
1618 printi(0, "(");
1619 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1620 printi(0, " / ");
1621 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1622 printi(0, ")");
1623 break;
1624 case ITM_EXPR_DIV_D_INVD: /* intA / in[B] */
1625 printi(0, "(");
1626 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1627 printi(0, " / ");
1628 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1629 printi(0, ")");
1630 break;
1631 case ITM_EXPR_DIV_R_E: /* varA / exprB */
1632 printi(0, "(");
1633 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1634 printi(0, " / ");
1635 dump_expr(itm_hdr, expr->data.operand[1]);
1636 printi(0, ")");
1637 break;
1638 case ITM_EXPR_DIV_R_D: /* varA / B */
1639 printi(0, "(");
1640 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1641 printi(0, " / ");
1642 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1643 printi(0, ")");
1644 break;
1645 case ITM_EXPR_DIV_R_R: /* varA / varB */
1646 printi(0, "(");
1647 printi(0, " / ");
1648 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1649 printi(0, ")");
1650 break;
1651 case ITM_EXPR_DIV_R_INVD: /* varA / in[B] */
1652 printi(0, "(");
1653 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1654 printi(0, " / ");
1655 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1656 printi(0, ")");
1657 break;
1658 case ITM_EXPR_DIV_INVD_E: /* in[A] / exprB */
1659 printi(0, "(");
1660 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1661 printi(0, " / ");
1662 dump_expr(itm_hdr, expr->data.operand[1]);
1663 printi(0, ")");
1664 break;
1665 case ITM_EXPR_DIV_INVD_D: /* in[A] / B */
1666 printi(0, "(");
1667 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1668 printi(0, " / ");
1669 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1670 printi(0, ")");
1671 break;
1672 case ITM_EXPR_DIV_INVD_R: /* in[A] / varB */
1673 printi(0, "(");
1674 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1675 printi(0, " / ");
1676 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1677 printi(0, ")");
1678 break;
1679 case ITM_EXPR_DIV_INVD_INVD: /* in[A] / in[B] */
1680 printi(0, "(");
1681 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1682 printi(0, " / ");
1683 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1684 printi(0, ")");
1685 break;
1686 case ITM_EXPR_MOD: /* A % B */
1687 printi(0, "(");
1688 dump_expr(itm_hdr, expr->data.operand[0]);
1689 printi(0, " %% ");
1690 dump_expr(itm_hdr, expr->data.operand[1]);
1691 printi(0, ")");
1692 break;
1693 case ITM_EXPR_MOD_E_D: /* exprA % B */
1694 printi(0, "(");
1695 dump_expr(itm_hdr, expr->data.operand[0]);
1696 printi(0, " %% ");
1697 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1698 printi(0, ")");
1699 break;
1700 case ITM_EXPR_MOD_E_R: /* exprA % varB */
1701 printi(0, "(");
1702 dump_expr(itm_hdr, expr->data.operand[0]);
1703 printi(0, " %% ");
1704 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1705 printi(0, ")");
1706 break;
1707 case ITM_EXPR_MOD_E_INVD: /* exprA % in[B] */
1708 printi(0, "(");
1709 dump_expr(itm_hdr, expr->data.operand[0]);
1710 printi(0, " %% ");
1711 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1712 printi(0, ")");
1713 break;
1714 case ITM_EXPR_MOD_D_E: /* intA % exprB */
1715 printi(0, "(");
1716 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1717 printi(0, " %% ");
1718 dump_expr(itm_hdr, expr->data.operand[1]);
1719 printi(0, ")");
1720 break;
1721 case ITM_EXPR_MOD_D_D: /* intA % B */
1722 printi(0, "(");
1723 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1724 printi(0, " %% ");
1725 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1726 printi(0, ")");
1727 break;
1728 case ITM_EXPR_MOD_D_R: /* intA % varB */
1729 printi(0, "(");
1730 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1731 printi(0, " %% ");
1732 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1733 printi(0, ")");
1734 break;
1735 case ITM_EXPR_MOD_D_INVD: /* intA % in[B] */
1736 printi(0, "(");
1737 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1738 printi(0, " %% ");
1739 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1740 printi(0, ")");
1741 break;
1742 case ITM_EXPR_MOD_R_E: /* varA % exprB */
1743 printi(0, "(");
1744 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1745 printi(0, " %% ");
1746 dump_expr(itm_hdr, expr->data.operand[1]);
1747 printi(0, ")");
1748 break;
1749 case ITM_EXPR_MOD_R_D: /* varA % B */
1750 printi(0, "(");
1751 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1752 printi(0, " %% ");
1753 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1754 printi(0, ")");
1755 break;
1756 case ITM_EXPR_MOD_R_R: /* varA % varB */
1757 printi(0, "(");
1758 printi(0, " %% ");
1759 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1760 printi(0, ")");
1761 break;
1762 case ITM_EXPR_MOD_R_INVD: /* varA % in[B] */
1763 printi(0, "(");
1764 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1765 printi(0, " %% ");
1766 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1767 printi(0, ")");
1768 break;
1769 case ITM_EXPR_MOD_INVD_E: /* in[A] % exprB */
1770 printi(0, "(");
1771 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1772 printi(0, " %% ");
1773 dump_expr(itm_hdr, expr->data.operand[1]);
1774 printi(0, ")");
1775 break;
1776 case ITM_EXPR_MOD_INVD_D: /* in[A] % B */
1777 printi(0, "(");
1778 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1779 printi(0, " %% ");
1780 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1781 printi(0, ")");
1782 break;
1783 case ITM_EXPR_MOD_INVD_R: /* in[A] % varB */
1784 printi(0, "(");
1785 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1786 printi(0, " %% ");
1787 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1788 printi(0, ")");
1789 break;
1790 case ITM_EXPR_MOD_INVD_INVD: /* in[A] % in[B] */
1791 printi(0, "(");
1792 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1793 printi(0, " %% ");
1794 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1795 printi(0, ")");
1796 break;
1797 case ITM_EXPR_SHIFT_L: /* A << B */
1798 printi(0, "(");
1799 dump_expr(itm_hdr, expr->data.operand[0]);
1800 printi(0, " << ");
1801 dump_expr(itm_hdr, expr->data.operand[1]);
1802 printi(0, ")");
1803 break;
1804 case ITM_EXPR_SHIFT_L_E_D: /* exprA << B */
1805 printi(0, "(");
1806 dump_expr(itm_hdr, expr->data.operand[0]);
1807 printi(0, " << ");
1808 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1809 printi(0, ")");
1810 break;
1811 case ITM_EXPR_SHIFT_L_E_R: /* exprA << varB */
1812 printi(0, "(");
1813 dump_expr(itm_hdr, expr->data.operand[0]);
1814 printi(0, " << ");
1815 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1816 printi(0, ")");
1817 break;
1818 case ITM_EXPR_SHIFT_L_E_INVD: /* exprA << in[B] */
1819 printi(0, "(");
1820 dump_expr(itm_hdr, expr->data.operand[0]);
1821 printi(0, " << ");
1822 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1823 printi(0, ")");
1824 break;
1825 case ITM_EXPR_SHIFT_L_D_E: /* intA << exprB */
1826 printi(0, "(");
1827 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1828 printi(0, " << ");
1829 dump_expr(itm_hdr, expr->data.operand[1]);
1830 printi(0, ")");
1831 break;
1832 case ITM_EXPR_SHIFT_L_D_D: /* intA << B */
1833 printi(0, "(");
1834 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1835 printi(0, " << ");
1836 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1837 printi(0, ")");
1838 break;
1839 case ITM_EXPR_SHIFT_L_D_R: /* intA << varB */
1840 printi(0, "(");
1841 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1842 printi(0, " << ");
1843 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1844 printi(0, ")");
1845 break;
1846 case ITM_EXPR_SHIFT_L_D_INVD: /* intA << in[B] */
1847 printi(0, "(");
1848 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1849 printi(0, " << ");
1850 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1851 printi(0, ")");
1852 break;
1853 case ITM_EXPR_SHIFT_L_R_E: /* varA << exprB */
1854 printi(0, "(");
1855 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1856 printi(0, " << ");
1857 dump_expr(itm_hdr, expr->data.operand[1]);
1858 printi(0, ")");
1859 break;
1860 case ITM_EXPR_SHIFT_L_R_D: /* varA << B */
1861 printi(0, "(");
1862 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1863 printi(0, " << ");
1864 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1865 printi(0, ")");
1866 break;
1867 case ITM_EXPR_SHIFT_L_R_R: /* varA << varB */
1868 printi(0, "(");
1869 printi(0, " << ");
1870 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1871 printi(0, ")");
1872 break;
1873 case ITM_EXPR_SHIFT_L_R_INVD: /* varA << in[B] */
1874 printi(0, "(");
1875 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1876 printi(0, " << ");
1877 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1878 printi(0, ")");
1879 break;
1880 case ITM_EXPR_SHIFT_L_INVD_E: /* in[A] << exprB */
1881 printi(0, "(");
1882 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1883 printi(0, " << ");
1884 dump_expr(itm_hdr, expr->data.operand[1]);
1885 printi(0, ")");
1886 break;
1887 case ITM_EXPR_SHIFT_L_INVD_D: /* in[A] << B */
1888 printi(0, "(");
1889 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1890 printi(0, " << ");
1891 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1892 printi(0, ")");
1893 break;
1894 case ITM_EXPR_SHIFT_L_INVD_R: /* in[A] << varB */
1895 printi(0, "(");
1896 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1897 printi(0, " << ");
1898 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1899 printi(0, ")");
1900 break;
1901 case ITM_EXPR_SHIFT_L_INVD_INVD: /* in[A] << in[B] */
1902 printi(0, "(");
1903 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1904 printi(0, " << ");
1905 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1906 printi(0, ")");
1907 break;
1908 case ITM_EXPR_SHIFT_R: /* A >> B */
1909 printi(0, "(");
1910 dump_expr(itm_hdr, expr->data.operand[0]);
1911 printi(0, " >> ");
1912 dump_expr(itm_hdr, expr->data.operand[1]);
1913 printi(0, ")");
1914 break;
1915 case ITM_EXPR_SHIFT_R_E_D: /* exprA >> B */
1916 printi(0, "(");
1917 dump_expr(itm_hdr, expr->data.operand[0]);
1918 printi(0, " >> ");
1919 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1920 printi(0, ")");
1921 break;
1922 case ITM_EXPR_SHIFT_R_E_R: /* exprA >> varB */
1923 printi(0, "(");
1924 dump_expr(itm_hdr, expr->data.operand[0]);
1925 printi(0, " >> ");
1926 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1927 printi(0, ")");
1928 break;
1929 case ITM_EXPR_SHIFT_R_E_INVD: /* exprA >> in[B] */
1930 printi(0, "(");
1931 dump_expr(itm_hdr, expr->data.operand[0]);
1932 printi(0, " >> ");
1933 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1934 printi(0, ")");
1935 break;
1936 case ITM_EXPR_SHIFT_R_D_E: /* intA >> exprB */
1937 printi(0, "(");
1938 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1939 printi(0, " >> ");
1940 dump_expr(itm_hdr, expr->data.operand[1]);
1941 printi(0, ")");
1942 break;
1943 case ITM_EXPR_SHIFT_R_D_D: /* intA >> B */
1944 printi(0, "(");
1945 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1946 printi(0, " >> ");
1947 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1948 printi(0, ")");
1949 break;
1950 case ITM_EXPR_SHIFT_R_D_R: /* intA >> varB */
1951 printi(0, "(");
1952 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1953 printi(0, " >> ");
1954 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
1955 printi(0, ")");
1956 break;
1957 case ITM_EXPR_SHIFT_R_D_INVD: /* intA >> in[B] */
1958 printi(0, "(");
1959 printi(0, "%ld", expr->data.operand[0].itm_ptr);
1960 printi(0, " >> ");
1961 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1962 printi(0, ")");
1963 break;
1964 case ITM_EXPR_SHIFT_R_R_E: /* varA >> exprB */
1965 printi(0, "(");
1966 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1967 printi(0, " >> ");
1968 dump_expr(itm_hdr, expr->data.operand[1]);
1969 printi(0, ")");
1970 break;
1971 case ITM_EXPR_SHIFT_R_R_D: /* varA >> B */
1972 printi(0, "(");
1973 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1974 printi(0, " >> ");
1975 printi(0, "%ld", expr->data.operand[1].itm_ptr);
1976 printi(0, ")");
1977 break;
1978 case ITM_EXPR_SHIFT_R_R_R: /* varA >> varB */
1979 printi(0, "(");
1980 printi(0, " >> ");
1981 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1982 printi(0, ")");
1983 break;
1984 case ITM_EXPR_SHIFT_R_R_INVD: /* varA >> in[B] */
1985 printi(0, "(");
1986 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
1987 printi(0, " >> ");
1988 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
1989 printi(0, ")");
1990 break;
1991 case ITM_EXPR_SHIFT_R_INVD_E: /* in[A] >> exprB */
1992 printi(0, "(");
1993 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
1994 printi(0, " >> ");
1995 dump_expr(itm_hdr, expr->data.operand[1]);
1996 printi(0, ")");
1997 break;
1998 case ITM_EXPR_SHIFT_R_INVD_D: /* in[A] >> B */
1999 printi(0, "(");
2000 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2001 printi(0, " >> ");
2002 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2003 printi(0, ")");
2004 break;
2005 case ITM_EXPR_SHIFT_R_INVD_R: /* in[A] >> varB */
2006 printi(0, "(");
2007 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2008 printi(0, " >> ");
2009 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2010 printi(0, ")");
2011 break;
2012 case ITM_EXPR_SHIFT_R_INVD_INVD: /* in[A] >> in[B] */
2013 printi(0, "(");
2014 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2015 printi(0, " >> ");
2016 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2017 printi(0, ")");
2018 break;
2019 case ITM_EXPR_OR: /* A | B */
2020 printi(0, "(");
2021 dump_expr(itm_hdr, expr->data.operand[0]);
2022 printi(0, " | ");
2023 dump_expr(itm_hdr, expr->data.operand[1]);
2024 printi(0, ")");
2025 break;
2026 case ITM_EXPR_OR_E_D: /* exprA | B */
2027 printi(0, "(");
2028 dump_expr(itm_hdr, expr->data.operand[0]);
2029 printi(0, " | ");
2030 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2031 printi(0, ")");
2032 break;
2033 case ITM_EXPR_OR_E_R: /* exprA | varB */
2034 printi(0, "(");
2035 dump_expr(itm_hdr, expr->data.operand[0]);
2036 printi(0, " | ");
2037 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2038 printi(0, ")");
2039 break;
2040 case ITM_EXPR_OR_E_INVD: /* exprA | in[B] */
2041 printi(0, "(");
2042 dump_expr(itm_hdr, expr->data.operand[0]);
2043 printi(0, " | ");
2044 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2045 printi(0, ")");
2046 break;
2047 case ITM_EXPR_OR_D_E: /* intA | exprB */
2048 printi(0, "(");
2049 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2050 printi(0, " | ");
2051 dump_expr(itm_hdr, expr->data.operand[1]);
2052 printi(0, ")");
2053 break;
2054 case ITM_EXPR_OR_D_D: /* intA | B */
2055 printi(0, "(");
2056 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2057 printi(0, " | ");
2058 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2059 printi(0, ")");
2060 break;
2061 case ITM_EXPR_OR_D_R: /* intA | varB */
2062 printi(0, "(");
2063 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2064 printi(0, " | ");
2065 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2066 printi(0, ")");
2067 break;
2068 case ITM_EXPR_OR_D_INVD: /* intA | in[B] */
2069 printi(0, "(");
2070 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2071 printi(0, " | ");
2072 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2073 printi(0, ")");
2074 break;
2075 case ITM_EXPR_OR_R_E: /* varA | exprB */
2076 printi(0, "(");
2077 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2078 printi(0, " | ");
2079 dump_expr(itm_hdr, expr->data.operand[1]);
2080 printi(0, ")");
2081 break;
2082 case ITM_EXPR_OR_R_D: /* varA | B */
2083 printi(0, "(");
2084 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2085 printi(0, " | ");
2086 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2087 printi(0, ")");
2088 break;
2089 case ITM_EXPR_OR_R_R: /* varA | varB */
2090 printi(0, "(");
2091 printi(0, " | ");
2092 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2093 printi(0, ")");
2094 break;
2095 case ITM_EXPR_OR_R_INVD: /* varA | in[B] */
2096 printi(0, "(");
2097 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2098 printi(0, " | ");
2099 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2100 printi(0, ")");
2101 break;
2102 case ITM_EXPR_OR_INVD_E: /* in[A] | exprB */
2103 printi(0, "(");
2104 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2105 printi(0, " | ");
2106 dump_expr(itm_hdr, expr->data.operand[1]);
2107 printi(0, ")");
2108 break;
2109 case ITM_EXPR_OR_INVD_D: /* in[A] | B */
2110 printi(0, "(");
2111 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2112 printi(0, " | ");
2113 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2114 printi(0, ")");
2115 break;
2116 case ITM_EXPR_OR_INVD_R: /* in[A] | varB */
2117 printi(0, "(");
2118 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2119 printi(0, " | ");
2120 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2121 printi(0, ")");
2122 break;
2123 case ITM_EXPR_OR_INVD_INVD: /* in[A] | in[B] */
2124 printi(0, "(");
2125 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2126 printi(0, " | ");
2127 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2128 printi(0, ")");
2129 break;
2130 case ITM_EXPR_XOR: /* A ^ B */
2131 printi(0, "(");
2132 dump_expr(itm_hdr, expr->data.operand[0]);
2133 printi(0, " ^ ");
2134 dump_expr(itm_hdr, expr->data.operand[1]);
2135 printi(0, ")");
2136 break;
2137 case ITM_EXPR_XOR_E_D: /* exprA ^ B */
2138 printi(0, "(");
2139 dump_expr(itm_hdr, expr->data.operand[0]);
2140 printi(0, " ^ ");
2141 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2142 printi(0, ")");
2143 break;
2144 case ITM_EXPR_XOR_E_R: /* exprA ^ varB */
2145 printi(0, "(");
2146 dump_expr(itm_hdr, expr->data.operand[0]);
2147 printi(0, " ^ ");
2148 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2149 printi(0, ")");
2150 break;
2151 case ITM_EXPR_XOR_E_INVD: /* exprA ^ in[B] */
2152 printi(0, "(");
2153 dump_expr(itm_hdr, expr->data.operand[0]);
2154 printi(0, " ^ ");
2155 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2156 printi(0, ")");
2157 break;
2158 case ITM_EXPR_XOR_D_E: /* intA ^ exprB */
2159 printi(0, "(");
2160 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2161 printi(0, " ^ ");
2162 dump_expr(itm_hdr, expr->data.operand[1]);
2163 printi(0, ")");
2164 break;
2165 case ITM_EXPR_XOR_D_D: /* intA ^ B */
2166 printi(0, "(");
2167 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2168 printi(0, " ^ ");
2169 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2170 printi(0, ")");
2171 break;
2172 case ITM_EXPR_XOR_D_R: /* intA ^ varB */
2173 printi(0, "(");
2174 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2175 printi(0, " ^ ");
2176 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2177 printi(0, ")");
2178 break;
2179 case ITM_EXPR_XOR_D_INVD: /* intA ^ in[B] */
2180 printi(0, "(");
2181 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2182 printi(0, " ^ ");
2183 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2184 printi(0, ")");
2185 break;
2186 case ITM_EXPR_XOR_R_E: /* varA ^ exprB */
2187 printi(0, "(");
2188 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2189 printi(0, " ^ ");
2190 dump_expr(itm_hdr, expr->data.operand[1]);
2191 printi(0, ")");
2192 break;
2193 case ITM_EXPR_XOR_R_D: /* varA ^ B */
2194 printi(0, "(");
2195 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2196 printi(0, " ^ ");
2197 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2198 printi(0, ")");
2199 break;
2200 case ITM_EXPR_XOR_R_R: /* varA ^ varB */
2201 printi(0, "(");
2202 printi(0, " ^ ");
2203 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2204 printi(0, ")");
2205 break;
2206 case ITM_EXPR_XOR_R_INVD: /* varA ^ in[B] */
2207 printi(0, "(");
2208 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2209 printi(0, " ^ ");
2210 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2211 printi(0, ")");
2212 break;
2213 case ITM_EXPR_XOR_INVD_E: /* in[A] ^ exprB */
2214 printi(0, "(");
2215 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2216 printi(0, " ^ ");
2217 dump_expr(itm_hdr, expr->data.operand[1]);
2218 printi(0, ")");
2219 break;
2220 case ITM_EXPR_XOR_INVD_D: /* in[A] ^ B */
2221 printi(0, "(");
2222 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2223 printi(0, " ^ ");
2224 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2225 printi(0, ")");
2226 break;
2227 case ITM_EXPR_XOR_INVD_R: /* in[A] ^ varB */
2228 printi(0, "(");
2229 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2230 printi(0, " ^ ");
2231 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2232 printi(0, ")");
2233 break;
2234 case ITM_EXPR_XOR_INVD_INVD: /* in[A] ^ in[B] */
2235 printi(0, "(");
2236 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2237 printi(0, " ^ ");
2238 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2239 printi(0, ")");
2240 break;
2241 case ITM_EXPR_AND: /* A & B */
2242 printi(0, "(");
2243 dump_expr(itm_hdr, expr->data.operand[0]);
2244 printi(0, " & ");
2245 dump_expr(itm_hdr, expr->data.operand[1]);
2246 printi(0, ")");
2247 break;
2248 case ITM_EXPR_AND_E_D: /* exprA & B */
2249 printi(0, "(");
2250 dump_expr(itm_hdr, expr->data.operand[0]);
2251 printi(0, " & ");
2252 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2253 printi(0, ")");
2254 break;
2255 case ITM_EXPR_AND_E_R: /* exprA & varB */
2256 printi(0, "(");
2257 dump_expr(itm_hdr, expr->data.operand[0]);
2258 printi(0, " & ");
2259 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2260 printi(0, ")");
2261 break;
2262 case ITM_EXPR_AND_E_INVD: /* exprA & in[B] */
2263 printi(0, "(");
2264 dump_expr(itm_hdr, expr->data.operand[0]);
2265 printi(0, " & ");
2266 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2267 printi(0, ")");
2268 break;
2269 case ITM_EXPR_AND_D_E: /* intA & exprB */
2270 printi(0, "(");
2271 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2272 printi(0, " & ");
2273 dump_expr(itm_hdr, expr->data.operand[1]);
2274 printi(0, ")");
2275 break;
2276 case ITM_EXPR_AND_D_D: /* intA & B */
2277 printi(0, "(");
2278 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2279 printi(0, " & ");
2280 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2281 printi(0, ")");
2282 break;
2283 case ITM_EXPR_AND_D_R: /* intA & varB */
2284 printi(0, "(");
2285 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2286 printi(0, " & ");
2287 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2288 printi(0, ")");
2289 break;
2290 case ITM_EXPR_AND_D_INVD: /* intA & in[B] */
2291 printi(0, "(");
2292 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2293 printi(0, " & ");
2294 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2295 printi(0, ")");
2296 break;
2297 case ITM_EXPR_AND_R_E: /* varA & exprB */
2298 printi(0, "(");
2299 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2300 printi(0, " & ");
2301 dump_expr(itm_hdr, expr->data.operand[1]);
2302 printi(0, ")");
2303 break;
2304 case ITM_EXPR_AND_R_D: /* varA & B */
2305 printi(0, "(");
2306 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2307 printi(0, " & ");
2308 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2309 printi(0, ")");
2310 break;
2311 case ITM_EXPR_AND_R_R: /* varA & varB */
2312 printi(0, "(");
2313 printi(0, " & ");
2314 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2315 printi(0, ")");
2316 break;
2317 case ITM_EXPR_AND_R_INVD: /* varA & in[B] */
2318 printi(0, "(");
2319 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2320 printi(0, " & ");
2321 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2322 printi(0, ")");
2323 break;
2324 case ITM_EXPR_AND_INVD_E: /* in[A] & exprB */
2325 printi(0, "(");
2326 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2327 printi(0, " & ");
2328 dump_expr(itm_hdr, expr->data.operand[1]);
2329 printi(0, ")");
2330 break;
2331 case ITM_EXPR_AND_INVD_D: /* in[A] & B */
2332 printi(0, "(");
2333 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2334 printi(0, " & ");
2335 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2336 printi(0, ")");
2337 break;
2338 case ITM_EXPR_AND_INVD_R: /* in[A] & varB */
2339 printi(0, "(");
2340 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2341 printi(0, " & ");
2342 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2343 printi(0, ")");
2344 break;
2345 case ITM_EXPR_AND_INVD_INVD: /* in[A] & in[B] */
2346 printi(0, "(");
2347 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2348 printi(0, " & ");
2349 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2350 printi(0, ")");
2351 break;
2352 case ITM_EXPR_EQ: /* A == B */
2353 printi(0, "(");
2354 dump_expr(itm_hdr, expr->data.operand[0]);
2355 printi(0, " == ");
2356 dump_expr(itm_hdr, expr->data.operand[1]);
2357 printi(0, ")");
2358 break;
2359 case ITM_EXPR_EQ_E_D: /* exprA == B */
2360 printi(0, "(");
2361 dump_expr(itm_hdr, expr->data.operand[0]);
2362 printi(0, " == ");
2363 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2364 printi(0, ")");
2365 break;
2366 case ITM_EXPR_EQ_E_R: /* exprA == varB */
2367 printi(0, "(");
2368 dump_expr(itm_hdr, expr->data.operand[0]);
2369 printi(0, " == ");
2370 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2371 printi(0, ")");
2372 break;
2373 case ITM_EXPR_EQ_E_INVD: /* exprA == in[B] */
2374 printi(0, "(");
2375 dump_expr(itm_hdr, expr->data.operand[0]);
2376 printi(0, " == ");
2377 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2378 printi(0, ")");
2379 break;
2380 case ITM_EXPR_EQ_D_E: /* intA == exprB */
2381 printi(0, "(");
2382 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2383 printi(0, " == ");
2384 dump_expr(itm_hdr, expr->data.operand[1]);
2385 printi(0, ")");
2386 break;
2387 case ITM_EXPR_EQ_D_D: /* intA == B */
2388 printi(0, "(");
2389 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2390 printi(0, " == ");
2391 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2392 printi(0, ")");
2393 break;
2394 case ITM_EXPR_EQ_D_R: /* intA == varB */
2395 printi(0, "(");
2396 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2397 printi(0, " == ");
2398 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2399 printi(0, ")");
2400 break;
2401 case ITM_EXPR_EQ_D_INVD: /* intA == in[B] */
2402 printi(0, "(");
2403 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2404 printi(0, " == ");
2405 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2406 printi(0, ")");
2407 break;
2408 case ITM_EXPR_EQ_R_E: /* varA == exprB */
2409 printi(0, "(");
2410 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2411 printi(0, " == ");
2412 dump_expr(itm_hdr, expr->data.operand[1]);
2413 printi(0, ")");
2414 break;
2415 case ITM_EXPR_EQ_R_D: /* varA == B */
2416 printi(0, "(");
2417 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2418 printi(0, " == ");
2419 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2420 printi(0, ")");
2421 break;
2422 case ITM_EXPR_EQ_R_R: /* varA == varB */
2423 printi(0, "(");
2424 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2425 printi(0, " == ");
2426 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2427 printi(0, ")");
2428 break;
2429 case ITM_EXPR_EQ_R_INVD: /* varA == in[B] */
2430 printi(0, "(");
2431 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2432 printi(0, " == ");
2433 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2434 printi(0, ")");
2435 break;
2436 case ITM_EXPR_EQ_INVD_E: /* in[A] == exprB */
2437 printi(0, "(");
2438 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2439 printi(0, " == ");
2440 dump_expr(itm_hdr, expr->data.operand[1]);
2441 printi(0, ")");
2442 break;
2443 case ITM_EXPR_EQ_INVD_D: /* in[A] == B */
2444 printi(0, "(");
2445 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2446 printi(0, " == ");
2447 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2448 printi(0, ")");
2449 break;
2450 case ITM_EXPR_EQ_INVD_R: /* in[A] == varB */
2451 printi(0, "(");
2452 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2453 printi(0, " == ");
2454 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2455 printi(0, ")");
2456 break;
2457 case ITM_EXPR_EQ_INVD_INVD: /* in[A] == in[B] */
2458 printi(0, "(");
2459 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2460 printi(0, " == ");
2461 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2462 printi(0, ")");
2463 break;
2464 case ITM_EXPR_NE: /* A != B */
2465 printi(0, "(");
2466 dump_expr(itm_hdr, expr->data.operand[0]);
2467 printi(0, " != ");
2468 dump_expr(itm_hdr, expr->data.operand[1]);
2469 printi(0, ")");
2470 break;
2471 case ITM_EXPR_NE_E_D: /* exprA != B */
2472 printi(0, "(");
2473 dump_expr(itm_hdr, expr->data.operand[0]);
2474 printi(0, " != ");
2475 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2476 printi(0, ")");
2477 break;
2478 case ITM_EXPR_NE_E_R: /* exprA != varB */
2479 printi(0, "(");
2480 dump_expr(itm_hdr, expr->data.operand[0]);
2481 printi(0, " != ");
2482 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2483 printi(0, ")");
2484 break;
2485 case ITM_EXPR_NE_E_INVD: /* exprA != in[B] */
2486 printi(0, "(");
2487 dump_expr(itm_hdr, expr->data.operand[0]);
2488 printi(0, " != ");
2489 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2490 printi(0, ")");
2491 break;
2492 case ITM_EXPR_NE_D_E: /* intA != exprB */
2493 printi(0, "(");
2494 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2495 printi(0, " != ");
2496 dump_expr(itm_hdr, expr->data.operand[1]);
2497 printi(0, ")");
2498 break;
2499 case ITM_EXPR_NE_D_D: /* intA != B */
2500 printi(0, "(");
2501 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2502 printi(0, " != ");
2503 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2504 printi(0, ")");
2505 break;
2506 case ITM_EXPR_NE_D_R: /* intA != varB */
2507 printi(0, "(");
2508 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2509 printi(0, " != ");
2510 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2511 printi(0, ")");
2512 break;
2513 case ITM_EXPR_NE_D_INVD: /* intA != in[B] */
2514 printi(0, "(");
2515 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2516 printi(0, " != ");
2517 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2518 printi(0, ")");
2519 break;
2520 case ITM_EXPR_NE_R_E: /* varA != exprB */
2521 printi(0, "(");
2522 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2523 printi(0, " != ");
2524 dump_expr(itm_hdr, expr->data.operand[1]);
2525 printi(0, ")");
2526 break;
2527 case ITM_EXPR_NE_R_D: /* varA != B */
2528 printi(0, "(");
2529 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2530 printi(0, " != ");
2531 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2532 printi(0, ")");
2533 break;
2534 case ITM_EXPR_NE_R_R: /* varA != varB */
2535 printi(0, "(");
2536 printi(0, " != ");
2537 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2538 printi(0, ")");
2539 break;
2540 case ITM_EXPR_NE_R_INVD: /* varA != in[B] */
2541 printi(0, "(");
2542 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2543 printi(0, " != ");
2544 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2545 printi(0, ")");
2546 break;
2547 case ITM_EXPR_NE_INVD_E: /* in[A] != exprB */
2548 printi(0, "(");
2549 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2550 printi(0, " != ");
2551 dump_expr(itm_hdr, expr->data.operand[1]);
2552 printi(0, ")");
2553 break;
2554 case ITM_EXPR_NE_INVD_D: /* in[A] != B */
2555 printi(0, "(");
2556 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2557 printi(0, " != ");
2558 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2559 printi(0, ")");
2560 break;
2561 case ITM_EXPR_NE_INVD_R: /* in[A] != varB */
2562 printi(0, "(");
2563 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2564 printi(0, " != ");
2565 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2566 printi(0, ")");
2567 break;
2568 case ITM_EXPR_NE_INVD_INVD: /* in[A] != in[B] */
2569 printi(0, "(");
2570 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2571 printi(0, " != ");
2572 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2573 printi(0, ")");
2574 break;
2575 case ITM_EXPR_GT: /* A > B */
2576 printi(0, "(");
2577 dump_expr(itm_hdr, expr->data.operand[0]);
2578 printi(0, " > ");
2579 dump_expr(itm_hdr, expr->data.operand[1]);
2580 printi(0, ")");
2581 break;
2582 case ITM_EXPR_GT_E_D: /* exprA > B */
2583 printi(0, "(");
2584 dump_expr(itm_hdr, expr->data.operand[0]);
2585 printi(0, " > ");
2586 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2587 printi(0, ")");
2588 break;
2589 case ITM_EXPR_GT_E_R: /* exprA > varB */
2590 printi(0, "(");
2591 dump_expr(itm_hdr, expr->data.operand[0]);
2592 printi(0, " > ");
2593 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2594 printi(0, ")");
2595 break;
2596 case ITM_EXPR_GT_E_INVD: /* exprA > in[B] */
2597 printi(0, "(");
2598 dump_expr(itm_hdr, expr->data.operand[0]);
2599 printi(0, " > ");
2600 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2601 printi(0, ")");
2602 break;
2603 case ITM_EXPR_GT_D_E: /* intA > exprB */
2604 printi(0, "(");
2605 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2606 printi(0, " > ");
2607 dump_expr(itm_hdr, expr->data.operand[1]);
2608 printi(0, ")");
2609 break;
2610 case ITM_EXPR_GT_D_D: /* intA > B */
2611 printi(0, "(");
2612 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2613 printi(0, " > ");
2614 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2615 printi(0, ")");
2616 break;
2617 case ITM_EXPR_GT_D_R: /* intA > varB */
2618 printi(0, "(");
2619 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2620 printi(0, " > ");
2621 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2622 printi(0, ")");
2623 break;
2624 case ITM_EXPR_GT_D_INVD: /* intA > in[B] */
2625 printi(0, "(");
2626 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2627 printi(0, " > ");
2628 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2629 printi(0, ")");
2630 break;
2631 case ITM_EXPR_GT_R_E: /* varA > exprB */
2632 printi(0, "(");
2633 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2634 printi(0, " > ");
2635 dump_expr(itm_hdr, expr->data.operand[1]);
2636 printi(0, ")");
2637 break;
2638 case ITM_EXPR_GT_R_D: /* varA > B */
2639 printi(0, "(");
2640 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2641 printi(0, " > ");
2642 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2643 printi(0, ")");
2644 break;
2645 case ITM_EXPR_GT_R_R: /* varA > varB */
2646 printi(0, "(");
2647 printi(0, " > ");
2648 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2649 printi(0, ")");
2650 break;
2651 case ITM_EXPR_GT_R_INVD: /* varA > in[B] */
2652 printi(0, "(");
2653 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2654 printi(0, " > ");
2655 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2656 printi(0, ")");
2657 break;
2658 case ITM_EXPR_GT_INVD_E: /* in[A] > exprB */
2659 printi(0, "(");
2660 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2661 printi(0, " > ");
2662 dump_expr(itm_hdr, expr->data.operand[1]);
2663 printi(0, ")");
2664 break;
2665 case ITM_EXPR_GT_INVD_D: /* in[A] > B */
2666 printi(0, "(");
2667 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2668 printi(0, " > ");
2669 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2670 printi(0, ")");
2671 break;
2672 case ITM_EXPR_GT_INVD_R: /* in[A] > varB */
2673 printi(0, "(");
2674 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2675 printi(0, " > ");
2676 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2677 printi(0, ")");
2678 break;
2679 case ITM_EXPR_GT_INVD_INVD: /* in[A] > in[B] */
2680 printi(0, "(");
2681 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2682 printi(0, " > ");
2683 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2684 printi(0, ")");
2685 break;
2686 case ITM_EXPR_GE: /* A >= B */
2687 printi(0, "(");
2688 dump_expr(itm_hdr, expr->data.operand[0]);
2689 printi(0, " >= ");
2690 dump_expr(itm_hdr, expr->data.operand[1]);
2691 printi(0, ")");
2692 break;
2693 case ITM_EXPR_GE_E_D: /* exprA >= B */
2694 printi(0, "(");
2695 dump_expr(itm_hdr, expr->data.operand[0]);
2696 printi(0, " >= ");
2697 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2698 printi(0, ")");
2699 break;
2700 case ITM_EXPR_GE_E_R: /* exprA >= varB */
2701 printi(0, "(");
2702 dump_expr(itm_hdr, expr->data.operand[0]);
2703 printi(0, " >= ");
2704 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2705 printi(0, ")");
2706 break;
2707 case ITM_EXPR_GE_E_INVD: /* exprA >= in[B] */
2708 printi(0, "(");
2709 dump_expr(itm_hdr, expr->data.operand[0]);
2710 printi(0, " >= ");
2711 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2712 printi(0, ")");
2713 break;
2714 case ITM_EXPR_GE_D_E: /* intA >= exprB */
2715 printi(0, "(");
2716 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2717 printi(0, " >= ");
2718 dump_expr(itm_hdr, expr->data.operand[1]);
2719 printi(0, ")");
2720 break;
2721 case ITM_EXPR_GE_D_D: /* intA >= B */
2722 printi(0, "(");
2723 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2724 printi(0, " >= ");
2725 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2726 printi(0, ")");
2727 break;
2728 case ITM_EXPR_GE_D_R: /* intA >= varB */
2729 printi(0, "(");
2730 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2731 printi(0, " >= ");
2732 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2733 printi(0, ")");
2734 break;
2735 case ITM_EXPR_GE_D_INVD: /* intA >= in[B] */
2736 printi(0, "(");
2737 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2738 printi(0, " >= ");
2739 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2740 printi(0, ")");
2741 break;
2742 case ITM_EXPR_GE_R_E: /* varA >= exprB */
2743 printi(0, "(");
2744 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2745 printi(0, " >= ");
2746 dump_expr(itm_hdr, expr->data.operand[1]);
2747 printi(0, ")");
2748 break;
2749 case ITM_EXPR_GE_R_D: /* varA >= B */
2750 printi(0, "(");
2751 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2752 printi(0, " >= ");
2753 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2754 printi(0, ")");
2755 break;
2756 case ITM_EXPR_GE_R_R: /* varA >= varB */
2757 printi(0, "(");
2758 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2759 printi(0, " >= ");
2760 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2761 printi(0, ")");
2762 break;
2763 case ITM_EXPR_GE_R_INVD: /* varA >= in[B] */
2764 printi(0, "(");
2765 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2766 printi(0, " >= ");
2767 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2768 printi(0, ")");
2769 break;
2770 case ITM_EXPR_GE_INVD_E: /* in[A] >= exprB */
2771 printi(0, "(");
2772 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2773 printi(0, " >= ");
2774 dump_expr(itm_hdr, expr->data.operand[1]);
2775 printi(0, ")");
2776 break;
2777 case ITM_EXPR_GE_INVD_D: /* in[A] >= B */
2778 printi(0, "(");
2779 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2780 printi(0, " >= ");
2781 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2782 printi(0, ")");
2783 break;
2784 case ITM_EXPR_GE_INVD_R: /* in[A] >= varB */
2785 printi(0, "(");
2786 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2787 printi(0, " >= ");
2788 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2789 printi(0, ")");
2790 break;
2791 case ITM_EXPR_GE_INVD_INVD: /* in[A] >= in[B] */
2792 printi(0, "(");
2793 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2794 printi(0, " >= ");
2795 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2796 printi(0, ")");
2797 break;
2798 case ITM_EXPR_LT: /* A < B */
2799 printi(0, "(");
2800 dump_expr(itm_hdr, expr->data.operand[0]);
2801 printi(0, " < ");
2802 dump_expr(itm_hdr, expr->data.operand[1]);
2803 printi(0, ")");
2804 break;
2805 case ITM_EXPR_LT_E_D: /* exprA < B */
2806 printi(0, "(");
2807 dump_expr(itm_hdr, expr->data.operand[0]);
2808 printi(0, " < ");
2809 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2810 printi(0, ")");
2811 break;
2812 case ITM_EXPR_LT_E_R: /* exprA < varB */
2813 printi(0, "(");
2814 dump_expr(itm_hdr, expr->data.operand[0]);
2815 printi(0, " < ");
2816 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2817 printi(0, ")");
2818 break;
2819 case ITM_EXPR_LT_E_INVD: /* exprA < in[B] */
2820 printi(0, "(");
2821 dump_expr(itm_hdr, expr->data.operand[0]);
2822 printi(0, " < ");
2823 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2824 printi(0, ")");
2825 break;
2826 case ITM_EXPR_LT_D_E: /* intA < exprB */
2827 printi(0, "(");
2828 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2829 printi(0, " < ");
2830 dump_expr(itm_hdr, expr->data.operand[1]);
2831 printi(0, ")");
2832 break;
2833 case ITM_EXPR_LT_D_D: /* intA < B */
2834 printi(0, "(");
2835 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2836 printi(0, " < ");
2837 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2838 printi(0, ")");
2839 break;
2840 case ITM_EXPR_LT_D_R: /* intA < varB */
2841 printi(0, "(");
2842 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2843 printi(0, " < ");
2844 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2845 printi(0, ")");
2846 break;
2847 case ITM_EXPR_LT_D_INVD: /* intA < in[B] */
2848 printi(0, "(");
2849 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2850 printi(0, " < ");
2851 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2852 printi(0, ")");
2853 break;
2854 case ITM_EXPR_LT_R_E: /* varA < exprB */
2855 printi(0, "(");
2856 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2857 printi(0, " < ");
2858 dump_expr(itm_hdr, expr->data.operand[1]);
2859 printi(0, ")");
2860 break;
2861 case ITM_EXPR_LT_R_D: /* varA < B */
2862 printi(0, "(");
2863 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2864 printi(0, " < ");
2865 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2866 printi(0, ")");
2867 break;
2868 case ITM_EXPR_LT_R_R: /* varA < varB */
2869 printi(0, "(");
2870 printi(0, " < ");
2871 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2872 printi(0, ")");
2873 break;
2874 case ITM_EXPR_LT_R_INVD: /* varA < in[B] */
2875 printi(0, "(");
2876 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2877 printi(0, " < ");
2878 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2879 printi(0, ")");
2880 break;
2881 case ITM_EXPR_LT_INVD_E: /* in[A] < exprB */
2882 printi(0, "(");
2883 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2884 printi(0, " < ");
2885 dump_expr(itm_hdr, expr->data.operand[1]);
2886 printi(0, ")");
2887 break;
2888 case ITM_EXPR_LT_INVD_D: /* in[A] < B */
2889 printi(0, "(");
2890 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2891 printi(0, " < ");
2892 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2893 printi(0, ")");
2894 break;
2895 case ITM_EXPR_LT_INVD_R: /* in[A] < varB */
2896 printi(0, "(");
2897 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2898 printi(0, " < ");
2899 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2900 printi(0, ")");
2901 break;
2902 case ITM_EXPR_LT_INVD_INVD: /* in[A] < in[B] */
2903 printi(0, "(");
2904 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2905 printi(0, " < ");
2906 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2907 printi(0, ")");
2908 break;
2909 case ITM_EXPR_LE: /* A <= B */
2910 printi(0, "(");
2911 dump_expr(itm_hdr, expr->data.operand[0]);
2912 printi(0, " <= ");
2913 dump_expr(itm_hdr, expr->data.operand[1]);
2914 printi(0, ")");
2915 break;
2916 case ITM_EXPR_LE_E_D: /* exprA <= B */
2917 printi(0, "(");
2918 dump_expr(itm_hdr, expr->data.operand[0]);
2919 printi(0, " <= ");
2920 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2921 printi(0, ")");
2922 break;
2923 case ITM_EXPR_LE_E_R: /* exprA <= varB */
2924 printi(0, "(");
2925 dump_expr(itm_hdr, expr->data.operand[0]);
2926 printi(0, " <= ");
2927 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2928 printi(0, ")");
2929 break;
2930 case ITM_EXPR_LE_E_INVD: /* exprA <= in[B] */
2931 printi(0, "(");
2932 dump_expr(itm_hdr, expr->data.operand[0]);
2933 printi(0, " <= ");
2934 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2935 printi(0, ")");
2936 break;
2937 case ITM_EXPR_LE_D_E: /* intA <= exprB */
2938 printi(0, "(");
2939 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2940 printi(0, " <= ");
2941 dump_expr(itm_hdr, expr->data.operand[1]);
2942 printi(0, ")");
2943 break;
2944 case ITM_EXPR_LE_D_D: /* intA <= B */
2945 printi(0, "(");
2946 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2947 printi(0, " <= ");
2948 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2949 printi(0, ")");
2950 break;
2951 case ITM_EXPR_LE_D_R: /* intA <= varB */
2952 printi(0, "(");
2953 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2954 printi(0, " <= ");
2955 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
2956 printi(0, ")");
2957 break;
2958 case ITM_EXPR_LE_D_INVD: /* intA <= in[B] */
2959 printi(0, "(");
2960 printi(0, "%ld", expr->data.operand[0].itm_ptr);
2961 printi(0, " <= ");
2962 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2963 printi(0, ")");
2964 break;
2965 case ITM_EXPR_LE_R_E: /* varA <= exprB */
2966 printi(0, "(");
2967 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2968 printi(0, " <= ");
2969 dump_expr(itm_hdr, expr->data.operand[1]);
2970 printi(0, ")");
2971 break;
2972 case ITM_EXPR_LE_R_D: /* varA <= B */
2973 printi(0, "(");
2974 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2975 printi(0, " <= ");
2976 printi(0, "%ld", expr->data.operand[1].itm_ptr);
2977 printi(0, ")");
2978 break;
2979 case ITM_EXPR_LE_R_R: /* varA <= varB */
2980 printi(0, "(");
2981 printi(0, " <= ");
2982 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2983 printi(0, ")");
2984 break;
2985 case ITM_EXPR_LE_R_INVD: /* varA <= in[B] */
2986 printi(0, "(");
2987 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[0]));
2988 printi(0, " <= ");
2989 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
2990 printi(0, ")");
2991 break;
2992 case ITM_EXPR_LE_INVD_E: /* in[A] <= exprB */
2993 printi(0, "(");
2994 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
2995 printi(0, " <= ");
2996 dump_expr(itm_hdr, expr->data.operand[1]);
2997 printi(0, ")");
2998 break;
2999 case ITM_EXPR_LE_INVD_D: /* in[A] <= B */
3000 printi(0, "(");
3001 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
3002 printi(0, " <= ");
3003 printi(0, "%ld", expr->data.operand[1].itm_ptr);
3004 printi(0, ")");
3005 break;
3006 case ITM_EXPR_LE_INVD_R: /* in[A] <= varB */
3007 printi(0, "(");
3008 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
3009 printi(0, " <= ");
3010 printi(0, "%s", reg_name(itm_hdr, expr->data.operand[1]));
3011 printi(0, ")");
3012 break;
3013 case ITM_EXPR_LE_INVD_INVD: /* in[A] <= in[B] */
3014 printi(0, "(");
3015 printi(0, RNPREF "in[%ld]", expr->data.operand[0].itm_ptr);
3016 printi(0, " <= ");
3017 printi(0, RNPREF "in[%ld]", expr->data.operand[1].itm_ptr);
3018 printi(0, ")");
3019 break;
3020 case ITM_EXPR_NOT: /* !A */
3021 printi(0, "(");
3022 printi(0, "!");
3023 dump_expr(itm_hdr, expr->data.operand[0]);
3024 printi(0, ")");
3025 break;
3026 case ITM_EXPR_NEG: /* ~A */
3027 printi(0, "(");
3028 printi(0, " ~");
3029 dump_expr(itm_hdr, expr->data.operand[0]);
3030 printi(0, ")");
3031 break;
3032 case ITM_EXPR_LOR: /* A || B */
3033 printi(0, "(");
3034 dump_expr(itm_hdr, expr->data.operand[0]);
3035 printi(0, " || ");
3036 dump_expr(itm_hdr, expr->data.operand[1]);
3037 printi(0, ")");
3038 break;
3039 case ITM_EXPR_LAND: /* A && B */
3040 printi(0, "(");
3041 dump_expr(itm_hdr, expr->data.operand[0]);
3042 printi(0, " && ");
3043 dump_expr(itm_hdr, expr->data.operand[1]);
3044 printi(0, ")");
3045 break;
3046 case ITM_EXPR_ASSIGN: /* A = B */
3047 printi(0, "%s = ", reg_name(itm_hdr, expr->data.operand[0]));
3048 dump_expr(itm_hdr, expr->data.operand[1]);
3049 break;
3050 case ITM_EXPR_IN_EQ: /* in == A */
3051 printi(0, "(" RNPREF "in == ", 0);
3052 dump_expr(itm_hdr, expr->data.operand[0]);
3053 printi(0, ")");
3054 break;
3055 default:
3056 break;
3062 * Dump range (between)
3064 static void
3065 dump_range(itm_hdr_t *itm_hdr, itm_place_t range_place)
3067 itm_tbl_hdr_t *rth;
3068 itm_range_hdr_t *rtsh;
3069 unsigned char *p;
3070 long i;
3071 long j;
3073 rth = (itm_tbl_hdr_t *)(ADDR(range_place));
3074 rtsh = (itm_range_hdr_t *)(rth + 1);
3075 p = (unsigned char *)(rtsh + 1);
3077 TRACE_MESSAGE('p', ("(&)between=%ld ", range_place.itm_ptr));
3078 printi(0, RNPREF "between ");
3079 for (i = 0; i < rth->number; i++) {
3080 if (0 != i) printi(0, "\t ");
3081 printi(0, "0x");
3082 for (j = 0; j < rtsh->len; j++) {
3083 printi(0, "%02x", *(p++));
3085 printi(0, " - ");
3086 printi(0, "0x");
3087 for (j = 0; j < rtsh->len; j++) {
3088 printi(0, "%02x", *(p++));
3090 if (i < (rth->number - 1)) {
3091 printi(0, ",\n");
3092 } else {
3093 printi(0, ";\n");
3100 * Dump escape sequence
3102 static void
3103 dump_escapeseq(itm_hdr_t *itm_hdr, itm_place_t escapeseq_place)
3105 itm_tbl_hdr_t *eth;
3106 itm_escapeseq_hdr_t *eh;
3107 itm_data_t *d;
3108 itm_data_t data;
3110 long i;
3113 eth = (itm_tbl_hdr_t *)(ADDR(escapeseq_place));
3114 eh = (itm_escapeseq_hdr_t *)(eth + 1);
3115 d = (itm_data_t *)(eh + 1);
3116 TRACE_MESSAGE('p', ("(&)escseq=%ld ", escapeseq_place.itm_ptr));
3117 printi(1, RNPREF "escapceseq {");
3119 for (i = 0; i < eth->number; i++, d++) {
3120 if (0 != i) printi(0, " ");
3121 data = *d;
3122 if ((sizeof (itm_place_t)) < data.size) {
3123 data.place.itm_ptr = (itm_place2_t)ADDR(d->place);
3125 printi(0, "0x%s;", data_to_hexadecimal(&data));
3127 printi(-1, "}\n");
3131 static void
3132 printi(int c, char *format, ...)
3134 static int indent_level;
3135 static int new_line = 1;
3136 int i;
3137 va_list ap;
3138 va_start(ap, format);
3140 if (c < 0) {
3141 indent_level += c;
3142 if (indent_level < 0) {
3143 indent_level = 0;
3146 if (new_line) {
3147 for (i = indent_level; 0 < i; i -= 1) {
3148 (void) putchar('\t');
3151 if (0 < c) {
3152 indent_level += c;
3153 if (indent_level < 0) {
3154 indent_level = 0;
3158 if (NULL == strchr(format, '\n')) {
3159 new_line = 0;
3160 } else {
3161 new_line = 1;
3164 (void) vfprintf(stdout, format, ap);
3166 va_end(ap);
3170 static char *
3171 name_place_to_str(itm_hdr_t *itm_hdr, itm_place2_t place)
3173 itm_data_t d;
3175 if (0 != place) {
3176 d = *((itm_data_t *)ADDR2(place));
3177 if ((sizeof (itm_place_t)) < d.size) {
3178 d.place.itm_ptr = (itm_place2_t)ADDR(d.place);
3180 } else {
3181 d.size = 0;
3182 d.place.itm_ptr = 0;
3184 return (name_to_str(&d));
3187 static char *
3188 tbl_name(itm_hdr_t *itm_hdr, itm_tbl_hdr_t *tbl_hdr)
3190 if (ITM_TBL_OP_INIT == tbl_hdr->type) {
3191 return (RNPREF "init");
3192 } else if (ITM_TBL_OP_RESET == tbl_hdr->type) {
3193 return (RNPREF "reset");
3194 } else if (tbl_hdr->name.itm_ptr) {
3195 return (name_place_to_str(itm_hdr, tbl_hdr->name.itm_ptr));
3196 } else {
3197 return (NULL);
3202 static char *
3203 reg_name(itm_hdr_t *itm_hdr, itm_place_t op)
3205 itm_info_hdr_t *info_hdr;
3206 static char sbuf[32];
3207 itm_num_t reg_num;
3209 reg_num = (itm_num_t)(op.itm_ptr);
3210 if (0 == itm_hdr->info_hdr.itm_ptr) {
3211 (void) sprintf(sbuf, "reg%ld\n", reg_num);
3212 return (sbuf);
3213 } else {
3214 info_hdr = INFO_HDR(itm_hdr);
3215 return (name_place_to_str(
3216 itm_hdr,
3217 info_hdr->reg_plc_tbl.place.itm_ptr +
3218 (reg_num *sizeof (itm_data_t))));
3222 static itm_hdr_t *
3223 itm_attach(const char *itm_file)
3225 itm_hdr_t *itm_hdr;
3226 struct stat st;
3227 int fd;
3229 fd = open(itm_file, O_RDONLY, 0);
3230 if (fd == -1) {
3231 PERROR(gettext("open()"));
3232 return (NULL);
3235 if (fstat(fd, &st) == -1) {
3236 PERROR(gettext("fstat()"));
3237 return (NULL);
3239 itm_hdr = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
3240 if (MAP_FAILED == itm_hdr) {
3241 PERROR(gettext("mmap()"));
3242 return (NULL);
3245 (void) close(fd);
3247 if ((itm_hdr->ident[0] != ITM_IDENT_0) ||
3248 (itm_hdr->ident[1] != ITM_IDENT_1) ||
3249 (itm_hdr->ident[2] != ITM_IDENT_2) ||
3250 (itm_hdr->ident[3] != ITM_IDENT_3)) {
3251 itm_error(gettext("magic number error\n"));
3252 return (NULL);
3254 if ((itm_hdr->version[0] != ITM_VER_0) ||
3255 (itm_hdr->version[1] != ITM_VER_1) ||
3256 (itm_hdr->version[2] != ITM_VER_2) ||
3257 #if defined(_LITTLE_ENDIAN)
3258 #if defined(_LP64)
3259 ((itm_hdr->spec[3] != ITM_SPEC_3_32_LITTLE_ENDIAN) &&
3260 (itm_hdr->spec[3] != ITM_SPEC_3_64_LITTLE_ENDIAN))) {
3261 #else
3262 (itm_hdr->spec[3] != ITM_SPEC_3_32_LITTLE_ENDIAN)) {
3263 #endif
3264 #else
3265 #if defined(_LP64)
3266 ((itm_hdr->spec[3] != ITM_SPEC_3_32_BIG_ENDIAN) &&
3267 (itm_hdr->spec[3] != ITM_SPEC_3_64_BIG_ENDIAN))) {
3268 #else
3269 (itm_hdr->spec[3] != ITM_SPEC_3_32_BIG_ENDIAN)) {
3270 #endif
3271 #endif
3272 itm_error(gettext("version number error\n"));
3273 return (NULL);
3275 if (itm_hdr->itm_size.itm_ptr != st.st_size) {
3276 itm_error(gettext(
3277 "size error: expected=%1$d current=%2$d\n"),
3278 (size_t)(itm_hdr->itm_size.itm_ptr), st.st_size);
3279 return (NULL);
3282 return (itm_hdr);