version 1.1.1.7, 2020/04/03 23:39:50 |
version 1.1.1.8, 2022/12/23 19:00:59 |
|
|
/* ia64-gen.c -- Generate a shrunk set of opcode tables |
/* ia64-gen.c -- Generate a shrunk set of opcode tables |
Copyright (C) 1999-2020 Free Software Foundation, Inc. |
Copyright (C) 1999-2022 Free Software Foundation, Inc. |
Written by Bob Manson, Cygnus Solutions, <manson@cygnus.com> |
Written by Bob Manson, Cygnus Solutions, <manson@cygnus.com> |
|
|
This file is part of the GNU opcodes library. |
This file is part of the GNU opcodes library. |
Line 467 fetch_insn_class (const char *full_name, |
|
Line 467 fetch_insn_class (const char *full_name, |
|
int ind; |
int ind; |
int is_class = 0; |
int is_class = 0; |
|
|
if (CONST_STRNEQ (full_name, "IC:")) |
if (startswith (full_name, "IC:")) |
{ |
{ |
name = xstrdup (full_name + 3); |
name = xstrdup (full_name + 3); |
is_class = 1; |
is_class = 1; |
Line 746 parse_resource_users (const char *ref, i |
|
Line 746 parse_resource_users (const char *ref, i |
|
are read. Only create new classes if it's *not* an insn class, |
are read. Only create new classes if it's *not* an insn class, |
or if it's a composite class (which wouldn't necessarily be in the IC |
or if it's a composite class (which wouldn't necessarily be in the IC |
table). */ |
table). */ |
if (! CONST_STRNEQ (name, "IC:") || xsect != NULL) |
if (! startswith (name, "IC:") || xsect != NULL) |
create = 1; |
create = 1; |
|
|
iclass = fetch_insn_class (name, create); |
iclass = fetch_insn_class (name, create); |
Line 1039 in_iclass (struct ia64_opcode *idesc, st |
|
Line 1039 in_iclass (struct ia64_opcode *idesc, st |
|
|
|
if (ic->comment) |
if (ic->comment) |
{ |
{ |
if (CONST_STRNEQ (ic->comment, "Format")) |
if (startswith (ic->comment, "Format")) |
{ |
{ |
/* Assume that the first format seen is the most restrictive, and |
/* Assume that the first format seen is the most restrictive, and |
only keep a later one if it looks like it's more restrictive. */ |
only keep a later one if it looks like it's more restrictive. */ |
Line 1055 in_iclass (struct ia64_opcode *idesc, st |
|
Line 1055 in_iclass (struct ia64_opcode *idesc, st |
|
else |
else |
format = ic->comment; |
format = ic->comment; |
} |
} |
else if (CONST_STRNEQ (ic->comment, "Field")) |
else if (startswith (ic->comment, "Field")) |
{ |
{ |
if (field) |
if (field) |
warn (_("overlapping field %s->%s\n"), |
warn (_("overlapping field %s->%s\n"), |
Line 1069 in_iclass (struct ia64_opcode *idesc, st |
|
Line 1069 in_iclass (struct ia64_opcode *idesc, st |
|
instructions. */ |
instructions. */ |
if (ic->nsubs == 0 && ic->nxsubs == 0) |
if (ic->nsubs == 0 && ic->nxsubs == 0) |
{ |
{ |
int is_mov = CONST_STRNEQ (idesc->name, "mov"); |
int is_mov = startswith (idesc->name, "mov"); |
int plain_mov = strcmp (idesc->name, "mov") == 0; |
int plain_mov = strcmp (idesc->name, "mov") == 0; |
int len = strlen(ic->name); |
int len = strlen(ic->name); |
|
|
Line 1128 in_iclass (struct ia64_opcode *idesc, st |
|
Line 1128 in_iclass (struct ia64_opcode *idesc, st |
|
|
|
if (resolved && format) |
if (resolved && format) |
{ |
{ |
if (CONST_STRNEQ (idesc->name, "dep") |
if (startswith (idesc->name, "dep") |
&& strstr (format, "I13") != NULL) |
&& strstr (format, "I13") != NULL) |
resolved = idesc->operands[1] == IA64_OPND_IMM8; |
resolved = idesc->operands[1] == IA64_OPND_IMM8; |
else if (CONST_STRNEQ (idesc->name, "chk") |
else if (startswith (idesc->name, "chk") |
&& strstr (format, "M21") != NULL) |
&& strstr (format, "M21") != NULL) |
resolved = idesc->operands[0] == IA64_OPND_F2; |
resolved = idesc->operands[0] == IA64_OPND_F2; |
else if (CONST_STRNEQ (idesc->name, "lfetch")) |
else if (startswith (idesc->name, "lfetch")) |
resolved = (strstr (format, "M14 M15") != NULL |
resolved = (strstr (format, "M14 M15") != NULL |
&& (idesc->operands[1] == IA64_OPND_R2 |
&& (idesc->operands[1] == IA64_OPND_R2 |
|| idesc->operands[1] == IA64_OPND_IMM9b)); |
|| idesc->operands[1] == IA64_OPND_IMM9b)); |
else if (CONST_STRNEQ (idesc->name, "br.call") |
else if (startswith (idesc->name, "br.call") |
&& strstr (format, "B5") != NULL) |
&& strstr (format, "B5") != NULL) |
resolved = idesc->operands[1] == IA64_OPND_B2; |
resolved = idesc->operands[1] == IA64_OPND_B2; |
else if (CONST_STRNEQ (idesc->name, "br.call") |
else if (startswith (idesc->name, "br.call") |
&& strstr (format, "B3") != NULL) |
&& strstr (format, "B3") != NULL) |
resolved = idesc->operands[1] == IA64_OPND_TGT25c; |
resolved = idesc->operands[1] == IA64_OPND_TGT25c; |
else if (CONST_STRNEQ (idesc->name, "brp") |
else if (startswith (idesc->name, "brp") |
&& strstr (format, "B7") != NULL) |
&& strstr (format, "B7") != NULL) |
resolved = idesc->operands[0] == IA64_OPND_B2; |
resolved = idesc->operands[0] == IA64_OPND_B2; |
else if (strcmp (ic->name, "invala") == 0) |
else if (strcmp (ic->name, "invala") == 0) |
resolved = strcmp (idesc->name, ic->name) == 0; |
resolved = strcmp (idesc->name, ic->name) == 0; |
else if (CONST_STRNEQ (idesc->name, "st") |
else if (startswith (idesc->name, "st") |
&& (strstr (format, "M5") != NULL |
&& (strstr (format, "M5") != NULL |
|| strstr (format, "M10") != NULL)) |
|| strstr (format, "M10") != NULL)) |
resolved = idesc->flags & IA64_OPCODE_POSTINC; |
resolved = idesc->flags & IA64_OPCODE_POSTINC; |
else if (CONST_STRNEQ (idesc->name, "ld") |
else if (startswith (idesc->name, "ld") |
&& (strstr (format, "M2 M3") != NULL |
&& (strstr (format, "M2 M3") != NULL |
|| strstr (format, "M12") != NULL |
|| strstr (format, "M12") != NULL |
|| strstr (format, "M7 M8") != NULL)) |
|| strstr (format, "M7 M8") != NULL)) |
Line 1166 in_iclass (struct ia64_opcode *idesc, st |
|
Line 1166 in_iclass (struct ia64_opcode *idesc, st |
|
plain brl matches brl.cond. */ |
plain brl matches brl.cond. */ |
if (!resolved |
if (!resolved |
&& (strcmp (idesc->name, "brl") == 0 |
&& (strcmp (idesc->name, "brl") == 0 |
|| CONST_STRNEQ (idesc->name, "brl.")) |
|| startswith (idesc->name, "brl.")) |
&& strcmp (ic->name, "brl.cond") == 0) |
&& strcmp (ic->name, "brl.cond") == 0) |
{ |
{ |
resolved = 1; |
resolved = 1; |
Line 1175 in_iclass (struct ia64_opcode *idesc, st |
|
Line 1175 in_iclass (struct ia64_opcode *idesc, st |
|
/* Misc br variations ('.cond' is optional). */ |
/* Misc br variations ('.cond' is optional). */ |
if (!resolved |
if (!resolved |
&& (strcmp (idesc->name, "br") == 0 |
&& (strcmp (idesc->name, "br") == 0 |
|| CONST_STRNEQ (idesc->name, "br.")) |
|| startswith (idesc->name, "br.")) |
&& strcmp (ic->name, "br.cond") == 0) |
&& strcmp (ic->name, "br.cond") == 0) |
{ |
{ |
if (format) |
if (format) |
Line 1188 in_iclass (struct ia64_opcode *idesc, st |
|
Line 1188 in_iclass (struct ia64_opcode *idesc, st |
|
} |
} |
|
|
/* probe variations. */ |
/* probe variations. */ |
if (!resolved && CONST_STRNEQ (idesc->name, "probe")) |
if (!resolved && startswith (idesc->name, "probe")) |
{ |
{ |
resolved = strcmp (ic->name, "probe") == 0 |
resolved = strcmp (ic->name, "probe") == 0 |
&& !((strstr (idesc->name, "fault") != NULL) |
&& !((strstr (idesc->name, "fault") != NULL) |
Line 1222 in_iclass (struct ia64_opcode *idesc, st |
|
Line 1222 in_iclass (struct ia64_opcode *idesc, st |
|
} |
} |
|
|
/* Some variants of mov and mov.[im]. */ |
/* Some variants of mov and mov.[im]. */ |
if (!resolved && CONST_STRNEQ (ic->name, "mov_")) |
if (!resolved && startswith (ic->name, "mov_")) |
resolved = in_iclass_mov_x (idesc, ic, format, field); |
resolved = in_iclass_mov_x (idesc, ic, format, field); |
} |
} |
|
|
Line 1487 lookup_specifier (const char *name) |
|
Line 1487 lookup_specifier (const char *name) |
|
warn (_("Don't know how to specify # dependency %s\n"), |
warn (_("Don't know how to specify # dependency %s\n"), |
name); |
name); |
} |
} |
else if (CONST_STRNEQ (name, "AR[FPSR]")) |
else if (startswith (name, "AR[FPSR]")) |
return IA64_RS_AR_FPSR; |
return IA64_RS_AR_FPSR; |
else if (CONST_STRNEQ (name, "AR[")) |
else if (startswith (name, "AR[")) |
return IA64_RS_ARX; |
return IA64_RS_ARX; |
else if (CONST_STRNEQ (name, "CR[")) |
else if (startswith (name, "CR[")) |
return IA64_RS_CRX; |
return IA64_RS_CRX; |
else if (CONST_STRNEQ (name, "PSR.")) |
else if (startswith (name, "PSR.")) |
return IA64_RS_PSR; |
return IA64_RS_PSR; |
else if (strcmp (name, "InService*") == 0) |
else if (strcmp (name, "InService*") == 0) |
return IA64_RS_INSERVICE; |
return IA64_RS_INSERVICE; |
Line 2444 insert_opcode_dependencies (struct ia64_ |
|
Line 2444 insert_opcode_dependencies (struct ia64_ |
|
int j; |
int j; |
|
|
if (strcmp (opc->name, "cmp.eq.and") == 0 |
if (strcmp (opc->name, "cmp.eq.and") == 0 |
&& CONST_STRNEQ (rs->name, "PR%") |
&& startswith (rs->name, "PR%") |
&& rs->mode == 1) |
&& rs->mode == 1) |
no_class_found = 99; |
no_class_found = 99; |
|
|
Line 2455 insert_opcode_dependencies (struct ia64_ |
|
Line 2455 insert_opcode_dependencies (struct ia64_ |
|
if (in_iclass (opc, ics[rs->regs[j]], NULL, NULL, &ic_note)) |
if (in_iclass (opc, ics[rs->regs[j]], NULL, NULL, &ic_note)) |
{ |
{ |
/* We can ignore ic_note 11 for non PR resources. */ |
/* We can ignore ic_note 11 for non PR resources. */ |
if (ic_note == 11 && ! CONST_STRNEQ (rs->name, "PR")) |
if (ic_note == 11 && ! startswith (rs->name, "PR")) |
ic_note = 0; |
ic_note = 0; |
|
|
if (ic_note != 0 && rs->regnotes[j] != 0 |
if (ic_note != 0 && rs->regnotes[j] != 0 |
Line 2483 insert_opcode_dependencies (struct ia64_ |
|
Line 2483 insert_opcode_dependencies (struct ia64_ |
|
if (in_iclass (opc, ics[rs->chks[j]], NULL, NULL, &ic_note)) |
if (in_iclass (opc, ics[rs->chks[j]], NULL, NULL, &ic_note)) |
{ |
{ |
/* We can ignore ic_note 11 for non PR resources. */ |
/* We can ignore ic_note 11 for non PR resources. */ |
if (ic_note == 11 && ! CONST_STRNEQ (rs->name, "PR")) |
if (ic_note == 11 && ! startswith (rs->name, "PR")) |
ic_note = 0; |
ic_note = 0; |
|
|
if (ic_note != 0 && rs->chknotes[j] != 0 |
if (ic_note != 0 && rs->chknotes[j] != 0 |
Line 2843 main (int argc, char **argv) |
|
Line 2843 main (int argc, char **argv) |
|
collapse_redundant_completers (); |
collapse_redundant_completers (); |
|
|
printf ("/* This file is automatically generated by ia64-gen. Do not edit! */\n"); |
printf ("/* This file is automatically generated by ia64-gen. Do not edit! */\n"); |
printf ("/* Copyright (C) 2007-2020 Free Software Foundation, Inc.\n\ |
printf ("/* Copyright (C) 2007-2022 Free Software Foundation, Inc.\n\ |
\n\ |
\n\ |
This file is part of the GNU opcodes library.\n\ |
This file is part of the GNU opcodes library.\n\ |
\n\ |
\n\ |