X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=opcodes%2Fia64-gen.c;h=ad91e77248e94fc05a776b0010cfaa3938203980;hb=80752eb0989b85e88af7f1f4627dbed8a42dfe6d;hp=1239e714c1cbcb23931431e8d69781286de62324;hpb=827041555ac443bd57340060f3e034fd7b199dd8;p=binutils-gdb.git diff --git a/opcodes/ia64-gen.c b/opcodes/ia64-gen.c index 1239e714c1c..ad91e77248e 100644 --- a/opcodes/ia64-gen.c +++ b/opcodes/ia64-gen.c @@ -1,5 +1,5 @@ /* ia64-gen.c -- Generate a shrunk set of opcode tables - Copyright (C) 1999-2019 Free Software Foundation, Inc. + Copyright (C) 1999-2023 Free Software Foundation, Inc. Written by Bob Manson, Cygnus Solutions, This file is part of the GNU opcodes library. @@ -53,15 +53,6 @@ #include #define _(String) gettext (String) -/* This is a copy of fprintf_vma from bfd/bfd-in2.h. We have to use this - always, because we might be compiled without BFD64 defined, if configured - for a 32-bit target and --enable-targets=all is used. This will work for - both 32-bit and 64-bit hosts. */ -#define _opcode_int64_low(x) ((unsigned long) (((x) & 0xffffffff))) -#define _opcode_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff)) -#define opcode_fprintf_vma(s,x) \ - fprintf ((s), "%08lx%08lx", _opcode_int64_high (x), _opcode_int64_low (x)) - const char * program_name = NULL; int debug = 0; @@ -467,7 +458,7 @@ fetch_insn_class (const char *full_name, int create) int ind; int is_class = 0; - if (CONST_STRNEQ (full_name, "IC:")) + if (startswith (full_name, "IC:")) { name = xstrdup (full_name + 3); is_class = 1; @@ -746,7 +737,7 @@ parse_resource_users (const char *ref, int **usersp, int *nusersp, 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 table). */ - if (! CONST_STRNEQ (name, "IC:") || xsect != NULL) + if (! startswith (name, "IC:") || xsect != NULL) create = 1; iclass = fetch_insn_class (name, create); @@ -1039,7 +1030,7 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic, 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 only keep a later one if it looks like it's more restrictive. */ @@ -1055,7 +1046,7 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic, else format = ic->comment; } - else if (CONST_STRNEQ (ic->comment, "Field")) + else if (startswith (ic->comment, "Field")) { if (field) warn (_("overlapping field %s->%s\n"), @@ -1069,7 +1060,7 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic, instructions. */ 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 len = strlen(ic->name); @@ -1128,32 +1119,32 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic, if (resolved && format) { - if (CONST_STRNEQ (idesc->name, "dep") + if (startswith (idesc->name, "dep") && strstr (format, "I13") != NULL) resolved = idesc->operands[1] == IA64_OPND_IMM8; - else if (CONST_STRNEQ (idesc->name, "chk") + else if (startswith (idesc->name, "chk") && strstr (format, "M21") != NULL) 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 && (idesc->operands[1] == IA64_OPND_R2 || 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) 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) resolved = idesc->operands[1] == IA64_OPND_TGT25c; - else if (CONST_STRNEQ (idesc->name, "brp") + else if (startswith (idesc->name, "brp") && strstr (format, "B7") != NULL) resolved = idesc->operands[0] == IA64_OPND_B2; else if (strcmp (ic->name, "invala") == 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, "M10") != NULL)) 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, "M12") != NULL || strstr (format, "M7 M8") != NULL)) @@ -1166,7 +1157,7 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic, plain brl matches brl.cond. */ if (!resolved && (strcmp (idesc->name, "brl") == 0 - || CONST_STRNEQ (idesc->name, "brl.")) + || startswith (idesc->name, "brl.")) && strcmp (ic->name, "brl.cond") == 0) { resolved = 1; @@ -1175,7 +1166,7 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic, /* Misc br variations ('.cond' is optional). */ if (!resolved && (strcmp (idesc->name, "br") == 0 - || CONST_STRNEQ (idesc->name, "br.")) + || startswith (idesc->name, "br.")) && strcmp (ic->name, "br.cond") == 0) { if (format) @@ -1188,7 +1179,7 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic, } /* probe variations. */ - if (!resolved && CONST_STRNEQ (idesc->name, "probe")) + if (!resolved && startswith (idesc->name, "probe")) { resolved = strcmp (ic->name, "probe") == 0 && !((strstr (idesc->name, "fault") != NULL) @@ -1222,7 +1213,7 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic, } /* 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); } @@ -1487,13 +1478,13 @@ lookup_specifier (const char *name) warn (_("Don't know how to specify # dependency %s\n"), name); } - else if (CONST_STRNEQ (name, "AR[FPSR]")) + else if (startswith (name, "AR[FPSR]")) return IA64_RS_AR_FPSR; - else if (CONST_STRNEQ (name, "AR[")) + else if (startswith (name, "AR[")) return IA64_RS_ARX; - else if (CONST_STRNEQ (name, "CR[")) + else if (startswith (name, "CR[")) return IA64_RS_CRX; - else if (CONST_STRNEQ (name, "PSR.")) + else if (startswith (name, "PSR.")) return IA64_RS_PSR; else if (strcmp (name, "InService*") == 0) return IA64_RS_INSERVICE; @@ -2444,7 +2435,7 @@ insert_opcode_dependencies (struct ia64_opcode *opc, int j; if (strcmp (opc->name, "cmp.eq.and") == 0 - && CONST_STRNEQ (rs->name, "PR%") + && startswith (rs->name, "PR%") && rs->mode == 1) no_class_found = 99; @@ -2455,7 +2446,7 @@ insert_opcode_dependencies (struct ia64_opcode *opc, if (in_iclass (opc, ics[rs->regs[j]], NULL, NULL, &ic_note)) { /* 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; if (ic_note != 0 && rs->regnotes[j] != 0 @@ -2483,7 +2474,7 @@ insert_opcode_dependencies (struct ia64_opcode *opc, if (in_iclass (opc, ics[rs->chks[j]], NULL, NULL, &ic_note)) { /* 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; if (ic_note != 0 && rs->chknotes[j] != 0 @@ -2711,14 +2702,13 @@ print_main_table (void) printf ("static const struct ia64_main_table\nmain_table[] = {\n"); while (ptr != NULL) { - printf (" { %d, %d, %d, 0x", + printf (" { %d, %d, %d, 0x%016" PRIx64 "ull, 0x%016" PRIx64 + "ull, { %d, %d, %d, %d, %d }, 0x%x, %d, },\n", ptr->name->num, ptr->opcode->type, - ptr->opcode->num_outputs); - opcode_fprintf_vma (stdout, ptr->opcode->opcode); - printf ("ull, 0x"); - opcode_fprintf_vma (stdout, ptr->opcode->mask); - printf ("ull, { %d, %d, %d, %d, %d }, 0x%x, %d, },\n", + ptr->opcode->num_outputs, + ptr->opcode->opcode, + ptr->opcode->mask, ptr->opcode->operands[0], ptr->opcode->operands[1], ptr->opcode->operands[2], @@ -2843,7 +2833,7 @@ main (int argc, char **argv) collapse_redundant_completers (); printf ("/* This file is automatically generated by ia64-gen. Do not edit! */\n"); - printf ("/* Copyright (C) 2007-2019 Free Software Foundation, Inc.\n\ + printf ("/* Copyright (C) 2007-2023 Free Software Foundation, Inc.\n\ \n\ This file is part of the GNU opcodes library.\n\ \n\