2002-11-21 Andrew Cagney <ac131313@redhat.com>
* Makefile.in: Update copyright. IGEN contributed to the FSF.
* filter.c, filter.h, filter_host.c, filter_host.h: Ditto.
* gen-engine.c, gen-engine.h, gen-icache.c, gen-icache.h: Ditto.
* gen-idecode.c, gen-idecode.h, gen-itable.c: Ditto.
* gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h, gen.c: Ditto.
* gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:09:40 +01:00
|
|
|
/* The IGEN simulator generator for GDB, the GNU Debugger.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2012-01-04 09:28:28 +01:00
|
|
|
Copyright 2002, 2007-2012 Free Software Foundation, Inc.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* Makefile.in: Update copyright. IGEN contributed to the FSF.
* filter.c, filter.h, filter_host.c, filter_host.h: Ditto.
* gen-engine.c, gen-engine.h, gen-icache.c, gen-icache.h: Ditto.
* gen-idecode.c, gen-idecode.h, gen-itable.c: Ditto.
* gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h, gen.c: Ditto.
* gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:09:40 +01:00
|
|
|
Contributed by Andrew Cagney.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* Makefile.in: Update copyright. IGEN contributed to the FSF.
* filter.c, filter.h, filter_host.c, filter_host.h: Ditto.
* gen-engine.c, gen-engine.h, gen-icache.c, gen-icache.h: Ditto.
* gen-idecode.c, gen-idecode.h, gen-itable.c: Ditto.
* gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h, gen.c: Ditto.
* gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:09:40 +01:00
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-24 16:30:15 +02:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* Makefile.in: Update copyright. IGEN contributed to the FSF.
* filter.c, filter.h, filter_host.c, filter_host.h: Ditto.
* gen-engine.c, gen-engine.h, gen-icache.c, gen-icache.h: Ditto.
* gen-idecode.c, gen-idecode.h, gen-itable.c: Ditto.
* gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h, gen.c: Ditto.
* gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:09:40 +01:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-24 16:30:15 +02:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
#include "misc.h"
|
|
|
|
#include "lf.h"
|
|
|
|
#include "table.h"
|
|
|
|
#include "filter.h"
|
|
|
|
|
|
|
|
#include "igen.h"
|
|
|
|
#include "ld-insn.h"
|
|
|
|
#include "ld-decode.h"
|
|
|
|
#include "gen.h"
|
|
|
|
|
|
|
|
static insn_uint
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
sub_val (insn_uint val, int val_last_pos, int first_pos, int last_pos)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
return ((val >> (val_last_pos - last_pos))
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
& (((insn_uint) 1 << (last_pos - first_pos + 1)) - 1));
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
update_depth (lf *file, gen_entry *entry, int depth, void *data)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
int *max_depth = (int *) data;
|
1999-04-16 03:35:26 +02:00
|
|
|
if (*max_depth < depth)
|
|
|
|
*max_depth = depth;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
gen_entry_depth (gen_entry *table)
|
|
|
|
{
|
|
|
|
int depth = 0;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
gen_entry_traverse_tree (NULL, table, 1, NULL, /*start */
|
|
|
|
update_depth, NULL, /*end */
|
|
|
|
&depth); /* data */
|
1999-04-16 03:35:26 +02:00
|
|
|
return depth;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
print_gen_entry_path (line_ref *line, gen_entry *table, error_func *print)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
if (table->parent == NULL)
|
|
|
|
{
|
|
|
|
if (table->top->model != NULL)
|
|
|
|
print (line, "%s", table->top->model->name);
|
|
|
|
else
|
|
|
|
print (line, "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
print_gen_entry_path (line, table->parent, print);
|
|
|
|
print (NULL, ".%d", table->opcode_nr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
print_gen_entry_insns (gen_entry *table,
|
|
|
|
error_func *print,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
char *first_message, char *next_message)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
insn_list *i;
|
|
|
|
char *message;
|
|
|
|
message = first_message;
|
|
|
|
for (i = table->insns; i != NULL; i = i->next)
|
|
|
|
{
|
|
|
|
insn_entry *insn = i->insn;
|
|
|
|
print_gen_entry_path (insn->line, table, print);
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
print (NULL, ": %s.%s %s\n", insn->format_name, insn->name, message);
|
1999-04-16 03:35:26 +02:00
|
|
|
if (next_message != NULL)
|
|
|
|
message = next_message;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* same as strcmp */
|
|
|
|
static int
|
|
|
|
insn_field_cmp (insn_word_entry *l, insn_word_entry *r)
|
|
|
|
{
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
int bit_nr;
|
|
|
|
if (l == NULL && r == NULL)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return 0; /* all previous fields the same */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (l == NULL)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return -1; /* left shorter than right */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (r == NULL)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return +1; /* left longer than right */
|
|
|
|
for (bit_nr = 0; bit_nr < options.insn_bit_size; bit_nr++)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
if (l->bit[bit_nr]->field->type != insn_field_string)
|
|
|
|
continue;
|
|
|
|
if (r->bit[bit_nr]->field->type != insn_field_string)
|
|
|
|
continue;
|
|
|
|
if (l->bit[bit_nr]->field->conditions == NULL)
|
|
|
|
continue;
|
|
|
|
if (r->bit[bit_nr]->field->conditions == NULL)
|
|
|
|
continue;
|
|
|
|
if (0)
|
|
|
|
printf ("%s%s%s VS %s%s%s\n",
|
|
|
|
l->bit[bit_nr]->field->val_string,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
l->bit[bit_nr]->field->conditions->test ==
|
|
|
|
insn_field_cond_eq ? "=" : "!",
|
|
|
|
l->bit[bit_nr]->field->conditions->string,
|
1999-04-16 03:35:26 +02:00
|
|
|
r->bit[bit_nr]->field->val_string,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
r->bit[bit_nr]->field->conditions->test ==
|
|
|
|
insn_field_cond_eq ? "=" : "!",
|
1999-04-16 03:35:26 +02:00
|
|
|
r->bit[bit_nr]->field->conditions->string);
|
|
|
|
if (l->bit[bit_nr]->field->conditions->test == insn_field_cond_eq
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
&& r->bit[bit_nr]->field->conditions->test ==
|
|
|
|
insn_field_cond_eq)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
if (l->bit[bit_nr]->field->conditions->type ==
|
|
|
|
insn_field_cond_field
|
|
|
|
&& r->bit[bit_nr]->field->conditions->type ==
|
|
|
|
insn_field_cond_field)
|
1999-04-16 03:35:26 +02:00
|
|
|
/* somewhat arbitrary */
|
|
|
|
{
|
|
|
|
int cmp = strcmp (l->bit[bit_nr]->field->conditions->string,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
r->bit[bit_nr]->field->conditions->
|
|
|
|
string);
|
1999-04-16 03:35:26 +02:00
|
|
|
if (cmp != 0)
|
|
|
|
return cmp;
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
}
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
if (l->bit[bit_nr]->field->conditions->type ==
|
|
|
|
insn_field_cond_field)
|
1999-04-16 03:35:26 +02:00
|
|
|
return +1;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
if (r->bit[bit_nr]->field->conditions->type ==
|
|
|
|
insn_field_cond_field)
|
1999-04-16 03:35:26 +02:00
|
|
|
return -1;
|
|
|
|
/* The case of both fields having constant values should have
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
already have been handled because such fields are converted
|
2011-07-08 08:24:11 +02:00
|
|
|
into normal constant fields, but we must not make this
|
|
|
|
an assert, as we wouldn't gracefully handle an (invalid)
|
|
|
|
duplicate insn description. */
|
1999-04-16 03:35:26 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (l->bit[bit_nr]->field->conditions->test == insn_field_cond_eq)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return +1; /* left = only */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (r->bit[bit_nr]->field->conditions->test == insn_field_cond_eq)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return -1; /* right = only */
|
1999-04-16 03:35:26 +02:00
|
|
|
/* FIXME: Need to some what arbitrarily order conditional lists */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
l = l->next;
|
|
|
|
r = r->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* same as strcmp */
|
|
|
|
static int
|
|
|
|
insn_word_cmp (insn_word_entry *l, insn_word_entry *r)
|
|
|
|
{
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
int bit_nr;
|
|
|
|
if (l == NULL && r == NULL)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return 0; /* all previous fields the same */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (l == NULL)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return -1; /* left shorter than right */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (r == NULL)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return +1; /* left longer than right */
|
|
|
|
for (bit_nr = 0; bit_nr < options.insn_bit_size; bit_nr++)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
if (l->bit[bit_nr]->mask < r->bit[bit_nr]->mask)
|
|
|
|
return -1;
|
|
|
|
if (l->bit[bit_nr]->mask > r->bit[bit_nr]->mask)
|
|
|
|
return 1;
|
|
|
|
if (l->bit[bit_nr]->value < r->bit[bit_nr]->value)
|
|
|
|
return -1;
|
|
|
|
if (l->bit[bit_nr]->value > r->bit[bit_nr]->value)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
l = l->next;
|
|
|
|
r = r->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* same as strcmp */
|
|
|
|
static int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
opcode_bit_cmp (opcode_bits *l, opcode_bits *r)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
if (l == NULL && r == NULL)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return 0; /* all previous bits the same */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (l == NULL)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return -1; /* left shorter than right */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (r == NULL)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return +1; /* left longer than right */
|
1999-04-16 03:35:26 +02:00
|
|
|
/* most significant word */
|
|
|
|
if (l->field->word_nr < r->field->word_nr)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return +1; /* left has more significant word */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (l->field->word_nr > r->field->word_nr)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return -1; /* right has more significant word */
|
1999-04-16 03:35:26 +02:00
|
|
|
/* most significant bit? */
|
|
|
|
if (l->first < r->first)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return +1; /* left as more significant bit */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (l->first > r->first)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return -1; /* right as more significant bit */
|
1999-04-16 03:35:26 +02:00
|
|
|
/* nr bits? */
|
|
|
|
if (l->last < r->last)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return +1; /* left as less bits */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (l->last > r->last)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return -1; /* right as less bits */
|
1999-04-16 03:35:26 +02:00
|
|
|
/* value? */
|
|
|
|
if (l->value < r->value)
|
|
|
|
return -1;
|
|
|
|
if (l->value > r->value)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* same as strcmp */
|
|
|
|
static int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
opcode_bits_cmp (opcode_bits *l, opcode_bits *r)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
int cmp;
|
|
|
|
if (l == NULL && r == NULL)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return 0; /* all previous bits the same */
|
1999-04-16 03:35:26 +02:00
|
|
|
cmp = opcode_bit_cmp (l, r);
|
|
|
|
if (cmp != 0)
|
|
|
|
return cmp;
|
|
|
|
l = l->next;
|
|
|
|
r = r->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* same as strcmp */
|
|
|
|
static opcode_bits *
|
|
|
|
new_opcode_bits (opcode_bits *old_bits,
|
|
|
|
int value,
|
|
|
|
int first,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
int last, insn_field_entry *field, opcode_field *opcode)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
opcode_bits *new_bits = ZALLOC (opcode_bits);
|
|
|
|
new_bits->field = field;
|
|
|
|
new_bits->value = value;
|
|
|
|
new_bits->first = first;
|
|
|
|
new_bits->last = last;
|
|
|
|
new_bits->opcode = opcode;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
if (old_bits != NULL)
|
|
|
|
{
|
|
|
|
opcode_bits *new_list;
|
|
|
|
opcode_bits **last = &new_list;
|
|
|
|
new_list = new_opcode_bits (old_bits->next,
|
|
|
|
old_bits->value,
|
|
|
|
old_bits->first,
|
|
|
|
old_bits->last,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
old_bits->field, old_bits->opcode);
|
1999-04-16 03:35:26 +02:00
|
|
|
while (*last != NULL)
|
|
|
|
{
|
|
|
|
int cmp = opcode_bit_cmp (new_bits, *last);
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
if (cmp < 0) /* new < new_list */
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (cmp == 0)
|
|
|
|
{
|
|
|
|
ERROR ("Duplicated insn bits in list");
|
|
|
|
}
|
|
|
|
last = &(*last)->next;
|
|
|
|
}
|
|
|
|
new_bits->next = *last;
|
|
|
|
*last = new_bits;
|
|
|
|
return new_list;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return new_bits;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-03-24 01:43:28 +01:00
|
|
|
/* Same as strcmp(). */
|
|
|
|
static int
|
2002-11-23 00:20:46 +01:00
|
|
|
name_cmp (const char *l, const char *r)
|
2002-03-24 01:43:28 +01:00
|
|
|
{
|
|
|
|
if (l == NULL && r == NULL)
|
|
|
|
return 0;
|
|
|
|
if (l != NULL && r == NULL)
|
|
|
|
return -1;
|
|
|
|
if (l == NULL && r != NULL)
|
|
|
|
return +1;
|
|
|
|
return strcmp (l, r);
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
typedef enum
|
|
|
|
{
|
1999-04-16 03:35:26 +02:00
|
|
|
merge_duplicate_insns,
|
|
|
|
report_duplicate_insns,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
}
|
|
|
|
duplicate_insn_actions;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
static insn_list *
|
|
|
|
insn_list_insert (insn_list **cur_insn_ptr,
|
|
|
|
int *nr_insns,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
insn_entry * insn,
|
1999-04-16 03:35:26 +02:00
|
|
|
opcode_bits *expanded_bits,
|
|
|
|
opcode_field *opcodes,
|
|
|
|
int nr_prefetched_words,
|
|
|
|
duplicate_insn_actions duplicate_action)
|
|
|
|
{
|
|
|
|
/* insert it according to the order of the fields & bits */
|
|
|
|
for (; (*cur_insn_ptr) != NULL; cur_insn_ptr = &(*cur_insn_ptr)->next)
|
|
|
|
{
|
|
|
|
int cmp;
|
|
|
|
|
|
|
|
/* key#1 sort according to the constant fields of each instruction */
|
|
|
|
cmp = insn_word_cmp (insn->words, (*cur_insn_ptr)->insn->words);
|
|
|
|
if (cmp < 0)
|
|
|
|
break;
|
|
|
|
else if (cmp > 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* key#2 sort according to the expanded bits of each instruction */
|
|
|
|
cmp = opcode_bits_cmp (expanded_bits, (*cur_insn_ptr)->expanded_bits);
|
|
|
|
if (cmp < 0)
|
|
|
|
break;
|
|
|
|
else if (cmp > 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* key#3 sort according to the non-constant fields of each instruction */
|
|
|
|
cmp = insn_field_cmp (insn->words, (*cur_insn_ptr)->insn->words);
|
|
|
|
if (cmp < 0)
|
|
|
|
break;
|
|
|
|
else if (cmp > 0)
|
|
|
|
continue;
|
|
|
|
|
2002-11-23 00:20:46 +01:00
|
|
|
if (duplicate_action == merge_duplicate_insns)
|
|
|
|
{
|
|
|
|
/* key#4: If we're going to merge duplicates, also sort
|
|
|
|
according to the format_name. Two instructions with
|
|
|
|
identical decode patterns, but different names, are
|
|
|
|
considered different when merging. Duplicates are only
|
|
|
|
important when creating a decode table (implied by
|
|
|
|
report_duplicate_insns) as such a table only has the
|
|
|
|
instruction's bit code as a way of differentiating
|
|
|
|
between instructions. */
|
|
|
|
int cmp = name_cmp (insn->format_name,
|
|
|
|
(*cur_insn_ptr)->insn->format_name);
|
|
|
|
if (cmp < 0)
|
|
|
|
break;
|
|
|
|
else if (cmp > 0)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (duplicate_action == merge_duplicate_insns)
|
|
|
|
{
|
|
|
|
/* key#5: If we're going to merge duplicates, also sort
|
|
|
|
according to the name. See comment above for
|
|
|
|
format_name. */
|
|
|
|
int cmp = name_cmp (insn->name, (*cur_insn_ptr)->insn->name);
|
|
|
|
if (cmp < 0)
|
|
|
|
break;
|
|
|
|
else if (cmp > 0)
|
|
|
|
continue;
|
|
|
|
}
|
2002-03-24 01:43:28 +01:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
/* duplicate keys, report problem */
|
|
|
|
switch (duplicate_action)
|
|
|
|
{
|
|
|
|
case report_duplicate_insns:
|
|
|
|
/* It would appear that we have two instructions with the
|
|
|
|
same constant field values across all words and bits.
|
|
|
|
This error can also occure when insn_field_cmp() is
|
|
|
|
failing to differentiate between two instructions that
|
|
|
|
differ only in their conditional fields. */
|
|
|
|
warning (insn->line,
|
|
|
|
"Two instructions with identical constant fields\n");
|
|
|
|
error ((*cur_insn_ptr)->insn->line,
|
|
|
|
"Location of duplicate instruction\n");
|
|
|
|
case merge_duplicate_insns:
|
|
|
|
/* Add the opcode path to the instructions list */
|
2002-11-23 00:20:46 +01:00
|
|
|
if (options.trace.insn_insertion)
|
|
|
|
{
|
|
|
|
notify ((*cur_insn_ptr)->insn->line,
|
|
|
|
"%s.%s: insert merge %s.%s\n",
|
|
|
|
(*cur_insn_ptr)->insn->format_name,
|
|
|
|
(*cur_insn_ptr)->insn->name,
|
|
|
|
insn->format_name,
|
|
|
|
insn->name);
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
if (opcodes != NULL)
|
|
|
|
{
|
|
|
|
insn_opcodes **last = &(*cur_insn_ptr)->opcodes;
|
|
|
|
while (*last != NULL)
|
|
|
|
{
|
|
|
|
last = &(*last)->next;
|
|
|
|
}
|
|
|
|
(*last) = ZALLOC (insn_opcodes);
|
|
|
|
(*last)->opcode = opcodes;
|
|
|
|
}
|
|
|
|
/* Use the larger nr_prefetched_words */
|
|
|
|
if ((*cur_insn_ptr)->nr_prefetched_words < nr_prefetched_words)
|
|
|
|
(*cur_insn_ptr)->nr_prefetched_words = nr_prefetched_words;
|
|
|
|
return (*cur_insn_ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
/* create a new list entry and insert it */
|
|
|
|
{
|
|
|
|
insn_list *new_insn = ZALLOC (insn_list);
|
2002-11-23 00:20:46 +01:00
|
|
|
if (options.trace.insn_insertion)
|
|
|
|
{
|
|
|
|
notify (insn->line,
|
|
|
|
"%s.%s: insert new\n",
|
|
|
|
insn->format_name,
|
|
|
|
insn->name);
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
new_insn->insn = insn;
|
|
|
|
new_insn->expanded_bits = expanded_bits;
|
|
|
|
new_insn->next = (*cur_insn_ptr);
|
|
|
|
new_insn->nr_prefetched_words = nr_prefetched_words;
|
|
|
|
if (opcodes != NULL)
|
|
|
|
{
|
|
|
|
new_insn->opcodes = ZALLOC (insn_opcodes);
|
|
|
|
new_insn->opcodes->opcode = opcodes;
|
|
|
|
}
|
|
|
|
(*cur_insn_ptr) = new_insn;
|
|
|
|
}
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
*nr_insns += 1;
|
|
|
|
|
|
|
|
return (*cur_insn_ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern void
|
|
|
|
gen_entry_traverse_tree (lf *file,
|
|
|
|
gen_entry *table,
|
|
|
|
int depth,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
gen_entry_handler * start,
|
|
|
|
gen_entry_handler * leaf,
|
|
|
|
gen_entry_handler * end, void *data)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
gen_entry *entry;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
|
|
|
|
ASSERT (table !=NULL);
|
1999-04-16 03:35:26 +02:00
|
|
|
ASSERT (table->opcode != NULL);
|
|
|
|
ASSERT (table->nr_entries > 0);
|
|
|
|
ASSERT (table->entries != 0);
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
/* prefix */
|
|
|
|
if (start != NULL && depth >= 0)
|
|
|
|
{
|
|
|
|
start (file, table, depth, data);
|
|
|
|
}
|
|
|
|
/* infix leaves */
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
for (entry = table->entries; entry != NULL; entry = entry->sibling)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
if (entry->entries != NULL && depth != 0)
|
|
|
|
{
|
|
|
|
gen_entry_traverse_tree (file, entry, depth + 1,
|
|
|
|
start, leaf, end, data);
|
|
|
|
}
|
|
|
|
else if (depth >= 0)
|
|
|
|
{
|
|
|
|
if (leaf != NULL)
|
|
|
|
{
|
|
|
|
leaf (file, entry, depth, data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* postfix */
|
|
|
|
if (end != NULL && depth >= 0)
|
|
|
|
{
|
|
|
|
end (file, table, depth, data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* create a list element containing a single gen_table entry */
|
|
|
|
|
|
|
|
static gen_list *
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
make_table (insn_table *isa, decode_table *rules, model_entry *model)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
insn_entry *insn;
|
|
|
|
gen_list *entry = ZALLOC (gen_list);
|
|
|
|
entry->table = ZALLOC (gen_entry);
|
|
|
|
entry->table->top = entry;
|
|
|
|
entry->model = model;
|
|
|
|
entry->isa = isa;
|
|
|
|
for (insn = isa->insns; insn != NULL; insn = insn->next)
|
|
|
|
{
|
|
|
|
if (model == NULL
|
|
|
|
|| insn->processors == NULL
|
|
|
|
|| filter_is_member (insn->processors, model->name))
|
|
|
|
{
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
insn_list_insert (&entry->table->insns, &entry->table->nr_insns, insn, NULL, /* expanded_bits - none yet */
|
|
|
|
NULL, /* opcodes - none yet */
|
|
|
|
0, /* nr_prefetched_words - none yet */
|
1999-04-16 03:35:26 +02:00
|
|
|
report_duplicate_insns);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
entry->table->opcode_rule = rules;
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gen_table *
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
make_gen_tables (insn_table *isa, decode_table *rules)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
gen_table *gen = ZALLOC (gen_table);
|
|
|
|
gen->isa = isa;
|
|
|
|
gen->rules = rules;
|
|
|
|
if (options.gen.multi_sim)
|
|
|
|
{
|
|
|
|
gen_list **last = &gen->tables;
|
|
|
|
model_entry *model;
|
|
|
|
filter *processors;
|
|
|
|
if (options.model_filter != NULL)
|
|
|
|
processors = options.model_filter;
|
|
|
|
else
|
|
|
|
processors = isa->model->processors;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
for (model = isa->model->models; model != NULL; model = model->next)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
if (filter_is_member (processors, model->name))
|
|
|
|
{
|
|
|
|
*last = make_table (isa, rules, model);
|
|
|
|
last = &(*last)->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gen->tables = make_table (isa, rules, NULL);
|
|
|
|
}
|
|
|
|
return gen;
|
|
|
|
}
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
/****************************************************************/
|
|
|
|
|
|
|
|
/* Is the bit, according to the decode rule, identical across all the
|
|
|
|
instructions? */
|
|
|
|
static int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
insns_bit_useless (insn_list *insns, decode_table *rule, int bit_nr)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
insn_list *entry;
|
|
|
|
int value = -1;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
int is_useless = 1; /* cleared if something actually found */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* check the instructions for some constant value in at least one of
|
|
|
|
the bit fields */
|
|
|
|
for (entry = insns; entry != NULL; entry = entry->next)
|
|
|
|
{
|
|
|
|
insn_word_entry *word = entry->insn->word[rule->word_nr];
|
|
|
|
insn_bit_entry *bit = word->bit[bit_nr];
|
|
|
|
switch (bit->field->type)
|
|
|
|
{
|
|
|
|
case insn_field_invalid:
|
|
|
|
ASSERT (0);
|
|
|
|
break;
|
|
|
|
case insn_field_wild:
|
|
|
|
case insn_field_reserved:
|
|
|
|
/* neither useless or useful - ignore */
|
|
|
|
break;
|
|
|
|
case insn_field_int:
|
|
|
|
switch (rule->search)
|
|
|
|
{
|
|
|
|
case decode_find_strings:
|
|
|
|
/* an integer isn't a string */
|
|
|
|
return 1;
|
|
|
|
case decode_find_constants:
|
|
|
|
case decode_find_mixed:
|
|
|
|
/* an integer is useful if its value isn't the same
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
between all instructions. The first time through the
|
|
|
|
value is saved, the second time through (if the
|
|
|
|
values differ) it is marked as useful. */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (value < 0)
|
|
|
|
value = bit->value;
|
|
|
|
else if (value != bit->value)
|
|
|
|
is_useless = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case insn_field_string:
|
|
|
|
switch (rule->search)
|
|
|
|
{
|
|
|
|
case decode_find_strings:
|
|
|
|
/* at least one string, keep checking */
|
|
|
|
is_useless = 0;
|
|
|
|
break;
|
|
|
|
case decode_find_constants:
|
|
|
|
case decode_find_mixed:
|
|
|
|
if (filter_is_member (rule->constant_field_names,
|
|
|
|
bit->field->val_string))
|
|
|
|
/* a string field forced to constant? */
|
|
|
|
is_useless = 0;
|
2011-07-08 08:24:11 +02:00
|
|
|
else if (bit->field->conditions != NULL
|
|
|
|
&& bit->field->conditions->test == insn_field_cond_eq
|
|
|
|
&& bit->field->conditions->type == insn_field_cond_value)
|
|
|
|
{
|
|
|
|
int shift = bit->field->last - bit_nr;
|
|
|
|
int bitvalue = (bit->field->conditions->value >> shift) & 1;
|
|
|
|
|
|
|
|
if (value < 0)
|
|
|
|
value = bitvalue;
|
|
|
|
else if (value != bitvalue)
|
|
|
|
is_useless = 0;
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
else if (rule->search == decode_find_constants)
|
|
|
|
/* the string field isn't constant */
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Given only one constant value has been found, check through all
|
|
|
|
the instructions to see if at least one conditional makes it
|
|
|
|
usefull */
|
|
|
|
if (value >= 0 && is_useless)
|
|
|
|
{
|
|
|
|
for (entry = insns; entry != NULL; entry = entry->next)
|
|
|
|
{
|
|
|
|
insn_word_entry *word = entry->insn->word[rule->word_nr];
|
|
|
|
insn_bit_entry *bit = word->bit[bit_nr];
|
|
|
|
switch (bit->field->type)
|
|
|
|
{
|
|
|
|
case insn_field_invalid:
|
|
|
|
ASSERT (0);
|
|
|
|
break;
|
|
|
|
case insn_field_wild:
|
|
|
|
case insn_field_reserved:
|
|
|
|
case insn_field_int:
|
|
|
|
/* already processed */
|
|
|
|
break;
|
|
|
|
case insn_field_string:
|
|
|
|
switch (rule->search)
|
|
|
|
{
|
|
|
|
case decode_find_strings:
|
|
|
|
case decode_find_constants:
|
|
|
|
/* already processed */
|
|
|
|
break;
|
|
|
|
case decode_find_mixed:
|
|
|
|
/* string field with conditions. If this condition
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
eliminates the value then the compare is useful */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (bit->field->conditions != NULL)
|
|
|
|
{
|
|
|
|
insn_field_cond *condition;
|
|
|
|
int shift = bit->field->last - bit_nr;
|
|
|
|
for (condition = bit->field->conditions;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
condition != NULL; condition = condition->next)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
switch (condition->type)
|
|
|
|
{
|
|
|
|
case insn_field_cond_value:
|
|
|
|
switch (condition->test)
|
|
|
|
{
|
|
|
|
case insn_field_cond_ne:
|
|
|
|
if (((condition->value >> shift) & 1)
|
|
|
|
== (unsigned) value)
|
|
|
|
/* conditional field excludes the
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
current value */
|
1999-04-16 03:35:26 +02:00
|
|
|
is_useless = 0;
|
|
|
|
break;
|
|
|
|
case insn_field_cond_eq:
|
|
|
|
if (((condition->value >> shift) & 1)
|
|
|
|
!= (unsigned) value)
|
|
|
|
/* conditional field requires the
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
current value */
|
1999-04-16 03:35:26 +02:00
|
|
|
is_useless = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case insn_field_cond_field:
|
|
|
|
/* are these handled separatly? */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return is_useless;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* go through a gen-table's list of instruction formats looking for a
|
|
|
|
range of bits that meet the decode table RULEs requirements */
|
|
|
|
|
|
|
|
static opcode_field *
|
|
|
|
gen_entry_find_opcode_field (insn_list *insns,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
decode_table *rule, int string_only)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
opcode_field curr_opcode;
|
|
|
|
ASSERT (rule != NULL);
|
|
|
|
|
|
|
|
memset (&curr_opcode, 0, sizeof (curr_opcode));
|
|
|
|
curr_opcode.word_nr = rule->word_nr;
|
|
|
|
curr_opcode.first = rule->first;
|
|
|
|
curr_opcode.last = rule->last;
|
|
|
|
|
|
|
|
/* Try to reduce the size of first..last in accordance with the
|
|
|
|
decode rules */
|
|
|
|
|
|
|
|
while (curr_opcode.first <= rule->last)
|
|
|
|
{
|
|
|
|
if (insns_bit_useless (insns, rule, curr_opcode.first))
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
curr_opcode.first++;
|
1999-04-16 03:35:26 +02:00
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
while (curr_opcode.last >= rule->first)
|
|
|
|
{
|
|
|
|
if (insns_bit_useless (insns, rule, curr_opcode.last))
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
curr_opcode.last--;
|
1999-04-16 03:35:26 +02:00
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* did the final opcode field end up being empty? */
|
|
|
|
if (curr_opcode.first > curr_opcode.last)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
ASSERT (curr_opcode.last >= rule->first);
|
|
|
|
ASSERT (curr_opcode.first <= rule->last);
|
|
|
|
ASSERT (curr_opcode.first <= curr_opcode.last);
|
|
|
|
|
|
|
|
/* Ensure that, for the non string only case, the opcode includes
|
|
|
|
the range forced_first .. forced_last */
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
if (!string_only && curr_opcode.first > rule->force_first)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
curr_opcode.first = rule->force_first;
|
|
|
|
}
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
if (!string_only && curr_opcode.last < rule->force_last)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
curr_opcode.last = rule->force_last;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* For the string only case, force just the lower bound (so that the
|
|
|
|
shift can be eliminated) */
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
if (string_only && rule->force_last == options.insn_bit_size - 1)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
curr_opcode.last = options.insn_bit_size - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* handle any special cases */
|
|
|
|
switch (rule->type)
|
|
|
|
{
|
|
|
|
case normal_decode_rule:
|
|
|
|
/* let the above apply */
|
|
|
|
curr_opcode.nr_opcodes =
|
|
|
|
(1 << (curr_opcode.last - curr_opcode.first + 1));
|
|
|
|
break;
|
|
|
|
case boolean_rule:
|
|
|
|
curr_opcode.is_boolean = 1;
|
|
|
|
curr_opcode.boolean_constant = rule->constant;
|
|
|
|
curr_opcode.nr_opcodes = 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
opcode_field *new_field = ZALLOC (opcode_field);
|
|
|
|
memcpy (new_field, &curr_opcode, sizeof (opcode_field));
|
|
|
|
return new_field;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gen_entry_insert_insn (gen_entry *table,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
insn_entry * old_insn,
|
1999-04-16 03:35:26 +02:00
|
|
|
int new_word_nr,
|
|
|
|
int new_nr_prefetched_words,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
int new_opcode_nr, opcode_bits *new_bits)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
gen_entry **entry = &table->entries;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
/* find the new table for this entry */
|
|
|
|
while ((*entry) != NULL && (*entry)->opcode_nr < new_opcode_nr)
|
|
|
|
{
|
|
|
|
entry = &(*entry)->sibling;
|
|
|
|
}
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
if ((*entry) == NULL || (*entry)->opcode_nr != new_opcode_nr)
|
|
|
|
{
|
|
|
|
/* insert the missing entry */
|
|
|
|
gen_entry *new_entry = ZALLOC (gen_entry);
|
|
|
|
new_entry->sibling = (*entry);
|
|
|
|
(*entry) = new_entry;
|
|
|
|
table->nr_entries++;
|
|
|
|
/* fill it in */
|
|
|
|
new_entry->top = table->top;
|
|
|
|
new_entry->opcode_nr = new_opcode_nr;
|
|
|
|
new_entry->word_nr = new_word_nr;
|
|
|
|
new_entry->expanded_bits = new_bits;
|
|
|
|
new_entry->opcode_rule = table->opcode_rule->next;
|
|
|
|
new_entry->parent = table;
|
|
|
|
new_entry->nr_prefetched_words = new_nr_prefetched_words;
|
|
|
|
}
|
|
|
|
/* ASSERT new_bits == cur_entry bits */
|
|
|
|
ASSERT ((*entry) != NULL && (*entry)->opcode_nr == new_opcode_nr);
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
insn_list_insert (&(*entry)->insns, &(*entry)->nr_insns, old_insn, NULL, /* expanded_bits - only in final list */
|
|
|
|
NULL, /* opcodes - only in final list */
|
|
|
|
new_nr_prefetched_words, /* for this table */
|
1999-04-16 03:35:26 +02:00
|
|
|
report_duplicate_insns);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gen_entry_expand_opcode (gen_entry *table,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
insn_entry * instruction,
|
|
|
|
int bit_nr, int opcode_nr, opcode_bits *bits)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
if (bit_nr > table->opcode->last)
|
|
|
|
{
|
|
|
|
/* Only include the hardwired bit information with an entry IF
|
|
|
|
that entry (and hence its functions) are being duplicated. */
|
|
|
|
if (options.trace.insn_expansion)
|
|
|
|
{
|
|
|
|
print_gen_entry_path (table->opcode_rule->line, table, notify);
|
|
|
|
notify (NULL, ": insert %d - %s.%s%s\n",
|
|
|
|
opcode_nr,
|
|
|
|
instruction->format_name,
|
|
|
|
instruction->name,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
(table->opcode_rule->
|
|
|
|
with_duplicates ? " (duplicated)" : ""));
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
if (table->opcode_rule->with_duplicates)
|
|
|
|
{
|
|
|
|
gen_entry_insert_insn (table, instruction,
|
|
|
|
table->opcode->word_nr,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
table->nr_prefetched_words, opcode_nr, bits);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gen_entry_insert_insn (table, instruction,
|
|
|
|
table->opcode->word_nr,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
table->nr_prefetched_words, opcode_nr, NULL);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
insn_word_entry *word = instruction->word[table->opcode->word_nr];
|
|
|
|
insn_field_entry *field = word->bit[bit_nr]->field;
|
|
|
|
int last_pos = ((field->last < table->opcode->last)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
? field->last : table->opcode->last);
|
1999-04-16 03:35:26 +02:00
|
|
|
int first_pos = ((field->first > table->opcode->first)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
? field->first : table->opcode->first);
|
1999-04-16 03:35:26 +02:00
|
|
|
int width = last_pos - first_pos + 1;
|
|
|
|
switch (field->type)
|
|
|
|
{
|
|
|
|
case insn_field_int:
|
|
|
|
{
|
|
|
|
int val;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
val = sub_val (field->val_int, field->last, first_pos, last_pos);
|
1999-04-16 03:35:26 +02:00
|
|
|
gen_entry_expand_opcode (table, instruction,
|
|
|
|
last_pos + 1,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
((opcode_nr << width) | val), bits);
|
1999-04-16 03:35:26 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
if (field->type == insn_field_reserved)
|
|
|
|
gen_entry_expand_opcode (table, instruction,
|
|
|
|
last_pos + 1,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
((opcode_nr << width)), bits);
|
1999-04-16 03:35:26 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
int val;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
int last_val = (table->opcode->is_boolean ? 2 : (1 << width));
|
1999-04-16 03:35:26 +02:00
|
|
|
for (val = 0; val < last_val; val++)
|
|
|
|
{
|
|
|
|
/* check to see if the value has been precluded
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
(by a conditional) in some way */
|
1999-04-16 03:35:26 +02:00
|
|
|
int is_precluded;
|
|
|
|
insn_field_cond *condition;
|
|
|
|
for (condition = field->conditions, is_precluded = 0;
|
|
|
|
condition != NULL && !is_precluded;
|
|
|
|
condition = condition->next)
|
|
|
|
{
|
|
|
|
switch (condition->type)
|
|
|
|
{
|
|
|
|
case insn_field_cond_value:
|
|
|
|
{
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
int value =
|
|
|
|
sub_val (condition->value, field->last,
|
|
|
|
first_pos, last_pos);
|
1999-04-16 03:35:26 +02:00
|
|
|
switch (condition->test)
|
|
|
|
{
|
|
|
|
case insn_field_cond_ne:
|
|
|
|
if (value == val)
|
|
|
|
is_precluded = 1;
|
|
|
|
break;
|
|
|
|
case insn_field_cond_eq:
|
|
|
|
if (value != val)
|
|
|
|
is_precluded = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case insn_field_cond_field:
|
|
|
|
{
|
2002-06-17 23:44:06 +02:00
|
|
|
int value = -1;
|
1999-04-16 03:35:26 +02:00
|
|
|
opcode_bits *bit;
|
2002-06-17 23:44:06 +02:00
|
|
|
gen_entry *t = NULL;
|
1999-04-16 03:35:26 +02:00
|
|
|
/* Try to find a value for the
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
conditional by looking back through
|
|
|
|
the previously defined bits for one
|
|
|
|
that covers the designated
|
|
|
|
conditional field */
|
|
|
|
for (bit = bits; bit != NULL; bit = bit->next)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
if (bit->field->word_nr ==
|
|
|
|
condition->field->word_nr
|
1999-04-16 03:35:26 +02:00
|
|
|
&& bit->first <= condition->field->first
|
|
|
|
&& bit->last >= condition->field->last)
|
|
|
|
{
|
|
|
|
/* the bit field fully specified
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
the conditional field's value */
|
1999-04-16 03:35:26 +02:00
|
|
|
value = sub_val (bit->value, bit->last,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
condition->field->
|
|
|
|
first,
|
|
|
|
condition->field->
|
|
|
|
last);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Try to find a value by looking
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
through this and previous tables */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (bit == NULL)
|
|
|
|
{
|
|
|
|
for (t = table;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
t->parent != NULL; t = t->parent)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
if (t->parent->opcode->word_nr ==
|
|
|
|
condition->field->word_nr
|
|
|
|
&& t->parent->opcode->first <=
|
|
|
|
condition->field->first
|
|
|
|
&& t->parent->opcode->last >=
|
|
|
|
condition->field->last)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
/* the table entry fully
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
specified the condition
|
|
|
|
field's value */
|
1999-04-16 03:35:26 +02:00
|
|
|
/* extract the field's value
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
from the opcode */
|
|
|
|
value =
|
|
|
|
sub_val (t->opcode_nr,
|
|
|
|
t->parent->opcode->last,
|
|
|
|
condition->field->first,
|
|
|
|
condition->field->last);
|
1999-04-16 03:35:26 +02:00
|
|
|
/* this is a requirement of
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
a conditonal field
|
|
|
|
refering to another field */
|
|
|
|
ASSERT ((condition->field->first -
|
|
|
|
condition->field->last) ==
|
|
|
|
(first_pos - last_pos));
|
|
|
|
printf
|
|
|
|
("value=%d, opcode_nr=%d, last=%d, [%d..%d]\n",
|
|
|
|
value, t->opcode_nr,
|
|
|
|
t->parent->opcode->last,
|
|
|
|
condition->field->first,
|
|
|
|
condition->field->last);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bit == NULL && t == NULL)
|
|
|
|
error (instruction->line,
|
|
|
|
"Conditional `%s' of field `%s' isn't expanded",
|
|
|
|
condition->string, field->val_string);
|
|
|
|
switch (condition->test)
|
|
|
|
{
|
|
|
|
case insn_field_cond_ne:
|
|
|
|
if (value == val)
|
|
|
|
is_precluded = 1;
|
|
|
|
break;
|
|
|
|
case insn_field_cond_eq:
|
|
|
|
if (value != val)
|
|
|
|
is_precluded = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!is_precluded)
|
|
|
|
{
|
|
|
|
/* Only add additional hardwired bit
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
information if the entry is not going to
|
|
|
|
later be combined */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (table->opcode_rule->with_combine)
|
|
|
|
{
|
|
|
|
gen_entry_expand_opcode (table, instruction,
|
|
|
|
last_pos + 1,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
((opcode_nr << width) |
|
|
|
|
val), bits);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
opcode_bits *new_bits =
|
|
|
|
new_opcode_bits (bits, val,
|
|
|
|
first_pos, last_pos,
|
|
|
|
field,
|
|
|
|
table->opcode);
|
1999-04-16 03:35:26 +02:00
|
|
|
gen_entry_expand_opcode (table, instruction,
|
|
|
|
last_pos + 1,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
((opcode_nr << width) |
|
|
|
|
val), new_bits);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
gen_entry_insert_expanding (gen_entry *table, insn_entry * instruction)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
gen_entry_expand_opcode (table,
|
|
|
|
instruction,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
table->opcode->first, 0, table->expanded_bits);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
insns_match_format_names (insn_list *insns, filter *format_names)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
if (format_names != NULL)
|
|
|
|
{
|
|
|
|
insn_list *i;
|
|
|
|
for (i = insns; i != NULL; i = i->next)
|
|
|
|
{
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
if (i->insn->format_name != NULL
|
|
|
|
&& !filter_is_member (format_names, i->insn->format_name))
|
1999-04-16 03:35:26 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
table_matches_path (gen_entry *table, decode_path_list *paths)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
if (paths == NULL)
|
|
|
|
return 1;
|
|
|
|
while (paths != NULL)
|
|
|
|
{
|
|
|
|
gen_entry *entry = table;
|
|
|
|
decode_path *path = paths->path;
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
if (entry == NULL && path == NULL)
|
|
|
|
return 1;
|
|
|
|
if (entry == NULL || path == NULL)
|
|
|
|
break;
|
|
|
|
if (entry->opcode_nr != path->opcode_nr)
|
|
|
|
break;
|
|
|
|
entry = entry->parent;
|
|
|
|
path = path->parent;
|
|
|
|
}
|
|
|
|
paths = paths->next;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
insns_match_conditions (insn_list *insns, decode_cond *conditions)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
if (conditions != NULL)
|
|
|
|
{
|
|
|
|
insn_list *i;
|
|
|
|
for (i = insns; i != NULL; i = i->next)
|
|
|
|
{
|
|
|
|
decode_cond *cond;
|
|
|
|
for (cond = conditions; cond != NULL; cond = cond->next)
|
|
|
|
{
|
|
|
|
int bit_nr;
|
|
|
|
if (i->insn->nr_words <= cond->word_nr)
|
|
|
|
return 0;
|
|
|
|
for (bit_nr = 0; bit_nr < options.insn_bit_size; bit_nr++)
|
|
|
|
{
|
|
|
|
if (!cond->mask[bit_nr])
|
|
|
|
continue;
|
|
|
|
if (!i->insn->word[cond->word_nr]->bit[bit_nr]->mask)
|
|
|
|
return 0;
|
|
|
|
if ((i->insn->word[cond->word_nr]->bit[bit_nr]->value
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
== cond->value[bit_nr]) == !cond->is_equal)
|
1999-04-16 03:35:26 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
insns_match_nr_words (insn_list *insns, int nr_words)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
insn_list *i;
|
|
|
|
for (i = insns; i != NULL; i = i->next)
|
|
|
|
{
|
|
|
|
if (i->insn->nr_words < nr_words)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
insn_list_cmp (insn_list *l, insn_list *r)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
insn_entry *insn;
|
|
|
|
if (l == NULL && r == NULL)
|
|
|
|
return 0;
|
|
|
|
if (l == NULL)
|
|
|
|
return -1;
|
|
|
|
if (r == NULL)
|
|
|
|
return 1;
|
|
|
|
if (l->insn != r->insn)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
return -1; /* somewhat arbitrary at present */
|
1999-04-16 03:35:26 +02:00
|
|
|
/* skip this insn */
|
|
|
|
insn = l->insn;
|
|
|
|
while (l != NULL && l->insn == insn)
|
|
|
|
l = l->next;
|
|
|
|
while (r != NULL && r->insn == insn)
|
|
|
|
r = r->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gen_entry_expand_insns (gen_entry *table)
|
|
|
|
{
|
|
|
|
decode_table *opcode_rule;
|
|
|
|
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
ASSERT (table->nr_insns >= 1);
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
/* determine a valid opcode */
|
|
|
|
for (opcode_rule = table->opcode_rule;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
opcode_rule != NULL; opcode_rule = opcode_rule->next)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
char *discard_reason;
|
|
|
|
if (table->top->model != NULL
|
|
|
|
&& opcode_rule->model_names != NULL
|
|
|
|
&& !filter_is_member (opcode_rule->model_names,
|
|
|
|
table->top->model->name))
|
|
|
|
{
|
|
|
|
/* the rule isn't applicable to this processor */
|
|
|
|
discard_reason = "wrong model";
|
|
|
|
}
|
|
|
|
else if (table->nr_insns == 1 && opcode_rule->conditions == NULL)
|
|
|
|
{
|
|
|
|
/* for safety, require a pre-codition when attempting to
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
apply a rule to a single instruction */
|
1999-04-16 03:35:26 +02:00
|
|
|
discard_reason = "need pre-condition when nr-insn == 1";
|
|
|
|
}
|
|
|
|
else if (table->nr_insns == 1 && !opcode_rule->with_duplicates)
|
|
|
|
{
|
|
|
|
/* Little point in expanding a single instruction when we're
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
not duplicating the semantic functions that this table
|
|
|
|
calls */
|
1999-04-16 03:35:26 +02:00
|
|
|
discard_reason = "need duplication with nr-insns == 1";
|
|
|
|
}
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
else
|
|
|
|
if (!insns_match_format_names
|
|
|
|
(table->insns, opcode_rule->format_names))
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
discard_reason = "wrong format name";
|
|
|
|
}
|
|
|
|
else if (!insns_match_nr_words (table->insns, opcode_rule->word_nr + 1))
|
|
|
|
{
|
|
|
|
discard_reason = "wrong nr words";
|
|
|
|
}
|
|
|
|
else if (!table_matches_path (table, opcode_rule->paths))
|
|
|
|
{
|
|
|
|
discard_reason = "path failed";
|
|
|
|
}
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
else
|
|
|
|
if (!insns_match_conditions (table->insns, opcode_rule->conditions))
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
discard_reason = "condition failed";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
discard_reason = "no opcode field";
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
table->opcode = gen_entry_find_opcode_field (table->insns,
|
|
|
|
opcode_rule,
|
|
|
|
table->nr_insns == 1 /*string-only */
|
|
|
|
);
|
1999-04-16 03:35:26 +02:00
|
|
|
if (table->opcode != NULL)
|
|
|
|
{
|
|
|
|
table->opcode_rule = opcode_rule;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.trace.rule_rejection)
|
|
|
|
{
|
|
|
|
print_gen_entry_path (opcode_rule->line, table, notify);
|
|
|
|
notify (NULL, ": rule discarded - %s\n", discard_reason);
|
|
|
|
}
|
|
|
|
}
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
/* did we find anything */
|
|
|
|
if (opcode_rule == NULL)
|
|
|
|
{
|
|
|
|
/* the decode table failed, this set of instructions haven't
|
|
|
|
been uniquely identified */
|
|
|
|
if (table->nr_insns > 1)
|
|
|
|
{
|
|
|
|
print_gen_entry_insns (table, warning,
|
|
|
|
"was not uniquely decoded",
|
|
|
|
"decodes to the same entry");
|
|
|
|
error (NULL, "");
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Determine the number of words that must have been prefetched for
|
|
|
|
this table to function */
|
|
|
|
if (table->parent == NULL)
|
|
|
|
table->nr_prefetched_words = table->opcode_rule->word_nr + 1;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
else if (table->opcode_rule->word_nr + 1 >
|
|
|
|
table->parent->nr_prefetched_words)
|
1999-04-16 03:35:26 +02:00
|
|
|
table->nr_prefetched_words = table->opcode_rule->word_nr + 1;
|
|
|
|
else
|
|
|
|
table->nr_prefetched_words = table->parent->nr_prefetched_words;
|
|
|
|
|
|
|
|
/* back link what we found to its parent */
|
|
|
|
if (table->parent != NULL)
|
|
|
|
{
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
ASSERT (table->parent->opcode != NULL);
|
1999-04-16 03:35:26 +02:00
|
|
|
table->opcode->parent = table->parent->opcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* report the rule being used to expand the instructions */
|
|
|
|
if (options.trace.rule_selection)
|
|
|
|
{
|
|
|
|
print_gen_entry_path (table->opcode_rule->line, table, notify);
|
|
|
|
notify (NULL,
|
|
|
|
": decode - word %d, bits [%d..%d] in [%d..%d], opcodes %d, entries %d\n",
|
|
|
|
table->opcode->word_nr,
|
|
|
|
i2target (options.hi_bit_nr, table->opcode->first),
|
|
|
|
i2target (options.hi_bit_nr, table->opcode->last),
|
|
|
|
i2target (options.hi_bit_nr, table->opcode_rule->first),
|
|
|
|
i2target (options.hi_bit_nr, table->opcode_rule->last),
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
table->opcode->nr_opcodes, table->nr_entries);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* expand the raw instructions according to the opcode */
|
|
|
|
{
|
|
|
|
insn_list *entry;
|
|
|
|
for (entry = table->insns; entry != NULL; entry = entry->next)
|
|
|
|
{
|
|
|
|
if (options.trace.insn_expansion)
|
|
|
|
{
|
|
|
|
print_gen_entry_path (table->opcode_rule->line, table, notify);
|
|
|
|
notify (NULL, ": expand - %s.%s\n",
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
entry->insn->format_name, entry->insn->name);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
gen_entry_insert_expanding (table, entry->insn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* dump the results */
|
|
|
|
if (options.trace.entries)
|
|
|
|
{
|
|
|
|
gen_entry *entry;
|
|
|
|
for (entry = table->entries; entry != NULL; entry = entry->sibling)
|
|
|
|
{
|
|
|
|
insn_list *l;
|
|
|
|
print_gen_entry_path (table->opcode_rule->line, entry, notify);
|
|
|
|
notify (NULL, ": %d - entries %d -",
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
entry->opcode_nr, entry->nr_insns);
|
1999-04-16 03:35:26 +02:00
|
|
|
for (l = entry->insns; l != NULL; l = l->next)
|
|
|
|
notify (NULL, " %s.%s", l->insn->format_name, l->insn->name);
|
|
|
|
notify (NULL, "\n");
|
|
|
|
}
|
|
|
|
}
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
/* perform a combine pass if needed */
|
|
|
|
if (table->opcode_rule->with_combine)
|
|
|
|
{
|
|
|
|
gen_entry *entry;
|
|
|
|
for (entry = table->entries; entry != NULL; entry = entry->sibling)
|
|
|
|
{
|
|
|
|
if (entry->combined_parent == NULL)
|
|
|
|
{
|
|
|
|
gen_entry **last = &entry->combined_next;
|
|
|
|
gen_entry *alt;
|
|
|
|
for (alt = entry->sibling; alt != NULL; alt = alt->sibling)
|
|
|
|
{
|
|
|
|
if (alt->combined_parent == NULL
|
|
|
|
&& insn_list_cmp (entry->insns, alt->insns) == 0)
|
|
|
|
{
|
|
|
|
alt->combined_parent = entry;
|
|
|
|
*last = alt;
|
|
|
|
last = &alt->combined_next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (options.trace.combine)
|
|
|
|
{
|
|
|
|
int nr_unique = 0;
|
|
|
|
gen_entry *entry;
|
|
|
|
for (entry = table->entries; entry != NULL; entry = entry->sibling)
|
|
|
|
{
|
|
|
|
if (entry->combined_parent == NULL)
|
|
|
|
{
|
|
|
|
insn_list *l;
|
|
|
|
gen_entry *duplicate;
|
|
|
|
nr_unique++;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
print_gen_entry_path (table->opcode_rule->line, entry,
|
|
|
|
notify);
|
|
|
|
for (duplicate = entry->combined_next; duplicate != NULL;
|
1999-04-16 03:35:26 +02:00
|
|
|
duplicate = duplicate->combined_next)
|
|
|
|
{
|
|
|
|
notify (NULL, "+%d", duplicate->opcode_nr);
|
|
|
|
}
|
|
|
|
notify (NULL, ": entries %d -", entry->nr_insns);
|
|
|
|
for (l = entry->insns; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
notify (NULL, " %s.%s",
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
l->insn->format_name, l->insn->name);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
notify (NULL, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print_gen_entry_path (table->opcode_rule->line, table, notify);
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
notify (NULL,
|
|
|
|
": combine - word %d, bits [%d..%d] in [%d..%d], opcodes %d, entries %d, unique %d\n",
|
|
|
|
table->opcode->word_nr, i2target (options.hi_bit_nr,
|
|
|
|
table->opcode->first),
|
1999-04-16 03:35:26 +02:00
|
|
|
i2target (options.hi_bit_nr, table->opcode->last),
|
|
|
|
i2target (options.hi_bit_nr, table->opcode_rule->first),
|
|
|
|
i2target (options.hi_bit_nr, table->opcode_rule->last),
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
table->opcode->nr_opcodes, table->nr_entries, nr_unique);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
}
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
/* Check that the rule did more than re-arange the order of the
|
|
|
|
instructions */
|
|
|
|
{
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
gen_entry *entry;
|
|
|
|
for (entry = table->entries; entry != NULL; entry = entry->sibling)
|
|
|
|
{
|
|
|
|
if (entry->combined_parent == NULL)
|
|
|
|
{
|
|
|
|
if (insn_list_cmp (table->insns, entry->insns) == 0)
|
|
|
|
{
|
|
|
|
print_gen_entry_path (table->opcode_rule->line, table,
|
|
|
|
warning);
|
|
|
|
warning (NULL,
|
|
|
|
": Applying rule just copied all instructions\n");
|
|
|
|
print_gen_entry_insns (entry, warning, "Copied", NULL);
|
|
|
|
error (NULL, "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* if some form of expanded table, fill in the missing dots */
|
|
|
|
switch (table->opcode_rule->gen)
|
|
|
|
{
|
|
|
|
case padded_switch_gen:
|
|
|
|
case array_gen:
|
|
|
|
case goto_switch_gen:
|
|
|
|
if (!table->opcode->is_boolean)
|
|
|
|
{
|
|
|
|
gen_entry **entry = &table->entries;
|
|
|
|
gen_entry *illegals = NULL;
|
|
|
|
gen_entry **last_illegal = &illegals;
|
|
|
|
int opcode_nr = 0;
|
|
|
|
while (opcode_nr < table->opcode->nr_opcodes)
|
|
|
|
{
|
|
|
|
if ((*entry) == NULL || (*entry)->opcode_nr != opcode_nr)
|
|
|
|
{
|
|
|
|
/* missing - insert it under our feet at *entry */
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
gen_entry_insert_insn (table, table->top->isa->illegal_insn, table->opcode->word_nr, 0, /* nr_prefetched_words == 0 for invalid */
|
1999-04-16 03:35:26 +02:00
|
|
|
opcode_nr, NULL);
|
|
|
|
ASSERT ((*entry) != NULL);
|
|
|
|
ASSERT ((*entry)->opcode_nr == opcode_nr);
|
|
|
|
(*last_illegal) = *entry;
|
|
|
|
(*last_illegal)->combined_parent = illegals;
|
|
|
|
last_illegal = &(*last_illegal)->combined_next;
|
|
|
|
}
|
|
|
|
entry = &(*entry)->sibling;
|
|
|
|
opcode_nr++;
|
|
|
|
}
|
|
|
|
/* oops, will have pointed the first illegal insn back to
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
its self. Fix this */
|
1999-04-16 03:35:26 +02:00
|
|
|
if (illegals != NULL)
|
|
|
|
illegals->combined_parent = NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case switch_gen:
|
|
|
|
case invalid_gen:
|
|
|
|
/* ignore */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* and do the same for the newly created sub entries but *only*
|
|
|
|
expand entries that haven't been combined. */
|
|
|
|
{
|
|
|
|
gen_entry *entry;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
for (entry = table->entries; entry != NULL; entry = entry->sibling)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
if (entry->combined_parent == NULL)
|
|
|
|
{
|
|
|
|
gen_entry_expand_insns (entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gen_tables_expand_insns (gen_table *gen)
|
|
|
|
{
|
|
|
|
gen_list *entry;
|
|
|
|
for (entry = gen->tables; entry != NULL; entry = entry->next)
|
|
|
|
{
|
|
|
|
gen_entry_expand_insns (entry->table);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* create a list of all the semantic functions that need to be
|
|
|
|
generated. Eliminate any duplicates. Verify that the decode stage
|
|
|
|
worked. */
|
|
|
|
|
|
|
|
static void
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
make_gen_semantics_list (lf *file, gen_entry *entry, int depth, void *data)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
gen_table *gen = (gen_table *) data;
|
1999-04-16 03:35:26 +02:00
|
|
|
insn_list *insn;
|
|
|
|
/* Not interested in an entrie that have been combined into some
|
|
|
|
other entry at the same level */
|
|
|
|
if (entry->combined_parent != NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* a leaf should contain exactly one instruction. If not the decode
|
|
|
|
stage failed. */
|
|
|
|
ASSERT (entry->nr_insns == 1);
|
|
|
|
|
|
|
|
/* Enter this instruction into the list of semantic functions. */
|
|
|
|
insn = insn_list_insert (&gen->semantics, &gen->nr_semantics,
|
|
|
|
entry->insns->insn,
|
|
|
|
entry->expanded_bits,
|
|
|
|
entry->parent->opcode,
|
|
|
|
entry->insns->nr_prefetched_words,
|
|
|
|
merge_duplicate_insns);
|
|
|
|
/* point the table entry at the real semantic function */
|
|
|
|
ASSERT (insn != NULL);
|
|
|
|
entry->insns->semantic = insn;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
gen_tables_expand_semantics (gen_table *gen)
|
|
|
|
{
|
|
|
|
gen_list *entry;
|
|
|
|
for (entry = gen->tables; entry != NULL; entry = entry->next)
|
|
|
|
{
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
gen_entry_traverse_tree (NULL, entry->table, 1, /* depth */
|
|
|
|
NULL, /* start-handler */
|
|
|
|
make_gen_semantics_list, /* leaf-handler */
|
|
|
|
NULL, /* end-handler */
|
|
|
|
gen); /* data */
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef MAIN
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
dump_opcode_field (lf *file,
|
|
|
|
char *prefix,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
opcode_field *field, char *suffix, int levels)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
lf_printf (file, "%s(opcode_field *) 0x%lx", prefix, (long) field);
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
if (levels && field != NULL)
|
|
|
|
{
|
|
|
|
lf_indent (file, +1);
|
|
|
|
lf_printf (file, "\n(first %d)", field->first);
|
|
|
|
lf_printf (file, "\n(last %d)", field->last);
|
|
|
|
lf_printf (file, "\n(nr_opcodes %d)", field->nr_opcodes);
|
|
|
|
lf_printf (file, "\n(is_boolean %d)", field->is_boolean);
|
|
|
|
lf_printf (file, "\n(boolean_constant %d)", field->boolean_constant);
|
|
|
|
dump_opcode_field (file, "\n(parent ", field->parent, ")", levels - 1);
|
|
|
|
lf_indent (file, -1);
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
lf_printf (file, "%s", suffix);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
dump_opcode_bits (lf *file,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
char *prefix, opcode_bits *bits, char *suffix, int levels)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
lf_printf (file, "%s(opcode_bits *) 0x%lx", prefix, (long) bits);
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
if (levels && bits != NULL)
|
|
|
|
{
|
|
|
|
lf_indent (file, +1);
|
|
|
|
lf_printf (file, "\n(value %d)", bits->value);
|
|
|
|
dump_opcode_field (file, "\n(opcode ", bits->opcode, ")", 0);
|
|
|
|
dump_insn_field (file, "\n(field ", bits->field, ")");
|
|
|
|
dump_opcode_bits (file, "\n(next ", bits->next, ")", levels - 1);
|
|
|
|
lf_indent (file, -1);
|
|
|
|
}
|
|
|
|
lf_printf (file, "%s", suffix);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
dump_insn_list (lf *file, char *prefix, insn_list *entry, char *suffix)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
lf_printf (file, "%s(insn_list *) 0x%lx", prefix, (long) entry);
|
|
|
|
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
if (entry != NULL)
|
|
|
|
{
|
|
|
|
lf_indent (file, +1);
|
|
|
|
dump_insn_entry (file, "\n(insn ", entry->insn, ")");
|
|
|
|
lf_printf (file, "\n(next 0x%lx)", (long) entry->next);
|
|
|
|
lf_indent (file, -1);
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
lf_printf (file, "%s", suffix);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
dump_insn_word_entry_list_entries (lf *file,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
char *prefix,
|
|
|
|
insn_list *entry, char *suffix)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
lf_printf (file, "%s", prefix);
|
|
|
|
while (entry != NULL)
|
|
|
|
{
|
|
|
|
dump_insn_list (file, "\n(", entry, ")");
|
|
|
|
entry = entry->next;
|
|
|
|
}
|
|
|
|
lf_printf (file, "%s", suffix);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
dump_gen_entry (lf *file,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
char *prefix, gen_entry *table, char *suffix, int levels)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
lf_printf (file, "%s(gen_entry *) 0x%lx", prefix, (long) table);
|
|
|
|
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
if (levels && table !=NULL)
|
|
|
|
{
|
|
|
|
|
|
|
|
lf_indent (file, +1);
|
|
|
|
lf_printf (file, "\n(opcode_nr %d)", table->opcode_nr);
|
|
|
|
lf_printf (file, "\n(word_nr %d)", table->word_nr);
|
|
|
|
dump_opcode_bits (file, "\n(expanded_bits ", table->expanded_bits, ")",
|
|
|
|
-1);
|
|
|
|
lf_printf (file, "\n(nr_insns %d)", table->nr_insns);
|
|
|
|
dump_insn_word_entry_list_entries (file, "\n(insns ", table->insns,
|
|
|
|
")");
|
|
|
|
dump_decode_rule (file, "\n(opcode_rule ", table->opcode_rule, ")");
|
|
|
|
dump_opcode_field (file, "\n(opcode ", table->opcode, ")", 0);
|
|
|
|
lf_printf (file, "\n(nr_entries %d)", table->nr_entries);
|
|
|
|
dump_gen_entry (file, "\n(entries ", table->entries, ")",
|
|
|
|
table->nr_entries);
|
|
|
|
dump_gen_entry (file, "\n(sibling ", table->sibling, ")", levels - 1);
|
|
|
|
dump_gen_entry (file, "\n(parent ", table->parent, ")", 0);
|
|
|
|
lf_indent (file, -1);
|
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
lf_printf (file, "%s", suffix);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dump_gen_list (lf *file,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
char *prefix, gen_list *entry, char *suffix, int levels)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
while (entry != NULL)
|
|
|
|
{
|
|
|
|
lf_printf (file, "%s(gen_list *) 0x%lx", prefix, (long) entry);
|
|
|
|
dump_gen_entry (file, "\n(", entry->table, ")", levels);
|
|
|
|
lf_printf (file, "\n(next (gen_list *) 0x%lx)", (long) entry->next);
|
|
|
|
lf_printf (file, "%s", suffix);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
dump_gen_table (lf *file,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
char *prefix, gen_table *gen, char *suffix, int levels)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
lf_printf (file, "%s(gen_table *) 0x%lx", prefix, (long) gen);
|
|
|
|
lf_printf (file, "\n(isa (insn_table *) 0x%lx)", (long) gen->isa);
|
|
|
|
lf_printf (file, "\n(rules (decode_table *) 0x%lx)", (long) gen->rules);
|
|
|
|
dump_gen_list (file, "\n(", gen->tables, ")", levels);
|
|
|
|
lf_printf (file, "%s", suffix);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
igen_options options;
|
|
|
|
|
|
|
|
int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
main (int argc, char **argv)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
decode_table *decode_rules;
|
|
|
|
insn_table *instructions;
|
|
|
|
gen_table *gen;
|
|
|
|
lf *l;
|
|
|
|
|
|
|
|
if (argc != 7)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
error (NULL,
|
|
|
|
"Usage: insn <filter-in> <hi-bit-nr> <insn-bit-size> <widths> <decode-table> <insn-table>\n");
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
INIT_OPTIONS (options);
|
|
|
|
|
|
|
|
filter_parse (&options.flags_filter, argv[1]);
|
|
|
|
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 05:20:49 +01:00
|
|
|
options.hi_bit_nr = a2i (argv[2]);
|
|
|
|
options.insn_bit_size = a2i (argv[3]);
|
|
|
|
options.insn_specifying_widths = a2i (argv[4]);
|
|
|
|
ASSERT (options.hi_bit_nr < options.insn_bit_size);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
instructions = load_insn_table (argv[6], NULL);
|
|
|
|
decode_rules = load_decode_table (argv[5]);
|
|
|
|
gen = make_gen_tables (instructions, decode_rules);
|
|
|
|
|
|
|
|
gen_tables_expand_insns (gen);
|
|
|
|
|
|
|
|
l = lf_open ("-", "stdout", lf_omit_references, lf_is_text, "tmp-ld-insn");
|
|
|
|
|
|
|
|
dump_gen_table (l, "(", gen, ")\n", -1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|