2 #include "sparc-opcode.h"
4 static void print_rs_reg(char);
5 static void print_cp_reg(void);
6 static void print_f_reg(int);
7 static void print_imm_13(void);
8 static void print_imm_22(void);
9 static void print_asi(void);
12 static char *reg_names
[] =
13 { "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
14 "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7",
15 "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
16 "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7",
17 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
18 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
19 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
20 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
21 "y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr"
33 /* output each instruction */
35 for(i
= 0; i
< NUMOPCODES
- 1; i
++){
36 printf("\t%s", sparc_opcodes
[i
].name
);
37 arg
= sparc_opcodes
[i
].args
;
39 if (*arg
!= ',' && *(arg
+1) != 'a') /* handle annul case */
42 /* and every possible combination */
43 for (arg
= sparc_opcodes
[i
].args
; *arg
!= '\0'; arg
++) {
51 print_rs_reg(*arg
); /* output in a random register */
54 print_imm_13(); /* output a random immediate value */
57 print_imm_22(); /* output a random immediate value */
94 printf("%%hi(0xaaaaa)");
116 /* special case set insn */
134 printf("*** what's this garbage %c 0x%x?\n", *arg
, (int) *arg
);
144 #define MAX_RS_REG 32
148 print_rs_reg(char type
)
152 printf("%%%s", reg_names
[i
++]);
157 #define MAX_FP_REG 64
161 print_f_reg(int align
)
165 printf("%%%s", reg_names
[(i
++) & ~align
]);
176 val
= (val
+4) & 0x3ff;
186 val
= (val
+ 4) & 0x3fffff;
203 #define MAX_CP_REG 32
206 void print_cp_reg(void)
210 printf("%%c%d", i
++);