1991-10-24 13:21:48 -04:00
|
|
|
|
/* Generate code from machine description to extract operands from insn as rtl.
|
1999-01-13 05:46:45 -05:00
|
|
|
|
Copyright (C) 1987, 91-93, 97-98, 1999 Free Software Foundation, Inc.
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
|
|
|
|
This file is part of GNU CC.
|
|
|
|
|
|
|
|
|
|
GNU CC is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
|
|
GNU CC 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
|
|
|
|
|
along with GNU CC; see the file COPYING. If not, write to
|
1995-06-15 07:52:21 -04:00
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
|
|
|
|
|
1992-10-13 00:24:45 -04:00
|
|
|
|
#include "hconfig.h"
|
Cutover various gen*.c files to using system.h:
* Makefile.in (genconfig.o, genflags.o, gencodes.o, genemit.o,
genopinit.o, genrecog.o, genextract.o, genpeep.o, genattr.o,
genattrtab.o, genoutput.o): Depend on system.h.
* genattr.c: Include system.h. Add arguments to various function
prototypes. Remove redundant prototype of read_rtx().
* genattrtab.c: Likewise.
* gencodes.c: Likewise.
* genconfig.c: Likewise.
* genemit.c: Likewise.
* genextract.c: Likewise.
* genflags.c: Likewise.
* genopinit.c: Likewise.
* genoutput.c: Likewise.
* genpeep.c: Likewise.
* genrecog.c: Likewise.
From-SVN: r18794
1998-03-24 05:16:53 -05:00
|
|
|
|
#include "system.h"
|
1991-10-24 13:21:48 -04:00
|
|
|
|
#include "rtl.h"
|
|
|
|
|
#include "obstack.h"
|
1992-04-18 16:23:49 -04:00
|
|
|
|
#include "insn-config.h"
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
|
|
|
|
static struct obstack obstack;
|
|
|
|
|
struct obstack *rtl_obstack = &obstack;
|
|
|
|
|
|
|
|
|
|
#define obstack_chunk_alloc xmalloc
|
|
|
|
|
#define obstack_chunk_free free
|
|
|
|
|
|
1993-09-06 14:42:55 -04:00
|
|
|
|
/* Names for patterns. Need to allow linking with print-rtl. */
|
|
|
|
|
char **insn_name_ptr;
|
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
/* This structure contains all the information needed to describe one
|
|
|
|
|
set of extractions methods. Each method may be used by more than
|
|
|
|
|
one pattern if the operands are in the same place.
|
|
|
|
|
|
|
|
|
|
The string for each operand describes that path to the operand and
|
|
|
|
|
contains `0' through `9' when going into an expression and `a' through
|
|
|
|
|
`z' when going into a vector. We assume here that only the first operand
|
|
|
|
|
of an rtl expression is a vector. genrecog.c makes the same assumption
|
|
|
|
|
(and uses the same representation) and it is currently true. */
|
|
|
|
|
|
|
|
|
|
struct extraction
|
|
|
|
|
{
|
|
|
|
|
int op_count;
|
|
|
|
|
char *oplocs[MAX_RECOG_OPERANDS];
|
|
|
|
|
int dup_count;
|
|
|
|
|
char *duplocs[MAX_DUP_OPERANDS];
|
|
|
|
|
int dupnums[MAX_DUP_OPERANDS];
|
|
|
|
|
struct code_ptr *insns;
|
|
|
|
|
struct extraction *next;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Holds a single insn code that use an extraction method. */
|
|
|
|
|
|
|
|
|
|
struct code_ptr
|
|
|
|
|
{
|
|
|
|
|
int insn_code;
|
|
|
|
|
struct code_ptr *next;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static struct extraction *extractions;
|
|
|
|
|
|
1991-10-24 13:21:48 -04:00
|
|
|
|
/* Number instruction patterns handled, starting at 0 for first one. */
|
|
|
|
|
|
|
|
|
|
static int insn_code_number;
|
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
/* Records the large operand number in this insn. */
|
|
|
|
|
|
|
|
|
|
static int op_count;
|
|
|
|
|
|
|
|
|
|
/* Records the location of any operands using the string format described
|
|
|
|
|
above. */
|
|
|
|
|
|
|
|
|
|
static char *oplocs[MAX_RECOG_OPERANDS];
|
|
|
|
|
|
1991-10-24 13:21:48 -04:00
|
|
|
|
/* Number the occurrences of MATCH_DUP in each instruction,
|
|
|
|
|
starting at 0 for the first occurrence. */
|
|
|
|
|
|
|
|
|
|
static int dup_count;
|
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
/* Records the location of any MATCH_DUP operands. */
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
static char *duplocs[MAX_DUP_OPERANDS];
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
/* Record the operand number of any MATCH_DUPs. */
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
static int dupnums[MAX_DUP_OPERANDS];
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
/* Record the list of insn_codes for peepholes. */
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
static struct code_ptr *peepholes;
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
1998-04-16 19:56:12 -04:00
|
|
|
|
static void gen_insn PROTO ((rtx));
|
genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattrtab.c (fatal, attr_printf, attr_string, write_attr_set,
write_unit_name, write_eligible_delay, expand_units,
make_length_attrs, write_attr_case, find_attr,
make_internal_attr): Likewise.
* gencheck.c (tree_codes): Likewise.
* gencodes.c (fatal): Likewise.
* genconfig.c (fatal): Likewise.
* genemit.c (fatal): Likewise.
* genextract.c (fatal, walk_rtx, copystr): Likewise.
* genflags.c (fatal): Likewise.
* genopinit.c (fatal, optabs, gen_insn): Likewise.
* genoutput.c (fatal, error, predicates): Likewise.
* genpeep.c (fatal): Likewise.
* genrecog.c (fatal, decision, pred_table, add_to_sequence,
write_tree_1, write_tree, change_state, copystr, indents): Likewise.
From-SVN: r24377
1998-12-19 02:04:42 -05:00
|
|
|
|
static void walk_rtx PROTO ((rtx, const char *));
|
Cutover various gen*.c files to using system.h:
* Makefile.in (genconfig.o, genflags.o, gencodes.o, genemit.o,
genopinit.o, genrecog.o, genextract.o, genpeep.o, genattr.o,
genattrtab.o, genoutput.o): Depend on system.h.
* genattr.c: Include system.h. Add arguments to various function
prototypes. Remove redundant prototype of read_rtx().
* genattrtab.c: Likewise.
* gencodes.c: Likewise.
* genconfig.c: Likewise.
* genemit.c: Likewise.
* genextract.c: Likewise.
* genflags.c: Likewise.
* genopinit.c: Likewise.
* genoutput.c: Likewise.
* genpeep.c: Likewise.
* genrecog.c: Likewise.
From-SVN: r18794
1998-03-24 05:16:53 -05:00
|
|
|
|
static void print_path PROTO ((char *));
|
system.h: Always prototype abort.
1999-04-16 22:44 -0400 Zack Weinberg <zack@rabi.columbia.edu>
* system.h: Always prototype abort. Prototype fatal. Define
abort to call fatal, not fprintf/exit. Define a stub macro
for trim_filename.
* toplev.c: Define DIR_SEPARATOR. (trim_filename): New
function.
* toplev.h: Prototype trim_filename, and #undef system.h's stub.
* gcc.c, genattr.c, genattrtab.c, gencodes.c, genconfig.c,
genemit.c, genextract.c, genflags.c, genopinit.c, genoutput.c,
genpeep.c, genrecog.c: Make fatal non-static.
* gcov.c, gengenrtl.c, protoize.c: #undef abort after
including system.h.
* config/i386/dgux.h, config/m68k/xm-amix.h: Remove stale code
relating to abort.
From-SVN: r26511
1999-04-16 15:52:44 -04:00
|
|
|
|
void fatal PVPROTO ((const char *, ...))
|
Add ATTRIBUTE_NORETURN in a bunch of places:
* cppalloc.c (memory_full): Mark function prototype with
ATTRIBUTE_NORETURN.
* demangle.h (collect_exit): Likewise.
* fix-header.c (v_fatal, fatal): Likewise.
* gcc.c (pfatal_with_name, pfatal_pexecute, fatal, fancy_abort):
Likewise.
* gcov.c (print_usage): Likewise.
* genattr.c (fatal, fancy_abort): Likewise.
* genattrtab.c (fatal, fancy_abort): Likewise.
* gencodes.c (fatal, fancy_abort): Likewise.
* genconfig.c (fatal, fancy_abort): Likewise.
* genemit.c (fatal, fancy_abort): Likewise.
* genextract.c (fatal, fancy_abort): Likewise.
* genflags.c (fatal, fancy_abort): Likewise.
* genopinit.c (fatal, fancy_abort): Likewise.
* genoutput.c (fatal, fancy_abort): Likewise.
* genpeep.c (fatal, fancy_abort): Likewise.
* genrecog.c (fatal, fancy_abort): Likewise.
* libgcc2.c (__eprintf, __default_terminate, __sjthrow,
__sjpopnthrow, __throw): Likewise.
* objc/objc-act.c (objc_fatal): Likewise.
* protoize.c (usage, aux_info_corrupted,
declare_source_confusing): Likewise.
* rtl.c (dump_and_abort): Likewise.
* rtl.h (sets_cc0_p): Likewise.
* toplev.c (float_signal, pipe_closed): Likewise.
From-SVN: r23084
1998-10-14 06:37:09 -04:00
|
|
|
|
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
|
|
|
|
|
void fancy_abort PROTO ((void)) ATTRIBUTE_NORETURN;
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gen_insn (insn)
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
register int i;
|
1992-04-18 16:23:49 -04:00
|
|
|
|
register struct extraction *p;
|
|
|
|
|
register struct code_ptr *link;
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
op_count = 0;
|
1991-10-24 13:21:48 -04:00
|
|
|
|
dup_count = 0;
|
|
|
|
|
|
|
|
|
|
/* No operands seen so far in this pattern. */
|
1999-01-13 05:46:45 -05:00
|
|
|
|
memset (oplocs, 0, sizeof oplocs);
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
|
|
|
|
/* Walk the insn's pattern, remembering at all times the path
|
|
|
|
|
down to the walking point. */
|
|
|
|
|
|
|
|
|
|
if (XVECLEN (insn, 1) == 1)
|
1992-04-18 16:23:49 -04:00
|
|
|
|
walk_rtx (XVECEXP (insn, 1, 0), "");
|
1991-10-24 13:21:48 -04:00
|
|
|
|
else
|
|
|
|
|
for (i = XVECLEN (insn, 1) - 1; i >= 0; i--)
|
|
|
|
|
{
|
1992-04-18 16:23:49 -04:00
|
|
|
|
char *path = (char *) alloca (2);
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
path[0] = 'a' + i;
|
|
|
|
|
path[1] = 0;
|
|
|
|
|
|
|
|
|
|
walk_rtx (XVECEXP (insn, 1, i), path);
|
1991-10-24 13:21:48 -04:00
|
|
|
|
}
|
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
link = (struct code_ptr *) xmalloc (sizeof (struct code_ptr));
|
|
|
|
|
link->insn_code = insn_code_number;
|
|
|
|
|
|
1996-07-03 18:07:53 -04:00
|
|
|
|
/* See if we find something that already had this extraction method. */
|
1992-04-18 16:23:49 -04:00
|
|
|
|
|
|
|
|
|
for (p = extractions; p; p = p->next)
|
1991-10-24 13:21:48 -04:00
|
|
|
|
{
|
1992-04-18 16:23:49 -04:00
|
|
|
|
if (p->op_count != op_count || p->dup_count != dup_count)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < op_count; i++)
|
|
|
|
|
if (p->oplocs[i] != oplocs[i]
|
|
|
|
|
&& ! (p->oplocs[i] != 0 && oplocs[i] != 0
|
|
|
|
|
&& ! strcmp (p->oplocs[i], oplocs[i])))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (i != op_count)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < dup_count; i++)
|
|
|
|
|
if (p->dupnums[i] != dupnums[i]
|
|
|
|
|
|| strcmp (p->duplocs[i], duplocs[i]))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (i != dup_count)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* This extraction is the same as ours. Just link us in. */
|
|
|
|
|
link->next = p->insns;
|
|
|
|
|
p->insns = link;
|
|
|
|
|
return;
|
1991-10-24 13:21:48 -04:00
|
|
|
|
}
|
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
/* Otherwise, make a new extraction method. */
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
p = (struct extraction *) xmalloc (sizeof (struct extraction));
|
|
|
|
|
p->op_count = op_count;
|
|
|
|
|
p->dup_count = dup_count;
|
|
|
|
|
p->next = extractions;
|
|
|
|
|
extractions = p;
|
|
|
|
|
p->insns = link;
|
|
|
|
|
link->next = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < op_count; i++)
|
|
|
|
|
p->oplocs[i] = oplocs[i];
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < dup_count; i++)
|
|
|
|
|
p->dupnums[i] = dupnums[i], p->duplocs[i] = duplocs[i];
|
|
|
|
|
}
|
|
|
|
|
|
1991-10-24 13:21:48 -04:00
|
|
|
|
static void
|
|
|
|
|
walk_rtx (x, path)
|
|
|
|
|
rtx x;
|
genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattrtab.c (fatal, attr_printf, attr_string, write_attr_set,
write_unit_name, write_eligible_delay, expand_units,
make_length_attrs, write_attr_case, find_attr,
make_internal_attr): Likewise.
* gencheck.c (tree_codes): Likewise.
* gencodes.c (fatal): Likewise.
* genconfig.c (fatal): Likewise.
* genemit.c (fatal): Likewise.
* genextract.c (fatal, walk_rtx, copystr): Likewise.
* genflags.c (fatal): Likewise.
* genopinit.c (fatal, optabs, gen_insn): Likewise.
* genoutput.c (fatal, error, predicates): Likewise.
* genpeep.c (fatal): Likewise.
* genrecog.c (fatal, decision, pred_table, add_to_sequence,
write_tree_1, write_tree, change_state, copystr, indents): Likewise.
From-SVN: r24377
1998-12-19 02:04:42 -05:00
|
|
|
|
const char *path;
|
1991-10-24 13:21:48 -04:00
|
|
|
|
{
|
|
|
|
|
register RTX_CODE code;
|
|
|
|
|
register int i;
|
|
|
|
|
register int len;
|
|
|
|
|
register char *fmt;
|
1992-04-18 16:23:49 -04:00
|
|
|
|
int depth = strlen (path);
|
|
|
|
|
char *newpath;
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
|
|
|
|
if (x == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
code = GET_CODE (x);
|
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case PC:
|
|
|
|
|
case CC0:
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case MATCH_OPERAND:
|
|
|
|
|
case MATCH_SCRATCH:
|
1999-01-13 05:46:45 -05:00
|
|
|
|
oplocs[XINT (x, 0)] = xstrdup (path);
|
1992-04-18 16:23:49 -04:00
|
|
|
|
op_count = MAX (op_count, XINT (x, 0) + 1);
|
1991-10-24 13:21:48 -04:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MATCH_DUP:
|
1992-08-14 14:43:01 -04:00
|
|
|
|
case MATCH_PAR_DUP:
|
1999-01-13 05:46:45 -05:00
|
|
|
|
duplocs[dup_count] = xstrdup (path);
|
1992-04-18 16:23:49 -04:00
|
|
|
|
dupnums[dup_count] = XINT (x, 0);
|
1991-10-24 13:21:48 -04:00
|
|
|
|
dup_count++;
|
|
|
|
|
break;
|
|
|
|
|
|
1993-09-06 14:42:55 -04:00
|
|
|
|
case MATCH_OP_DUP:
|
1999-01-13 05:46:45 -05:00
|
|
|
|
duplocs[dup_count] = xstrdup (path);
|
1993-09-06 14:42:55 -04:00
|
|
|
|
dupnums[dup_count] = XINT (x, 0);
|
|
|
|
|
dup_count++;
|
|
|
|
|
|
|
|
|
|
newpath = (char *) alloca (depth + 2);
|
|
|
|
|
strcpy (newpath, path);
|
|
|
|
|
newpath[depth + 1] = 0;
|
|
|
|
|
|
|
|
|
|
for (i = XVECLEN (x, 1) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
newpath[depth] = '0' + i;
|
|
|
|
|
walk_rtx (XVECEXP (x, 1, i), newpath);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
|
1991-10-24 13:21:48 -04:00
|
|
|
|
case MATCH_OPERATOR:
|
1999-01-13 05:46:45 -05:00
|
|
|
|
oplocs[XINT (x, 0)] = xstrdup (path);
|
1992-04-18 16:23:49 -04:00
|
|
|
|
op_count = MAX (op_count, XINT (x, 0) + 1);
|
|
|
|
|
|
|
|
|
|
newpath = (char *) alloca (depth + 2);
|
|
|
|
|
strcpy (newpath, path);
|
|
|
|
|
newpath[depth + 1] = 0;
|
|
|
|
|
|
1991-10-24 13:21:48 -04:00
|
|
|
|
for (i = XVECLEN (x, 2) - 1; i >= 0; i--)
|
|
|
|
|
{
|
1992-04-18 16:23:49 -04:00
|
|
|
|
newpath[depth] = '0' + i;
|
|
|
|
|
walk_rtx (XVECEXP (x, 2, i), newpath);
|
1991-10-24 13:21:48 -04:00
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case MATCH_PARALLEL:
|
1999-01-13 05:46:45 -05:00
|
|
|
|
oplocs[XINT (x, 0)] = xstrdup (path);
|
1992-04-18 16:23:49 -04:00
|
|
|
|
op_count = MAX (op_count, XINT (x, 0) + 1);
|
|
|
|
|
|
|
|
|
|
newpath = (char *) alloca (depth + 2);
|
|
|
|
|
strcpy (newpath, path);
|
|
|
|
|
newpath[depth + 1] = 0;
|
|
|
|
|
|
1991-10-24 13:21:48 -04:00
|
|
|
|
for (i = XVECLEN (x, 2) - 1; i >= 0; i--)
|
|
|
|
|
{
|
1992-04-18 16:23:49 -04:00
|
|
|
|
newpath[depth] = 'a' + i;
|
|
|
|
|
walk_rtx (XVECEXP (x, 2, i), newpath);
|
1991-10-24 13:21:48 -04:00
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case ADDRESS:
|
|
|
|
|
walk_rtx (XEXP (x, 0), path);
|
|
|
|
|
return;
|
c-common.c: Include <stdlib.h> and <string.h>/<strings.h>.
* c-common.c: Include <stdlib.h> and <string.h>/<strings.h>.
* calls.c (expand_call): Remove unused variables funtree,
n_regs, and tmpmode.
* dbxout.c, except.c: Include <string.h>/<strings.h>.
* explow.c: (plus_constant_for_output_wide) Removed unused
variable all_constant.
* c-decl.c, genattr.c, genattrtab.c, getconfig.c, genemit.c
genextract.c, genflags.c, genopinit.c genoutput.c, genpeep.c,
genrecog.c, global.c, integrate.c , stupid.c : Include
<stdlib.h>.
* genextract.c: (walk_rtx) Remove unused variable link.
* genrecog.c: (concat) Remove unreferenced static function.
* prefix.c: Include <string.h>/<strings.h>, <stdlib.h>
* stmt.c: Include <stdlib.h>.
(expand_asm_operands): Remove unused variable val1.
(expand_return): Remove unused variable block.
(pushcase): Remove unused variables l and n.
(pushcaserange): Likewise.
* unroll.c (unroll_loop): Remove unused variable temp.
From-SVN: r17766
1998-02-07 17:55:54 -05:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1991-10-24 13:21:48 -04:00
|
|
|
|
}
|
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
newpath = (char *) alloca (depth + 2);
|
|
|
|
|
strcpy (newpath, path);
|
|
|
|
|
newpath[depth + 1] = 0;
|
|
|
|
|
|
1991-10-24 13:21:48 -04:00
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
len = GET_RTX_LENGTH (code);
|
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e' || fmt[i] == 'u')
|
|
|
|
|
{
|
1992-04-18 16:23:49 -04:00
|
|
|
|
newpath[depth] = '0' + i;
|
|
|
|
|
walk_rtx (XEXP (x, i), newpath);
|
1991-10-24 13:21:48 -04:00
|
|
|
|
}
|
|
|
|
|
else if (fmt[i] == 'E')
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
|
|
|
|
|
{
|
1992-04-19 18:27:26 -04:00
|
|
|
|
newpath[depth] = 'a' + j;
|
1992-04-18 16:23:49 -04:00
|
|
|
|
walk_rtx (XVECEXP (x, i, j), newpath);
|
1991-10-24 13:21:48 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given a PATH, representing a path down the instruction's
|
|
|
|
|
pattern from the root to a certain point, output code to
|
|
|
|
|
evaluate to the rtx at that point. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
print_path (path)
|
1992-04-18 16:23:49 -04:00
|
|
|
|
char *path;
|
1991-10-24 13:21:48 -04:00
|
|
|
|
{
|
1992-04-18 16:23:49 -04:00
|
|
|
|
register int len = strlen (path);
|
|
|
|
|
register int i;
|
|
|
|
|
|
1998-05-21 23:44:58 -04:00
|
|
|
|
if (len == 0)
|
|
|
|
|
{
|
|
|
|
|
/* Don't emit "pat", since we may try to take the address of it,
|
|
|
|
|
which isn't what is intended. */
|
|
|
|
|
printf("PATTERN (insn)");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
/* We first write out the operations (XEXP or XVECEXP) in reverse
|
|
|
|
|
order, then write "insn", then the indices in forward order. */
|
|
|
|
|
|
|
|
|
|
for (i = len - 1; i >=0 ; i--)
|
1991-10-24 13:21:48 -04:00
|
|
|
|
{
|
1992-04-18 16:23:49 -04:00
|
|
|
|
if (path[i] >= 'a' && path[i] <= 'z')
|
|
|
|
|
printf ("XVECEXP (");
|
|
|
|
|
else if (path[i] >= '0' && path[i] <= '9')
|
|
|
|
|
printf ("XEXP (");
|
|
|
|
|
else
|
|
|
|
|
abort ();
|
1991-10-24 13:21:48 -04:00
|
|
|
|
}
|
1992-04-18 16:23:49 -04:00
|
|
|
|
|
1992-05-04 10:04:43 -04:00
|
|
|
|
printf ("pat");
|
1992-04-18 16:23:49 -04:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++)
|
1991-10-24 13:21:48 -04:00
|
|
|
|
{
|
1992-04-18 16:23:49 -04:00
|
|
|
|
if (path[i] >= 'a' && path[i] <= 'z')
|
|
|
|
|
printf (", 0, %d)", path[i] - 'a');
|
|
|
|
|
else if (path[i] >= '0' && path[i] <= '9')
|
|
|
|
|
printf (", %d)", path[i] - '0');
|
|
|
|
|
else
|
|
|
|
|
abort ();
|
1991-10-24 13:21:48 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1998-11-27 05:09:17 -05:00
|
|
|
|
PTR
|
1991-10-24 13:21:48 -04:00
|
|
|
|
xmalloc (size)
|
1998-11-27 05:09:17 -05:00
|
|
|
|
size_t size;
|
1991-10-24 13:21:48 -04:00
|
|
|
|
{
|
1998-11-27 05:09:17 -05:00
|
|
|
|
register PTR val = (PTR) malloc (size);
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
|
|
|
|
if (val == 0)
|
|
|
|
|
fatal ("virtual memory exhausted");
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
1998-11-27 05:09:17 -05:00
|
|
|
|
PTR
|
cccp.c (xrealloc): Call malloc given a NULL old pointer.
* cccp.c (xrealloc): Call malloc given a NULL old pointer.
* collect2.c, cppalloc.c, gcc.c, genattr.c, genattrtab.c: Likewise.
* gencodes.c, genconfig.c, genemit.c, genextract.c: Likewise.
* genflags.c, genopinit.c, genoutput.c, genpeep.c: Likewise.
* genrecog.c, mips-tfile.c, protoize.c: Likewise.
From-SVN: r24806
1999-01-21 12:47:36 -05:00
|
|
|
|
xrealloc (old, size)
|
|
|
|
|
PTR old;
|
1998-11-27 05:09:17 -05:00
|
|
|
|
size_t size;
|
1991-10-24 13:21:48 -04:00
|
|
|
|
{
|
cccp.c (xrealloc): Call malloc given a NULL old pointer.
* cccp.c (xrealloc): Call malloc given a NULL old pointer.
* collect2.c, cppalloc.c, gcc.c, genattr.c, genattrtab.c: Likewise.
* gencodes.c, genconfig.c, genemit.c, genextract.c: Likewise.
* genflags.c, genopinit.c, genoutput.c, genpeep.c: Likewise.
* genrecog.c, mips-tfile.c, protoize.c: Likewise.
From-SVN: r24806
1999-01-21 12:47:36 -05:00
|
|
|
|
register PTR ptr;
|
cppp.c (xrealloc): Fix typo last change.
* cppp.c (xrealloc): Fix typo last change.
* cppalloc.c, gcc.c, genattr.c, genattrtab.c, gencodes.c: Likewise.
* genconfig.c, genemit.c, genextract.c, genflags.c: Likewise.
* genopinit.c, genoutput.c, genpeep.c, genrecog.c: Likewise.
From-SVN: r24823
1999-01-22 06:52:05 -05:00
|
|
|
|
if (old)
|
cccp.c (xrealloc): Call malloc given a NULL old pointer.
* cccp.c (xrealloc): Call malloc given a NULL old pointer.
* collect2.c, cppalloc.c, gcc.c, genattr.c, genattrtab.c: Likewise.
* gencodes.c, genconfig.c, genemit.c, genextract.c: Likewise.
* genflags.c, genopinit.c, genoutput.c, genpeep.c: Likewise.
* genrecog.c, mips-tfile.c, protoize.c: Likewise.
From-SVN: r24806
1999-01-21 12:47:36 -05:00
|
|
|
|
ptr = (PTR) realloc (old, size);
|
|
|
|
|
else
|
|
|
|
|
ptr = (PTR) malloc (size);
|
|
|
|
|
if (!ptr)
|
1991-10-24 13:21:48 -04:00
|
|
|
|
fatal ("virtual memory exhausted");
|
cccp.c (xrealloc): Call malloc given a NULL old pointer.
* cccp.c (xrealloc): Call malloc given a NULL old pointer.
* collect2.c, cppalloc.c, gcc.c, genattr.c, genattrtab.c: Likewise.
* gencodes.c, genconfig.c, genemit.c, genextract.c: Likewise.
* genflags.c, genopinit.c, genoutput.c, genpeep.c: Likewise.
* genrecog.c, mips-tfile.c, protoize.c: Likewise.
From-SVN: r24806
1999-01-21 12:47:36 -05:00
|
|
|
|
return ptr;
|
1991-10-24 13:21:48 -04:00
|
|
|
|
}
|
|
|
|
|
|
system.h: Always prototype abort.
1999-04-16 22:44 -0400 Zack Weinberg <zack@rabi.columbia.edu>
* system.h: Always prototype abort. Prototype fatal. Define
abort to call fatal, not fprintf/exit. Define a stub macro
for trim_filename.
* toplev.c: Define DIR_SEPARATOR. (trim_filename): New
function.
* toplev.h: Prototype trim_filename, and #undef system.h's stub.
* gcc.c, genattr.c, genattrtab.c, gencodes.c, genconfig.c,
genemit.c, genextract.c, genflags.c, genopinit.c, genoutput.c,
genpeep.c, genrecog.c: Make fatal non-static.
* gcov.c, gengenrtl.c, protoize.c: #undef abort after
including system.h.
* config/i386/dgux.h, config/m68k/xm-amix.h: Remove stale code
relating to abort.
From-SVN: r26511
1999-04-16 15:52:44 -04:00
|
|
|
|
void
|
genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattrtab.c (fatal, attr_printf, attr_string, write_attr_set,
write_unit_name, write_eligible_delay, expand_units,
make_length_attrs, write_attr_case, find_attr,
make_internal_attr): Likewise.
* gencheck.c (tree_codes): Likewise.
* gencodes.c (fatal): Likewise.
* genconfig.c (fatal): Likewise.
* genemit.c (fatal): Likewise.
* genextract.c (fatal, walk_rtx, copystr): Likewise.
* genflags.c (fatal): Likewise.
* genopinit.c (fatal, optabs, gen_insn): Likewise.
* genoutput.c (fatal, error, predicates): Likewise.
* genpeep.c (fatal): Likewise.
* genrecog.c (fatal, decision, pred_table, add_to_sequence,
write_tree_1, write_tree, change_state, copystr, indents): Likewise.
From-SVN: r24377
1998-12-19 02:04:42 -05:00
|
|
|
|
fatal VPROTO ((const char *format, ...))
|
1991-10-24 13:21:48 -04:00
|
|
|
|
{
|
gansidecl.h: Prepend a "G" to the macro wrapping this file (to distinguish it from the macro...
* gansidecl.h: Prepend a "G" to the macro wrapping this file
(to distinguish it from the macro wrapping ansidecl.h.)
Include libiberty's ansidecl.h. Remove all redundant definitions.
Define the PROTO() style macros in terms of the PARAMS() ones.
* calls.c (emit_library_call): Switch on ANSI_PROTOTYPES, not
__STDC__, when deciding whether to use ANSI variable args.
(emit_library_call_value): Likewise.
* cccp.c (error): Likewise.
(warning): Likewise.
(error_with_line): Likewise.
(warning_with_line): Likewise.
(pedwarn): Likewise.
(pedwarn_with_line): Likewise.
(pedwarn_with_file_and_line): Likewise.
(fatal): Likewise.
* cexp.y (error): Likewise.
(pedwarn): Likewise.
(warning): Likewise.
* collect2.c (fatal_perror): Likewise.
(fatal): Likewise.
(error): Likewise.
* combine.c (gen_rtx_combine): Likewise.
* cpperror.c (cpp_message): Likewise.
(cpp_fatal): Likewise.
* cpplib.c (cpp_error): Likewise.
(cpp_warning): Likewise.
(cpp_pedwarn): Likewise.
(cpp_error_with_line): Likewise.
(cpp_warning_with_line): Likewise.
(cpp_pedwarn_with_line): Likewise.
(cpp_pedwarn_with_file_and_line): Likewise.
* cpplib.h: Don't define PARAMS() macro.
* demangle.h: Likewise.
* doprint.c (checkit): Switch on ANSI_PROTOTYPES, not __STDC__,
when deciding whether to use ANSI variable args.
* emit-rtl.c (gen_rtx): Likewise.
(gen_rtvec): Likewise.
* final.c (asm_fprintf): Likewise.
* fix-header.c (cpp_message): Likewise.
(fatal): Likewise.
(cpp_fatal): Likewise.
* gcc.c (concat): Likewise.
(fatal): Likewise.
(error): Likewise.
* genattr.c (fatal): Likewise.
* genattrtab.c (attr_rtx): Likewise.
(attr_printf): Likewise.
(fatal): Likewise.
* gencodes.c (fatal): Likewise.
* genconfig.c (fatal): Likewise.
* genemit.c (fatal): Likewise.
* genextract.c (fatal): Likewise.
* genflags.c (fatal): Likewise.
* genopinit.c (fatal): Likewise.
* genoutput.c (fatal): Likewise.
(error): Likewise.
* genpeep.c (fatal): Likewise.
* genrecog.c (fatal): Likewise.
* halfpic.h: Switch on ANSI_PROTOTYPES, not __STDC__, when
deciding whether to declare `tree_node' and `rtx_def'.
* hash.h: Don't define stuff we get from gansidecl.h.
* mips-tfile.c: Likewise. Define __proto() in terms of PARAMS().
(fatal): Switch on ANSI_PROTOTYPES, not __STDC__, when deciding
whether to use ANSI variable args.
(error): Likewise.
* prefix.c (concat): Likewise.
* scan.h: Likewise.
* system.h: Likewise.
* toplev.c (error_with_file_and_line): Likewise.
(error_with_decl): Likewise.
(error_for_asm): Likewise.
(error): Likewise.
(fatal): Likewise.
(warning_with_file_and_line): Likewise.
(warning_with_decl): Likewise.
(warning_for_asm): Likewise.
(warning): Likewise.
(pedwarn): Likewise.
(pedwarn_with_decl): Likewise.
(pedwarn_with_file_and_line): Likewise.
(sorry): Likewise.
(really_sorry): Likewise.
* toplev.h: Switch on ANSI_PROTOTYPES, not __STDC__, when deciding
whether to declare `tree_node' and `rtx_def'.
* tree.c (build): Switch on ANSI_PROTOTYPES, not __STDC__, when
deciding whether to use ANSI variable args.
(build_nt): Likewise.
(build_parse_node): Likewise.
From-SVN: r23577
1998-11-08 10:10:24 -05:00
|
|
|
|
#ifndef ANSI_PROTOTYPES
|
genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattrtab.c (fatal, attr_printf, attr_string, write_attr_set,
write_unit_name, write_eligible_delay, expand_units,
make_length_attrs, write_attr_case, find_attr,
make_internal_attr): Likewise.
* gencheck.c (tree_codes): Likewise.
* gencodes.c (fatal): Likewise.
* genconfig.c (fatal): Likewise.
* genemit.c (fatal): Likewise.
* genextract.c (fatal, walk_rtx, copystr): Likewise.
* genflags.c (fatal): Likewise.
* genopinit.c (fatal, optabs, gen_insn): Likewise.
* genoutput.c (fatal, error, predicates): Likewise.
* genpeep.c (fatal): Likewise.
* genrecog.c (fatal, decision, pred_table, add_to_sequence,
write_tree_1, write_tree, change_state, copystr, indents): Likewise.
From-SVN: r24377
1998-12-19 02:04:42 -05:00
|
|
|
|
const char *format;
|
1998-05-11 02:50:51 -04:00
|
|
|
|
#endif
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
|
|
VA_START (ap, format);
|
|
|
|
|
|
gansidecl.h: Prepend a "G" to the macro wrapping this file (to distinguish it from the macro...
* gansidecl.h: Prepend a "G" to the macro wrapping this file
(to distinguish it from the macro wrapping ansidecl.h.)
Include libiberty's ansidecl.h. Remove all redundant definitions.
Define the PROTO() style macros in terms of the PARAMS() ones.
* calls.c (emit_library_call): Switch on ANSI_PROTOTYPES, not
__STDC__, when deciding whether to use ANSI variable args.
(emit_library_call_value): Likewise.
* cccp.c (error): Likewise.
(warning): Likewise.
(error_with_line): Likewise.
(warning_with_line): Likewise.
(pedwarn): Likewise.
(pedwarn_with_line): Likewise.
(pedwarn_with_file_and_line): Likewise.
(fatal): Likewise.
* cexp.y (error): Likewise.
(pedwarn): Likewise.
(warning): Likewise.
* collect2.c (fatal_perror): Likewise.
(fatal): Likewise.
(error): Likewise.
* combine.c (gen_rtx_combine): Likewise.
* cpperror.c (cpp_message): Likewise.
(cpp_fatal): Likewise.
* cpplib.c (cpp_error): Likewise.
(cpp_warning): Likewise.
(cpp_pedwarn): Likewise.
(cpp_error_with_line): Likewise.
(cpp_warning_with_line): Likewise.
(cpp_pedwarn_with_line): Likewise.
(cpp_pedwarn_with_file_and_line): Likewise.
* cpplib.h: Don't define PARAMS() macro.
* demangle.h: Likewise.
* doprint.c (checkit): Switch on ANSI_PROTOTYPES, not __STDC__,
when deciding whether to use ANSI variable args.
* emit-rtl.c (gen_rtx): Likewise.
(gen_rtvec): Likewise.
* final.c (asm_fprintf): Likewise.
* fix-header.c (cpp_message): Likewise.
(fatal): Likewise.
(cpp_fatal): Likewise.
* gcc.c (concat): Likewise.
(fatal): Likewise.
(error): Likewise.
* genattr.c (fatal): Likewise.
* genattrtab.c (attr_rtx): Likewise.
(attr_printf): Likewise.
(fatal): Likewise.
* gencodes.c (fatal): Likewise.
* genconfig.c (fatal): Likewise.
* genemit.c (fatal): Likewise.
* genextract.c (fatal): Likewise.
* genflags.c (fatal): Likewise.
* genopinit.c (fatal): Likewise.
* genoutput.c (fatal): Likewise.
(error): Likewise.
* genpeep.c (fatal): Likewise.
* genrecog.c (fatal): Likewise.
* halfpic.h: Switch on ANSI_PROTOTYPES, not __STDC__, when
deciding whether to declare `tree_node' and `rtx_def'.
* hash.h: Don't define stuff we get from gansidecl.h.
* mips-tfile.c: Likewise. Define __proto() in terms of PARAMS().
(fatal): Switch on ANSI_PROTOTYPES, not __STDC__, when deciding
whether to use ANSI variable args.
(error): Likewise.
* prefix.c (concat): Likewise.
* scan.h: Likewise.
* system.h: Likewise.
* toplev.c (error_with_file_and_line): Likewise.
(error_with_decl): Likewise.
(error_for_asm): Likewise.
(error): Likewise.
(fatal): Likewise.
(warning_with_file_and_line): Likewise.
(warning_with_decl): Likewise.
(warning_for_asm): Likewise.
(warning): Likewise.
(pedwarn): Likewise.
(pedwarn_with_decl): Likewise.
(pedwarn_with_file_and_line): Likewise.
(sorry): Likewise.
(really_sorry): Likewise.
* toplev.h: Switch on ANSI_PROTOTYPES, not __STDC__, when deciding
whether to declare `tree_node' and `rtx_def'.
* tree.c (build): Switch on ANSI_PROTOTYPES, not __STDC__, when
deciding whether to use ANSI variable args.
(build_nt): Likewise.
(build_parse_node): Likewise.
From-SVN: r23577
1998-11-08 10:10:24 -05:00
|
|
|
|
#ifndef ANSI_PROTOTYPES
|
genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattrtab.c (fatal, attr_printf, attr_string, write_attr_set,
write_unit_name, write_eligible_delay, expand_units,
make_length_attrs, write_attr_case, find_attr,
make_internal_attr): Likewise.
* gencheck.c (tree_codes): Likewise.
* gencodes.c (fatal): Likewise.
* genconfig.c (fatal): Likewise.
* genemit.c (fatal): Likewise.
* genextract.c (fatal, walk_rtx, copystr): Likewise.
* genflags.c (fatal): Likewise.
* genopinit.c (fatal, optabs, gen_insn): Likewise.
* genoutput.c (fatal, error, predicates): Likewise.
* genpeep.c (fatal): Likewise.
* genrecog.c (fatal, decision, pred_table, add_to_sequence,
write_tree_1, write_tree, change_state, copystr, indents): Likewise.
From-SVN: r24377
1998-12-19 02:04:42 -05:00
|
|
|
|
format = va_arg (ap, const char *);
|
1998-05-11 02:50:51 -04:00
|
|
|
|
#endif
|
|
|
|
|
|
1991-10-24 13:21:48 -04:00
|
|
|
|
fprintf (stderr, "genextract: ");
|
1998-05-11 02:50:51 -04:00
|
|
|
|
vfprintf (stderr, format, ap);
|
|
|
|
|
va_end (ap);
|
1991-10-24 13:21:48 -04:00
|
|
|
|
fprintf (stderr, "\n");
|
|
|
|
|
exit (FATAL_EXIT_CODE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* More 'friendly' abort that prints the line and file.
|
|
|
|
|
config.h can #define abort fancy_abort if you like that sort of thing. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
fancy_abort ()
|
|
|
|
|
{
|
|
|
|
|
fatal ("Internal gcc abort.");
|
|
|
|
|
}
|
1992-03-07 04:41:00 -05:00
|
|
|
|
|
1999-01-13 05:46:45 -05:00
|
|
|
|
char *
|
1999-01-13 06:49:34 -05:00
|
|
|
|
xstrdup (input)
|
1999-01-13 05:46:45 -05:00
|
|
|
|
const char *input;
|
1992-04-18 16:23:49 -04:00
|
|
|
|
{
|
1999-01-13 05:46:45 -05:00
|
|
|
|
register size_t len = strlen (input) + 1;
|
|
|
|
|
register char *output = xmalloc (len);
|
|
|
|
|
memcpy (output, input, len);
|
|
|
|
|
return output;
|
1992-03-07 04:41:00 -05:00
|
|
|
|
}
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
main (argc, argv)
|
|
|
|
|
int argc;
|
|
|
|
|
char **argv;
|
|
|
|
|
{
|
|
|
|
|
rtx desc;
|
|
|
|
|
FILE *infile;
|
|
|
|
|
register int c, i;
|
1992-04-18 16:23:49 -04:00
|
|
|
|
struct extraction *p;
|
|
|
|
|
struct code_ptr *link;
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
|
|
|
|
obstack_init (rtl_obstack);
|
|
|
|
|
|
|
|
|
|
if (argc <= 1)
|
|
|
|
|
fatal ("No input file name.");
|
|
|
|
|
|
|
|
|
|
infile = fopen (argv[1], "r");
|
|
|
|
|
if (infile == 0)
|
|
|
|
|
{
|
|
|
|
|
perror (argv[1]);
|
|
|
|
|
exit (FATAL_EXIT_CODE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
init_rtl ();
|
|
|
|
|
|
|
|
|
|
/* Assign sequential codes to all entries in the machine description
|
|
|
|
|
in parallel with the tables in insn-output.c. */
|
|
|
|
|
|
|
|
|
|
insn_code_number = 0;
|
|
|
|
|
|
|
|
|
|
printf ("/* Generated automatically by the program `genextract'\n\
|
|
|
|
|
from the machine description file `md'. */\n\n");
|
|
|
|
|
|
|
|
|
|
printf ("#include \"config.h\"\n");
|
1998-04-01 17:44:48 -05:00
|
|
|
|
printf ("#include \"system.h\"\n");
|
Makefile.in (toplev.o): Depend on $(EXPR_H).
* Makefile.in (toplev.o): Depend on $(EXPR_H).
(insn-extract.o, insn-attrtab.o): Depend on toplev.h.
* gansidecl.h: Define ATTRIBUTE_NORETURN.
* genattrtab.c: Have insn-attrtab.c include toplev.h.
* genextract.c: Have insn-extract.c include toplev.h.
* rtl.h: Don't prototype `fatal_insn_not_found' and `fatal_insn'.
* toplev.c: Include expr.h.
(really_sorry, fancy_abort): Remove prototypes.
(set_target_switch): Add argument in prototype.
(vfatal): Mark prototype with ATTRIBUTE_NORETURN.
(v_really_sorry): Likewise.
(print_version, print_single_switch, print_switch_values): Make
static and add prototype arguments.
(decl_printable_name): Add prototype arguments.
(lang_expand_expr_t): New typedef.
(lang_expand_expr): Declare as a lang_expand_expr_t.
(incomplete_decl_finalize_hook): Add prototype argument.
(decl_name): Mark variable `verbosity' with ATTRIBUTE_UNUSED.
(botch): Likewise for variable `s'.
(rest_of_type_compilation): Mark variables `type' and `toplev'
with ATTRIBUTE_UNUSED if none of DBX_DEBUGGING_INFO,
XCOFF_DEBUGGING_INFO or SDB_DEBUGGING_INFO are defined.
(display_help): Make variable `i' an `unsigned long'.
(main): Remove unused parameter `envp'.
Cast assignment to `lang_expand_expr' to a `lang_expand_expr_t'.
Cast -1 when comparing it with a `size_t'.
* toplev.h (fatal, fatal_io_error, pfatal_with_name): Mark
prototype with ATTRIBUTE_NORETURN.
(fatal_insn_not_found, fatal_insn, really_sorry,
push_float_handler, pop_float_handler): Add prototypes.
(fancy_abort): Mark prototype with ATTRIBUTE_NORETURN.
(do_abort, botch): Add prototypes.
From-SVN: r22293
1998-09-06 01:56:20 -04:00
|
|
|
|
printf ("#include \"rtl.h\"\n");
|
Makefile.in (insn-extract.o): Fix dependencies.
* Makefile.in (insn-extract.o): Fix dependencies.
* genextract.c (main): Generate includes for insn-config.h and
recog.h.
Delete generation of declarations which are now in recog.h.
* genrecog.c (main): Delete generation of definitions which are
now in recog.c.
* local-alloc.c (block_alloc): Use extract_insn and the variables
it sets up instead of looking up values by insn_code.
* recog.c (recog_operand, recog_operand_loc, recog_dup_loc,
recog_dup_num): Define here instead of generating the definition in
genrecog.c.
(recog_n_operands, recog_n_dups, recog_n_alternatives,
recog_operand_mode, recog_constraints, recog_operand_address_p):
New variables.
(extract_insn): New function.
* recog.h (extract_insn): Declare function.
(which_alternative, recog_n_operands, recog_n_dups,
recog_n_alternatives, recog_operand_mode, recog_constraints,
recog_operand_address_p): Declare variables.
* regclass.c (n_occurrences): New static function.
* reload.c (n_occurrences): Delete function.
(find_reloads): Use extract_insn.
* reload.h (n_occurrences): Delete declaration.
From-SVN: r23147
1998-10-16 21:28:57 -04:00
|
|
|
|
printf ("#include \"insn-config.h\"\n");
|
|
|
|
|
printf ("#include \"recog.h\"\n");
|
Makefile.in (toplev.o): Depend on $(EXPR_H).
* Makefile.in (toplev.o): Depend on $(EXPR_H).
(insn-extract.o, insn-attrtab.o): Depend on toplev.h.
* gansidecl.h: Define ATTRIBUTE_NORETURN.
* genattrtab.c: Have insn-attrtab.c include toplev.h.
* genextract.c: Have insn-extract.c include toplev.h.
* rtl.h: Don't prototype `fatal_insn_not_found' and `fatal_insn'.
* toplev.c: Include expr.h.
(really_sorry, fancy_abort): Remove prototypes.
(set_target_switch): Add argument in prototype.
(vfatal): Mark prototype with ATTRIBUTE_NORETURN.
(v_really_sorry): Likewise.
(print_version, print_single_switch, print_switch_values): Make
static and add prototype arguments.
(decl_printable_name): Add prototype arguments.
(lang_expand_expr_t): New typedef.
(lang_expand_expr): Declare as a lang_expand_expr_t.
(incomplete_decl_finalize_hook): Add prototype argument.
(decl_name): Mark variable `verbosity' with ATTRIBUTE_UNUSED.
(botch): Likewise for variable `s'.
(rest_of_type_compilation): Mark variables `type' and `toplev'
with ATTRIBUTE_UNUSED if none of DBX_DEBUGGING_INFO,
XCOFF_DEBUGGING_INFO or SDB_DEBUGGING_INFO are defined.
(display_help): Make variable `i' an `unsigned long'.
(main): Remove unused parameter `envp'.
Cast assignment to `lang_expand_expr' to a `lang_expand_expr_t'.
Cast -1 when comparing it with a `size_t'.
* toplev.h (fatal, fatal_io_error, pfatal_with_name): Mark
prototype with ATTRIBUTE_NORETURN.
(fatal_insn_not_found, fatal_insn, really_sorry,
push_float_handler, pop_float_handler): Add prototypes.
(fancy_abort): Mark prototype with ATTRIBUTE_NORETURN.
(do_abort, botch): Add prototypes.
From-SVN: r22293
1998-09-06 01:56:20 -04:00
|
|
|
|
printf ("#include \"toplev.h\"\n\n");
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
|
|
|
|
/* This variable exists only so it can be the "location"
|
|
|
|
|
of any missing operand whose numbers are skipped by a given pattern. */
|
Warning fixes:
* Makefile.in (c-lang.o): Depend on c-tree.h, c-lex.h and toplev.h.
(c-lex.o): Depend on output.h.
(c-common.o): Likewise.
(stmt.o): Likewise.
(calls.o): Likewise.
(integrate.o): Depend on toplev.h.
(regclass.o): Depend on output.h.
(final.o): Depend on reload.h.
* c-common.c: Include output.h.
(check_format_info): Remove unused variable `integral_format'.
* c-decl.c (print_lang_decl): Mark parameters `file', `node' and
`indent' with ATTRIBUTE_UNUSED.
(print_lang_type): Likewise.
(maybe_build_cleanup): Likewise for parameter `decl'.
(copy_lang_decl): Likewise for parameter `node'.
* c-lang.c: Include c-tree.h, c-lex.h and toplev.h.
(lang_print_xnode): Mark parameters `file', `node' and `indent'
with ATTRIBUTE_UNUSED.
(lookup_interface): Likewise for parameter `arg'.
(is_class_name): Likewise.
(maybe_objc_check_decl): Likewise for parameter `decl'.
(maybe_objc_comptypes): Likewise for parameters `lhs', `rhs' and
`reflexive'.
(maybe_objc_method_name): Likewise for parameter `decl'.
(build_objc_string): Likewise for parameters `len' and `str'.
* c-lex.c: Include output.h.
* c-lex.h (position_after_white_space): Correct typo in prototype.
* c-tree.h (finish_file, c_expand_start_cond, c_expand_start_else,
c_expand_end_cond, init_iterators): Add prototypes.
* caller-save.c (set_reg_live): Mark parameters `reg' and `setter'
with ATTRIBUTE_UNUSED.
* calls.c: Include output.h.
* cccp.c (pipe_closed): Mark parameter `signo' with
ATTRIBUTE_UNUSED.
* combine.c: Move inclusion of expr.h to after insn-config.h.
* iris6.h (ASM_IDENTIFY_GCC, ASM_IDENTIFY_LANGUAGE): Don't define
as empty, rather define as ((void)0).
* sparc.c (sparc_check_64): Add braces around ambiguous `else'.
Add parentheses around assignment used as truth value.
* cplus-dem.c (squangle_mop_up): Change return type to void.
(internal_cplus_demangle): Remove unused parameter `options'.
All callers changed.
(cplus_demangle_opname): Remove function wide variable `int i' and
replace with `size_t i' at each location where it is used.
(cplus_demangle_opname): change type of `i' from int to size_t.
* cppexp.c (right_shift): Mark parameter `pfile' with
ATTRIBUTE_UNUSED.
* cpphash.c (cpp_lookup): Likewise.
(cpp_hash_cleanup): Likewise.
* cpplib.c (parse_name): Add a prototype and make it static.
(null_underflow): Mark parameter `pfile' with ATTRIBUTE_UNUSED.
(null_cleanup): Likewise for parameters `pbuf' and `pfile'.
(macro_cleanup): Likewise for parameter `pfile'.
(file_cleanup): Likewise.
* cpplib.h (cpp_reader_init, cpp_options_init, cpp_start_read,
cpp_read_check_assertion, skip_rest_of_line): Add prototypes.
* crtstuff.c (force_to_data, __CTOR_LIST__, force_to_data,
__DTOR_END__, __FRAME_END__): Mark with ATTRIBUTE_UNUSED.
* cse.c (cse_check_loop_start): Mark parameter `set' with
ATTRIBUTE_UNUSED.
* dbxout.c (flag_minimal_debug, have_used_extensions,
source_label_number): Move inside macro wrapper check against
defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO).
* dwarf2out.c (gen_entry_point_die): Hide prototype and definition.
* except.h (doing_eh): Provide prototype.
* expr.c: Move inclusion of expr.h to after insn-config.h.
* final.c: Include reload.h.
(shorten_branches): Cast the first argument of bzero to char *.
* fix-header.c (cpp_print_containing_files): Mark parameter
`pfile' with ATTRIBUTE_UNUSED.
(cpp_fatal): Likewise.
* flow.c (find_basic_blocks_1): Cast the first argument of bzero
to char *.
* genattrtab.c (make_length_attrs): Change the type of variable
`i' from int to size_t.
(zero_fn): Mark parameter `exp' with ATTRIBUTE_UNUSED.
(one_fn): Likewise.
* genextract.c (main): When generating insn-extract.c, mark
variable `junk' with ATTRIBUTE_UNUSED.
* gengenrtl.c (gencode): When generating genrtl.c, cast the first
argument of bzero to char*.
* integrate.c: Include toplev.h.
* libgcc2.c: Wrap `struct exception_table' and
`find_exception_handler' in macro DWARF2_UNWIND_INFO.
* objc/Make-lang.in (objc-act.o): Depend on toplev.h.
* objc/objc-act.c: Include toplev.h.
(lang_print_xnode): Mark parameters `file', `node' and `indent'
with ATTRIBUTE_UNUSED.
(finish_protocol): Likewise for parameter `protocol'.
* output.h (declare_weak): Add prototype.
(decode_reg_name): Don't wrap with TREE_CODE macro.
(assemble_alias): Add prototype.
* regclass.c: Include output.h.
* reload.h (reloads_conflict): Add prototype.
* rtl.h (print_rtl_single, mark_elimiation, reg_class_subset_p,
output_func_start_profiler): Add prototypes.
* rtlanal.c (reg_set_p_1): Mark parameters `x' and `pat' with
ATTRIBUTE_UNUSED.
* scan-decls.c: Include scan.h.
* scan.h (recognized_function, recognized_extern): Add prototypes.
* stmt.c: Include output.h.
* toplev.c (error_for_asm, warning_for_asm): Remove prototypes.
(output_lang_identify): Hide prototype and definition.
(float_signal): Mark parameter `signo' with ATTRIBUTE_UNUSED.
(pipe_closed): Likewise.
* toplev.h (count_error, strip_off_ending, error_for_asm,
warning_for_asm): Add prototypes.
From-SVN: r19712
1998-05-13 08:40:39 -04:00
|
|
|
|
printf ("static rtx junk ATTRIBUTE_UNUSED;\n");
|
1992-04-18 16:23:49 -04:00
|
|
|
|
|
1991-10-24 13:21:48 -04:00
|
|
|
|
printf ("void\ninsn_extract (insn)\n");
|
|
|
|
|
printf (" rtx insn;\n");
|
|
|
|
|
printf ("{\n");
|
1992-04-11 14:17:54 -04:00
|
|
|
|
printf (" register rtx *ro = recog_operand;\n");
|
|
|
|
|
printf (" register rtx **ro_loc = recog_operand_loc;\n");
|
1992-05-04 10:04:43 -04:00
|
|
|
|
printf (" rtx pat = PATTERN (insn);\n");
|
1998-06-22 01:23:33 -04:00
|
|
|
|
printf (" int i ATTRIBUTE_UNUSED;\n\n");
|
1999-02-26 11:00:08 -05:00
|
|
|
|
printf (" memset (ro, 0, sizeof (*ro) * MAX_RECOG_OPERANDS);\n");
|
|
|
|
|
printf (" memset (ro_loc, 0, sizeof (*ro_loc) * MAX_RECOG_OPERANDS);\n");
|
1992-05-04 10:04:43 -04:00
|
|
|
|
printf (" switch (INSN_CODE (insn))\n");
|
1991-10-24 13:21:48 -04:00
|
|
|
|
printf (" {\n");
|
1992-04-18 16:23:49 -04:00
|
|
|
|
printf (" case -1:\n");
|
|
|
|
|
printf (" fatal_insn_not_found (insn);\n\n");
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
|
|
|
|
/* Read the machine description. */
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
c = read_skip_spaces (infile);
|
|
|
|
|
if (c == EOF)
|
|
|
|
|
break;
|
|
|
|
|
ungetc (c, infile);
|
|
|
|
|
|
|
|
|
|
desc = read_rtx (infile);
|
|
|
|
|
if (GET_CODE (desc) == DEFINE_INSN)
|
|
|
|
|
{
|
|
|
|
|
gen_insn (desc);
|
|
|
|
|
++insn_code_number;
|
|
|
|
|
}
|
1992-04-18 16:23:49 -04:00
|
|
|
|
|
|
|
|
|
else if (GET_CODE (desc) == DEFINE_PEEPHOLE)
|
1991-10-24 13:21:48 -04:00
|
|
|
|
{
|
1992-04-18 16:23:49 -04:00
|
|
|
|
struct code_ptr *link
|
|
|
|
|
= (struct code_ptr *) xmalloc (sizeof (struct code_ptr));
|
|
|
|
|
|
|
|
|
|
link->insn_code = insn_code_number;
|
|
|
|
|
link->next = peepholes;
|
|
|
|
|
peepholes = link;
|
1991-10-24 13:21:48 -04:00
|
|
|
|
++insn_code_number;
|
|
|
|
|
}
|
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
else if (GET_CODE (desc) == DEFINE_EXPAND
|
|
|
|
|
|| GET_CODE (desc) == DEFINE_SPLIT)
|
|
|
|
|
++insn_code_number;
|
|
|
|
|
}
|
1991-10-24 13:21:48 -04:00
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
/* Write out code to handle peepholes and the insn_codes that it should
|
|
|
|
|
be called for. */
|
|
|
|
|
if (peepholes)
|
1991-10-24 13:21:48 -04:00
|
|
|
|
{
|
1992-04-18 16:23:49 -04:00
|
|
|
|
for (link = peepholes; link; link = link->next)
|
|
|
|
|
printf (" case %d:\n", link->insn_code);
|
|
|
|
|
|
1991-10-24 13:21:48 -04:00
|
|
|
|
/* The vector in the insn says how many operands it has.
|
|
|
|
|
And all it contains are operands. In fact, the vector was
|
|
|
|
|
created just for the sake of this function. */
|
1998-02-13 06:17:14 -05:00
|
|
|
|
printf (" for (i = XVECLEN (pat, 0) - 1; i >= 0; i--)\n");
|
1996-11-15 14:12:54 -05:00
|
|
|
|
printf (" ro[i] = XVECEXP (pat, 0, i);\n");
|
1992-04-18 16:23:49 -04:00
|
|
|
|
printf (" break;\n\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Write out all the ways to extract insn operands. */
|
|
|
|
|
for (p = extractions; p; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
for (link = p->insns; link; link = link->next)
|
|
|
|
|
printf (" case %d:\n", link->insn_code);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < p->op_count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (p->oplocs[i] == 0)
|
|
|
|
|
{
|
|
|
|
|
printf (" ro[%d] = const0_rtx;\n", i);
|
1993-04-13 17:19:54 -04:00
|
|
|
|
printf (" ro_loc[%d] = &junk;\n", i);
|
1992-04-18 16:23:49 -04:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf (" ro[%d] = *(ro_loc[%d] = &", i, i);
|
|
|
|
|
print_path (p->oplocs[i]);
|
|
|
|
|
printf (");\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < p->dup_count; i++)
|
|
|
|
|
{
|
|
|
|
|
printf (" recog_dup_loc[%d] = &", i);
|
|
|
|
|
print_path (p->duplocs[i]);
|
|
|
|
|
printf (";\n");
|
|
|
|
|
printf (" recog_dup_num[%d] = %d;\n", i, p->dupnums[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf (" break;\n\n");
|
1991-10-24 13:21:48 -04:00
|
|
|
|
}
|
|
|
|
|
|
1992-04-18 16:23:49 -04:00
|
|
|
|
/* This should never be reached. Note that we would also reach this abort
|
|
|
|
|
if we tried to extract something whose INSN_CODE was a DEFINE_EXPAND or
|
|
|
|
|
DEFINE_SPLIT, but that is correct. */
|
|
|
|
|
printf (" default:\n abort ();\n");
|
|
|
|
|
|
1991-10-24 13:21:48 -04:00
|
|
|
|
printf (" }\n}\n");
|
|
|
|
|
|
|
|
|
|
fflush (stdout);
|
|
|
|
|
exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
|
|
|
|
|
/* NOTREACHED */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|