/* 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, <manson@cygnus.com>
This file is part of the GNU opcodes library.
#include <libintl.h>
#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;
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;
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);
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. */
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"),
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);
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))
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;
/* 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)
}
/* 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)
}
/* 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);
}
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;
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;
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
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
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],
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\