* Makefile.in (gensupport.o): Compile for the host.
(host-prefix gensuuprt.o): Remove.
(genflags.o): Depend on gensupport.h and OBSTACK_H.
(genattrtab.o): Likewise.
(gencodes.o): Depend on gensupport.h.
(genemit.o, genopinit.o, genrecog.o, genextract.o): Likewise.
(genpeep.o, genattr.o, genoutput.o): Likewise.
* gensupport.c (obstack, rtl_obstack): New.
(init_md_reader): Initialize rtl_obstack.
* gensupport.h (rtl_obstack): Declare.
(message_with_line): Declare.
* genattr.c: Remove all traces of obstack manipulation.
* gencodes.c, genconfig.c, genemit.c, genextract.c: Likewise.
* genopinit.c, genoutput.c, genpeep.c, genrecog.c: Likewise.
* genattrtab.c (obstack, rtl_obstack): Remove.
(main): Don't init rtl_obstack.
* genflags.c: Likewise.
* genrecog.c (message_with_line): Move ...
* gensupport.c: ... here.
From-SVN: r33742
+2000-05-06 Richard Henderson <rth@cygnus.com>
+
+ * Makefile.in (gensupport.o): Compile for the host.
+ (host-prefix gensuuprt.o): Remove.
+ (genflags.o): Depend on gensupport.h and OBSTACK_H.
+ (genattrtab.o): Likewise.
+ (gencodes.o): Depend on gensupport.h.
+ (genemit.o, genopinit.o, genrecog.o, genextract.o): Likewise.
+ (genpeep.o, genattr.o, genoutput.o): Likewise.
+
+ * gensupport.c (obstack, rtl_obstack): New.
+ (init_md_reader): Initialize rtl_obstack.
+ * gensupport.h (rtl_obstack): Declare.
+ (message_with_line): Declare.
+
+ * genattr.c: Remove all traces of obstack manipulation.
+ * gencodes.c, genconfig.c, genemit.c, genextract.c: Likewise.
+ * genopinit.c, genoutput.c, genpeep.c, genrecog.c: Likewise.
+
+ * genattrtab.c (obstack, rtl_obstack): Remove.
+ (main): Don't init rtl_obstack.
+ * genflags.c: Likewise.
+
+ * genrecog.c (message_with_line): Move ...
+ * gensupport.c: ... here.
+
2000-05-06 Richard Henderson <rth@cygnus.com>
* c-typeck.c (build_c_cast): Remove dead code.
$(HOST_CLIB)
HOST_RTL = $(HOST_PREFIX)rtl.o $(HOST_PREFIX)bitmap.o \
- $(HOST_PREFIX)ggc-none.o $(HOST_PREFIX)gensupport.o
+ $(HOST_PREFIX)ggc-none.o gensupport.o
HOST_PRINT = $(HOST_PREFIX)print-rtl.o
HOST_ERRORS = $(HOST_PREFIX)errors.o
-c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
rtl.o : rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h $(GGC_H) toplev.h
-gensupport.o : gensupport.c $(CONFIG_H) system.h $(RTL_H)
print-rtl.o : print-rtl.c $(CONFIG_H) system.h $(RTL_H) $(BASIC_BLOCK_H)
rtlanal.o : rtlanal.c $(CONFIG_H) system.h $(RTL_H)
$(MD_CPP) $(MD_CPPFLAGS) $(md_file) | sed 's/^# /; /g' > tmp-$@
mv tmp-$@ $@
+gensupport.o: gensupport.c $(RTL_H) $(OBSTACK_H) system.h errors.h gensupport.h
+ $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)$(srcdir)/gensupport.c
+
genconfig : genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
-genconfig.o : genconfig.c $(RTL_H) $(build_xm_file) system.h errors.h
+genconfig.o : genconfig.c $(RTL_H) $(build_xm_file) \
+ system.h errors.h gensupport.h
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
genflags : genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
-genflags.o : genflags.c $(RTL_H) $(build_xm_file) system.h errors.h
+genflags.o : genflags.c $(RTL_H) $(OBSTACK_H) $(build_xm_file) \
+ system.h errors.h gensupport.h
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
gencodes : gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
-gencodes.o : gencodes.c $(RTL_H) $(build_xm_file) system.h errors.h
+gencodes.o : gencodes.c $(RTL_H) $(build_xm_file) \
+ system.h errors.h gensupport.h
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
genemit : genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
-genemit.o : genemit.c $(RTL_H) $(build_xm_file) system.h errors.h
+genemit.o : genemit.c $(RTL_H) $(build_xm_file) system.h errors.h gensupport.h
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
genopinit : genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
-genopinit.o : genopinit.c $(RTL_H) $(build_xm_file) system.h errors.h
+genopinit.o : genopinit.c $(RTL_H) $(build_xm_file) \
+ system.h errors.h gensupport.h
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
genrecog : genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
-genrecog.o : genrecog.c $(RTL_H) $(build_xm_file) system.h errors.h
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
-
+genrecog.o : genrecog.c $(RTL_H) $(build_xm_file) \
+ system.h errors.h gensupport.h
+ $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
genextract : genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
-genextract.o : genextract.c $(RTL_H) $(build_xm_file) system.h insn-config.h errors.h
+genextract.o : genextract.c $(RTL_H) $(build_xm_file) \
+ system.h insn-config.h errors.h gensupport.h
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
genpeep : genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
-genpeep.o : genpeep.c $(RTL_H) $(build_xm_file) system.h errors.h
+genpeep.o : genpeep.c $(RTL_H) $(build_xm_file) system.h errors.h gensupport.h
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
genattr : genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
-genattr.o : genattr.c $(RTL_H) $(build_xm_file) system.h errors.h
+genattr.o : genattr.c $(RTL_H) $(build_xm_file) system.h errors.h gensupport.h
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
-genattrtab.o : genattrtab.c $(RTL_H) $(build_xm_file) system.h errors.h $(GGC_H)
+genattrtab.o : genattrtab.c $(RTL_H) $(OBSTACK_H) $(build_xm_file) \
+ system.h errors.h $(GGC_H) gensupport.h
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
genoutput : genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
-genoutput.o : genoutput.c $(RTL_H) $(build_xm_file) system.h errors.h
+genoutput.o : genoutput.c $(RTL_H) $(build_xm_file) \
+ system.h errors.h gensupport.h
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
gengenrtl : gengenrtl.o $(HOST_LIBDEPS)
sed -e 's/config[.]h/hconfig.h/' $(srcdir)/ggc-none.c > $(HOST_PREFIX)ggc-none.c
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)ggc-none.c
-$(HOST_PREFIX_1)gensupport.o: gensupport.c
- rm -f $(HOST_PREFIX)gensupport.c
- $(LN_S) $(srcdir)/gensupport.c $(HOST_PREFIX)gensupport.c
- $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)gensupport.c
-
#\f
# Remake internationalization support.
#include "hconfig.h"
#include "system.h"
#include "rtl.h"
-#include "obstack.h"
#include "errors.h"
#include "gensupport.h"
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
/* A range of values. */
init_range (&all_blockage);
progname = "genattr";
- obstack_init (rtl_obstack);
if (argc <= 1)
fatal ("No input file name.");
#include "obstack.h"
#include "errors.h"
-static struct obstack obstack, obstack1, obstack2;
-struct obstack *rtl_obstack = &obstack;
+static struct obstack obstack1, obstack2;
struct obstack *hash_obstack = &obstack1;
struct obstack *temp_obstack = &obstack2;
if (argc <= 1)
fatal ("No input file name.");
- if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE)
- return (FATAL_EXIT_CODE);
-
#if defined (RLIMIT_STACK) && defined (HAVE_GETRLIMIT) && defined (HAVE_SETRLIMIT)
/* Get rid of any avoidable limit on stack size. */
{
}
#endif
- progname = "genattrtab";
- obstack_init (rtl_obstack);
+ if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE)
+ return (FATAL_EXIT_CODE);
+
obstack_init (hash_obstack);
obstack_init (temp_obstack);
#include "hconfig.h"
#include "system.h"
#include "rtl.h"
-#include "obstack.h"
#include "errors.h"
#include "gensupport.h"
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
static int insn_code_number;
rtx desc;
progname = "gencodes";
- obstack_init (rtl_obstack);
if (argc <= 1)
fatal ("No input file name.");
#include "hconfig.h"
#include "system.h"
#include "rtl.h"
-#include "obstack.h"
#include "errors.h"
#include "gensupport.h"
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
/* flags to determine output of machine description dependent #define's. */
static int max_recog_operands; /* Largest operand number seen. */
rtx desc;
progname = "genconfig";
- obstack_init (rtl_obstack);
if (argc <= 1)
fatal ("No input file name.");
#include "hconfig.h"
#include "system.h"
#include "rtl.h"
-#include "obstack.h"
#include "errors.h"
#include "gensupport.h"
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
static int max_opno;
static int max_dup_opno;
rtx desc;
progname = "genemit";
- obstack_init (rtl_obstack);
if (argc <= 1)
fatal ("No input file name.");
#include "hconfig.h"
#include "system.h"
#include "rtl.h"
-#include "obstack.h"
#include "errors.h"
#include "insn-config.h"
#include "gensupport.h"
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
/* This structure contains all the information needed to describe one
set of extractions methods. Each method may be used by more than
const char *name;
progname = "genextract";
- obstack_init (rtl_obstack);
if (argc <= 1)
fatal ("No input file name.");
#include "errors.h"
#include "gensupport.h"
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
rtx *insn_ptr;
progname = "genflags";
- obstack_init (rtl_obstack);
obstack_init (&call_obstack);
obstack_init (&normal_obstack);
#include "hconfig.h"
#include "system.h"
#include "rtl.h"
-#include "obstack.h"
#include "errors.h"
#include "gensupport.h"
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
/* Many parts of GCC use arrays that are indexed by machine mode and
contain the insn codes for pattern in the MD file that perform a given
rtx desc;
progname = "genopinit";
- obstack_init (rtl_obstack);
if (argc <= 1)
fatal ("No input file name.");
#include "hconfig.h"
#include "system.h"
#include "rtl.h"
-#include "obstack.h"
#include "errors.h"
#include "gensupport.h"
#define MAX_MAX_OPERANDS 40
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
static int n_occurrences PARAMS ((int, const char *));
static const char *strip_whitespace PARAMS ((const char *));
rtx desc;
progname = "genoutput";
- obstack_init (rtl_obstack);
if (argc <= 1)
fatal ("No input file name.");
#include "hconfig.h"
#include "system.h"
#include "rtl.h"
-#include "obstack.h"
#include "errors.h"
#include "gensupport.h"
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
/* While tree-walking an instruction pattern, we keep a chain
of these `struct link's to record how to get down to the
max_opno = -1;
progname = "genpeep";
- obstack_init (rtl_obstack);
if (argc <= 1)
fatal ("No input file name.");
#include "hconfig.h"
#include "system.h"
#include "rtl.h"
-#include "obstack.h"
#include "errors.h"
#include "gensupport.h"
+
#define OUTPUT_LABEL(INDENT_STRING, LABEL_NUMBER) \
printf("%sL%d: ATTRIBUTE_UNUSED_LABEL\n", (INDENT_STRING), (LABEL_NUMBER))
-static struct obstack obstack;
-struct obstack *rtl_obstack = &obstack;
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
/* Holds an array of names indexed by insn_code_number. */
static char **insn_name_ptr = 0;
static int insn_name_ptr_size = 0;
#define NUM_SPECIAL_MODE_PREDS \
(sizeof (special_mode_pred_table) / sizeof (special_mode_pred_table[0]))
-static void message_with_line
- PARAMS ((int, const char *, ...)) ATTRIBUTE_PRINTF_2;
-
static struct decision *new_decision
PARAMS ((const char *, struct decision_head *));
static struct decision_test *new_decision_test
extern void debug_decision_list
PARAMS ((struct decision *));
\f
-static void
-message_with_line VPARAMS ((int lineno, const char *msg, ...))
-{
-#ifndef ANSI_PROTOTYPES
- int lineno;
- const char *msg;
-#endif
- va_list ap;
-
- VA_START (ap, msg);
-
-#ifndef ANSI_PROTOTYPES
- lineno = va_arg (ap, int);
- msg = va_arg (ap, const char *);
-#endif
-
- fprintf (stderr, "%s:%d: ", read_rtx_filename, lineno);
- vfprintf (stderr, msg, ap);
- fputc ('\n', stderr);
-
- va_end (ap);
-}
-\f
/* Create a new node in sequence after LAST. */
static struct decision *
register int c;
progname = "genrecog";
- obstack_init (rtl_obstack);
memset (&recog_tree, 0, sizeof recog_tree);
memset (&split_tree, 0, sizeof split_tree);
-/* Read machine descriptions, return top level rtx for use by the
- various generation passes.
-
+/* Support routines for the various generation passes.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
#include "hconfig.h"
#include "system.h"
#include "rtl.h"
+#include "obstack.h"
#include "errors.h"
#include "gensupport.h"
+
+static struct obstack obstack;
+struct obstack *rtl_obstack = &obstack;
+
+#define obstack_chunk_alloc xmalloc
+#define obstack_chunk_free free
+
static FILE *input_file;
static int sequence_num;
static void remove_constraints PARAMS ((rtx));
static void process_rtx PARAMS ((rtx *));
+\f
+void
+message_with_line VPARAMS ((int lineno, const char *msg, ...))
+{
+#ifndef ANSI_PROTOTYPES
+ int lineno;
+ const char *msg;
+#endif
+ va_list ap;
+
+ VA_START (ap, msg);
+
+#ifndef ANSI_PROTOTYPES
+ lineno = va_arg (ap, int);
+ msg = va_arg (ap, const char *);
+#endif
+ fprintf (stderr, "%s:%d: ", read_rtx_filename, lineno);
+ vfprintf (stderr, msg, ap);
+ fputc ('\n', stderr);
+
+ va_end (ap);
+}
+\f
/* Recursively remove constraints from an rtx. */
static void
rtx_ready_queue = elem;
}
}
-
+\f
/* The entry point for initializing the reader. */
int
init_md_reader (filename)
const char *filename;
{
-
+ read_rtx_filename = filename;
input_file = fopen (filename, "r");
-
if (input_file == 0)
{
perror (filename);
return FATAL_EXIT_CODE;
}
- read_rtx_filename = filename;
+ obstack_init (rtl_obstack);
sequence_num = 0;
rtx_ready_queue = NULL;
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+struct obstack;
+extern struct obstack *rtl_obstack;
+
extern int init_md_reader PARAMS ((const char *));
extern rtx read_md_rtx PARAMS ((int *, int *));
-
+extern void message_with_line PARAMS ((int, const char *, ...))
+ ATTRIBUTE_PRINTF_2;