Lines Matching refs:insn

22 struct insn {
44 struct insn *insn;
154 struct insn insn;
158 rc = scanf("%s %s %s", insn.opcode, insn.name, insn.format);
163 insn.type = insn_format_to_type(insn.format);
164 insn.name_len = strlen(insn.name);
165 for (i = 0; i <= insn.name_len; i++)
166 insn.upper[i] = toupper((unsigned char)insn.name[i]);
168 desc->insn = realloc(desc->insn, desc->nr * sizeof(*desc->insn));
169 if (!desc->insn)
171 desc->insn[desc->nr - 1] = insn;
177 return strcmp(((struct insn *)a)->format, ((struct insn *)b)->format);
185 qsort(desc->insn, desc->nr, sizeof(*desc->insn), cmpformat);
190 if (!strcmp(format, desc->insn[i].format))
193 format = desc->insn[i].format;
201 return strcmp(((struct insn *)a)->name, ((struct insn *)b)->name);
206 struct insn *insn;
209 qsort(desc->insn, desc->nr, sizeof(*desc->insn), cmp_long_insn);
213 insn = &desc->insn[i];
214 if (insn->name_len < 6)
216 printf("\tLONG_INSN_%s,\n", insn->upper);
223 insn = &desc->insn[i];
224 if (insn->name_len < 6)
226 printf("\t[LONG_INSN_%s] = \"%s\", \\\n", insn->upper, insn->name);
231 static void print_opcode(struct insn *insn, int nr)
235 opcode = insn->opcode;
236 if (insn->type->byte != 0)
238 printf("\t[%4d] = { .opfrag = 0x%s, .format = INSTR_%s, ", nr, opcode, insn->format);
239 if (insn->name_len < 6)
240 printf(".name = \"%s\" ", insn->name);
242 printf(".offset = LONG_INSN_%s ", insn->upper);
246 static void add_to_group(struct gen_opcode *desc, struct insn *insn, int offset)
251 if (group && (!strncmp(group->opcode, insn->opcode, 2) || group->type->byte == 0)) {
260 memcpy(group->opcode, insn->opcode, 2);
261 group->type = insn->type;
268 return strcmp(((struct insn *)a)->opcode, ((struct insn *)b)->opcode);
274 struct insn *insn;
277 qsort(desc->insn, desc->nr, sizeof(*desc->insn), cmpopcode);
281 insn = &desc->insn[i];
282 if (insn->type->byte == 0)
284 add_to_group(desc, insn, offset);
285 if (strncmp(opcode, insn->opcode, 2)) {
286 memcpy(opcode, insn->opcode, 2);
289 print_opcode(insn, offset);
294 insn = &desc->insn[i];
295 if (insn->type->byte != 0)
297 add_to_group(desc, insn, offset);
298 print_opcode(insn, offset);