projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* alpha-opc.c (unop): Encode with RB as $sp.
[deliverable/binutils-gdb.git]
/
opcodes
/
ia64-gen.c
diff --git
a/opcodes/ia64-gen.c
b/opcodes/ia64-gen.c
index 960540d50ca91aa584ba2dfbb82e4bc2e3ff8068..6443c7c4b250f9f7009be8052acc4997c121aa15 100644
(file)
--- a/
opcodes/ia64-gen.c
+++ b/
opcodes/ia64-gen.c
@@
-1,5
+1,5
@@
/* ia64-gen.c -- Generate a shrunk set of opcode tables
/* ia64-gen.c -- Generate a shrunk set of opcode tables
- Copyright
(c) 1999
Free Software Foundation, Inc.
+ Copyright
1999, 2000, 2001
Free Software Foundation, Inc.
Written by Bob Manson, Cygnus Solutions, <manson@cygnus.com>
This file is part of GDB, GAS, and the GNU binutils.
Written by Bob Manson, Cygnus Solutions, <manson@cygnus.com>
This file is part of GDB, GAS, and the GNU binutils.
@@
-35,10
+35,10
@@
*/
#include <stdio.h>
*/
#include <stdio.h>
-#include <ctype.h>
#include "ansidecl.h"
#include "libiberty.h"
#include "ansidecl.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "sysdep.h"
#include "ia64-opc.h"
#include "ia64-opc-a.c"
#include "sysdep.h"
#include "ia64-opc.h"
#include "ia64-opc-a.c"
@@
-177,7
+177,7
@@
struct rdep
int nchks;
int total_chks; /* total #of terminal insns */
int *chks; /* insn classes which read (RAW), write
int nchks;
int total_chks; /* total #of terminal insns */
int *chks; /* insn classes which read (RAW), write
- (WAW), or write (WAR) this rsrc */
//
+ (WAW), or write (WAR) this rsrc */
int *chknotes; /* dependency notes for each class */
int nregs;
int total_regs; /* total #of terminal insns */
int *chknotes; /* dependency notes for each class */
int nregs;
int total_regs; /* total #of terminal insns */
@@
-281,14
+281,14
@@
insert_deplist(int count, unsigned short *deps)
for (i=0;i < count;i++)
set[deps[i]] = 1;
count = 0;
for (i=0;i < count;i++)
set[deps[i]] = 1;
count = 0;
- for (i=0;i < sizeof(set);i++)
+ for (i=0;i <
(int)
sizeof(set);i++)
if (set[i])
++count;
list = tmalloc(struct deplist);
list->len = count;
list->deps = (unsigned short *)malloc (sizeof(unsigned short) * count);
if (set[i])
++count;
list = tmalloc(struct deplist);
list->len = count;
list->deps = (unsigned short *)malloc (sizeof(unsigned short) * count);
- for (i=0, count=0;i < sizeof(set);i++)
+ for (i=0, count=0;i <
(int)
sizeof(set);i++)
{
if (set[i])
{
{
if (set[i])
{
@@
-399,9
+399,21
@@
fetch_insn_class(const char *full_name, int create)
if ((comment = strchr(name, '[')) != NULL)
is_class = 1;
if ((notestr = strchr(name, '+')) != NULL)
if ((comment = strchr(name, '[')) != NULL)
is_class = 1;
if ((notestr = strchr(name, '+')) != NULL)
+ is_class = 1;
+
+ /* If it is a composite class, then ignore comments and notes that come after
+ the '\\', since they don't apply to the part we are decoding now. */
+ if (xsect)
+ {
+ if (comment > xsect)
+ comment = 0;
+ if (notestr > xsect)
+ notestr = 0;
+ }
+
+ if (notestr)
{
char *nextnotestr;
{
char *nextnotestr;
- is_class = 1;
note = atoi (notestr + 1);
if ((nextnotestr = strchr (notestr + 1, '+')) != NULL)
{
note = atoi (notestr + 1);
if ((nextnotestr = strchr (notestr + 1, '+')) != NULL)
{
@@
-413,8
+425,9
@@
fetch_insn_class(const char *full_name, int create)
}
}
}
}
- /* if it's a composite class, leave the notes and comments in place so that
- we have a unique name for the composite class */
+ /* If it's a composite class, leave the notes and comments in place so that
+ we have a unique name for the composite class. Otherwise, we remove
+ them. */
if (!xsect)
{
if (notestr)
if (!xsect)
{
if (notestr)
@@
-461,7
+474,7
@@
fetch_insn_class(const char *full_name, int create)
existing class or terminal with the same name. */
if ((xsect || comment || notestr) && is_class)
{
existing class or terminal with the same name. */
if ((xsect || comment || notestr) && is_class)
{
- /
/ first, populate with the class we're based on
+ /
* First, populate with the class we're based on. */
char *subname = name;
if (xsect)
*xsect = 0;
char *subname = name;
if (xsect)
*xsect = 0;
@@
-530,7
+543,7
@@
load_insn_classes()
if (fgets (buf, sizeof(buf), fp) == NULL)
break;
if (fgets (buf, sizeof(buf), fp) == NULL)
break;
- while (
isspace
(buf[strlen(buf)-1]))
+ while (
ISSPACE
(buf[strlen(buf)-1]))
buf[strlen(buf)-1] = '\0';
name = tmp = buf;
buf[strlen(buf)-1] = '\0';
name = tmp = buf;
@@
-558,7
+571,7
@@
load_insn_classes()
char *subname;
int sub;
char *subname;
int sub;
- while (*tmp &&
isspace
(*tmp))
+ while (*tmp &&
ISSPACE
(*tmp))
{
++tmp;
if (tmp == buf + sizeof(buf))
{
++tmp;
if (tmp == buf + sizeof(buf))
@@
-620,7
+633,7
@@
parse_resource_users(ref, usersp, nusersp, notesp)
int create = 0;
char *name;
int create = 0;
char *name;
- while (
isspace
(*tmp))
+ while (
ISSPACE
(*tmp))
++tmp;
name = tmp;
while (*tmp && *tmp != ',')
++tmp;
name = tmp;
while (*tmp && *tmp != ',')
@@
-697,6
+710,8
@@
parse_semantics (char *sem)
return IA64_DVS_INSTR;
else if (strcmp (sem, "specific") == 0)
return IA64_DVS_SPECIFIC;
return IA64_DVS_INSTR;
else if (strcmp (sem, "specific") == 0)
return IA64_DVS_SPECIFIC;
+ else if (strcmp (sem, "stop") == 0)
+ return IA64_DVS_STOP;
else
return IA64_DVS_OTHER;
}
else
return IA64_DVS_OTHER;
}
@@
-739,7
+754,7
@@
load_depfile (const char *filename, enum ia64_dependency_mode mode)
if (fgets (buf, sizeof(buf), fp) == NULL)
break;
if (fgets (buf, sizeof(buf), fp) == NULL)
break;
- while (
isspace
(buf[strlen(buf)-1]))
+ while (
ISSPACE
(buf[strlen(buf)-1]))
buf[strlen(buf)-1] = '\0';
name = tmp = buf;
buf[strlen(buf)-1] = '\0';
name = tmp = buf;
@@
-747,21
+762,21
@@
load_depfile (const char *filename, enum ia64_dependency_mode mode)
++tmp;
*tmp++ = '\0';
++tmp;
*tmp++ = '\0';
- while (
isspace
(*tmp))
+ while (
ISSPACE
(*tmp))
++tmp;
regp = tmp;
tmp = strchr (tmp, ';');
if (!tmp)
abort ();
*tmp++ = 0;
++tmp;
regp = tmp;
tmp = strchr (tmp, ';');
if (!tmp)
abort ();
*tmp++ = 0;
- while (
isspace
(*tmp))
+ while (
ISSPACE
(*tmp))
++tmp;
chkp = tmp;
tmp = strchr (tmp, ';');
if (!tmp)
abort ();
*tmp++ = 0;
++tmp;
chkp = tmp;
tmp = strchr (tmp, ';');
if (!tmp)
abort ();
*tmp++ = 0;
- while (
isspace
(*tmp))
+ while (
ISSPACE
(*tmp))
++tmp;
semantics = parse_semantics (tmp);
extra = semantics == IA64_DVS_OTHER ? xstrdup (tmp) : NULL;
++tmp;
semantics = parse_semantics (tmp);
extra = semantics == IA64_DVS_OTHER ? xstrdup (tmp) : NULL;
@@
-800,8
+815,8
@@
irf_operand (int op, const char *field)
if (!field)
{
return op == IA64_OPND_RR_R3 || op == IA64_OPND_DBR_R3
if (!field)
{
return op == IA64_OPND_RR_R3 || op == IA64_OPND_DBR_R3
- || op == IA64_OPND_IBR_R3 || op == IA64_OPND_PKR_R3
-
|| op == IA64_OPND_PMC_R3
|| op == IA64_OPND_PMD_R3
+ || op == IA64_OPND_IBR_R3
|| op == IA64_OPND_PKR_R3
+
|| op == IA64_OPND_PMC_R3
|| op == IA64_OPND_PMD_R3
|| op == IA64_OPND_MSR_R3 || op == IA64_OPND_CPUID_R3;
}
else
|| op == IA64_OPND_MSR_R3 || op == IA64_OPND_CPUID_R3;
}
else
@@
-1053,6
+1068,9
@@
in_iclass(struct ia64_opcode *idesc, struct iclass *ic,
resolved = idesc->operands[0] == IA64_OPND_B2;
else if (strcmp (ic->name, "invala") == 0)
resolved = strcmp (idesc->name, ic->name) == 0;
resolved = idesc->operands[0] == IA64_OPND_B2;
else if (strcmp (ic->name, "invala") == 0)
resolved = strcmp (idesc->name, ic->name) == 0;
+ else if (strncmp (idesc->name, "st", 2) == 0
+ && strstr (format, "M5") != NULL)
+ resolved = idesc->flags & IA64_OPCODE_POSTINC;
else
resolved = 0;
}
else
resolved = 0;
}
@@
-1332,8
+1350,10
@@
lookup_specifier (const char *name)
return IA64_RS_FRb;
if (strstr (name, "GR%") != NULL)
return IA64_RS_GR;
return IA64_RS_FRb;
if (strstr (name, "GR%") != NULL)
return IA64_RS_GR;
- if (strstr (name, "PR%") != NULL)
+ if (strstr (name, "PR%
, % in 1
") != NULL)
return IA64_RS_PR;
return IA64_RS_PR;
+ if (strstr (name, "PR%, % in 16 ") != NULL)
+ return IA64_RS_PRr;
fprintf (stderr, "Warning! Don't know how to specify %% dependency %s\n",
name);
fprintf (stderr, "Warning! Don't know how to specify %% dependency %s\n",
name);
@@
-1455,6
+1475,8
@@
print_dependency_table ()
(int)rdeps[i]->mode, (int)rdeps[i]->semantics, regindex);
if (rdeps[i]->semantics == IA64_DVS_OTHER)
printf ("\"%s\", ", rdeps[i]->extra);
(int)rdeps[i]->mode, (int)rdeps[i]->semantics, regindex);
if (rdeps[i]->semantics == IA64_DVS_OTHER)
printf ("\"%s\", ", rdeps[i]->extra);
+ else
+ printf ("NULL, ");
printf("},\n");
}
printf ("};\n\n");
printf("},\n");
}
printf ("};\n\n");
@@
-1710,6
+1732,7
@@
add_dis_entry (first, opcode, mask, opcodenum, ent, completer_index)
{
abort ();
}
{
abort ();
}
+
while (ent != NULL)
{
ia64_insn newopcode = (opcode & (~ ent->mask)) | ent->bits;
while (ent != NULL)
{
ia64_insn newopcode = (opcode & (~ ent->mask)) | ent->bits;
@@
-2390,7
+2413,7
@@
collapse_redundant_completers ()
int
insert_opcode_dependencies (opc, cmp)
struct ia64_opcode *opc;
int
insert_opcode_dependencies (opc, cmp)
struct ia64_opcode *opc;
- struct completer_entry *cmp;
+ struct completer_entry *cmp
ATTRIBUTE_UNUSED
;
{
/* note all resources which point to this opcode. rfi has the most chks
(79) and cmpxchng has the most regs (54) so 100 here should be enough */
{
/* note all resources which point to this opcode. rfi has the most chks
(79) and cmpxchng has the most regs (54) so 100 here should be enough */
@@
-2550,7
+2573,6
@@
insert_completer_entry (opc, tabent, order)
(*ptr)->is_terminal = 1;
(*ptr)->mask = (ia64_insn)-1;
(*ptr)->bits = opc->opcode;
(*ptr)->is_terminal = 1;
(*ptr)->mask = (ia64_insn)-1;
(*ptr)->bits = opc->opcode;
-
(*ptr)->dependencies = insert_opcode_dependencies (opc, *ptr);
(*ptr)->order = order;
}
(*ptr)->dependencies = insert_opcode_dependencies (opc, *ptr);
(*ptr)->order = order;
}
@@
-2684,6
+2706,7
@@
add_opcode_entry (opc)
}
ordered_table[otlen++] = nent;
}
}
ordered_table[otlen++] = nent;
}
+
insert_completer_entry (opc, *place, opcode_count++);
}
\f
insert_completer_entry (opc, *place, opcode_count++);
}
\f
@@
-2696,12
+2719,14
@@
print_main_table ()
printf ("static const struct ia64_main_table\nmain_table[] = {\n");
while (ptr != NULL)
{
printf ("static const struct ia64_main_table\nmain_table[] = {\n");
while (ptr != NULL)
{
- printf (" { %d, %d, %d, 0x
%llxull, 0x%llxull, { %d, %d, %d, %d, %d }, 0x%x, %d, },\n
",
+ printf (" { %d, %d, %d, 0x",
ptr->name->num,
ptr->opcode->type,
ptr->name->num,
ptr->opcode->type,
- ptr->opcode->num_outputs,
- ptr->opcode->opcode,
- ptr->opcode->mask,
+ ptr->opcode->num_outputs);
+ fprintf_vma (stdout, ptr->opcode->opcode);
+ printf ("ull, 0x");
+ fprintf_vma (stdout, ptr->opcode->mask);
+ printf ("ull, { %d, %d, %d, %d, %d }, 0x%x, %d, },\n",
ptr->opcode->operands[0],
ptr->opcode->operands[1],
ptr->opcode->operands[2],
ptr->opcode->operands[0],
ptr->opcode->operands[1],
ptr->opcode->operands[2],
@@
-2730,7
+2755,9
@@
shrink (table)
}
\f
int
}
\f
int
-main (int argc, char **argv)
+main (argc, argv)
+ int argc;
+ char **argv ATTRIBUTE_UNUSED;
{
if (argc > 1)
{
{
if (argc > 1)
{
This page took
0.027083 seconds
and
4
git commands to generate.