Commit 10692477 by Richard Sandiford Committed by Richard Sandiford

Makefile.in (READ_MD_H): New variable.

gcc/
	* Makefile.in (READ_MD_H): New variable.
	(BUILD_RTL): Add build/read-md.o.
	(lto-wrapper.o): Depend on coretypes.h instead of defaults.h.
	(build/gensupport.o, build/read-rtl.o, build/genattr.o)
	(build/genattrtab.o, build/genconditions.o build/genemit.o)
	(build/genextract.o, build/genflags.o, build/genoutput.o)
	(build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H).
	(build/read-md.o): New rule.
	* defaults.h (obstack_chunk_alloc, obstack_chunk_free)
	(OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to...
	* coretypes.h: ...here.
	* lto-wrapper.c: Include coretypes.h instead of defaults.h.
	* pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete.
	* genattr.c: Include read-md.h.
	* genattrtab.c: Likewise.
	* genconditions.c: Likewise.
	* genemit.c: Likewise.
	* genextract.c: Likewise.
	* genflags.c: Likewise.
	* genoutput.c: Likewise.
	* genpreds.c: Likewise.
	* genrecog.c: Likewise.
	* rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc)
	(join_c_conditions, print_c_condition, read_rtx_filename)
	(read_rtx_lineno): Move to read-md.h.
	* read-rtl.c: Include read-md.h.
	(ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack)
	(joined_conditions, joined_conditions_obstack, read_rtx_lineno)
	(read_rtx_filename, fatal_with_file_and_line, fatal_expected_char)
	(leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc)
	(copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions)
	(print_c_condition, read_skip_spaces, read_escape, read_quoted_string)
	(read_braced_string, read_string): Move to read-md.c.
	(read_rtx): Move some initialization to init_md_reader and call
	init_md_reader here.
	* gensupport.h (message_with_line, n_comma_elts, scan_comma_elt):
	Move to read-md.h.
	* gensupport.c: Include read-md.h.
	(message_with_line, n_comma_elts, scan_comma_elt): Move to
	read-md.c.
	* read-md.h, read-md.c: New files.

From-SVN: r160570
parent f14b9067
2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
* Makefile.in (READ_MD_H): New variable.
(BUILD_RTL): Add build/read-md.o.
(lto-wrapper.o): Depend on coretypes.h instead of defaults.h.
(build/gensupport.o, build/read-rtl.o, build/genattr.o)
(build/genattrtab.o, build/genconditions.o build/genemit.o)
(build/genextract.o, build/genflags.o, build/genoutput.o)
(build/genpreds.o, build/genrecog.o): Depend on $(READ_MD_H).
(build/read-md.o): New rule.
* defaults.h (obstack_chunk_alloc, obstack_chunk_free)
(OBSTACK_CHUNK_SIZE, gcc_obstack_init): Move to...
* coretypes.h: ...here.
* lto-wrapper.c: Include coretypes.h instead of defaults.h.
* pretty-print.c (obstack_chunk_alloc, obstack_chunk_free): Delete.
* genattr.c: Include read-md.h.
* genattrtab.c: Likewise.
* genconditions.c: Likewise.
* genemit.c: Likewise.
* genextract.c: Likewise.
* genflags.c: Likewise.
* genoutput.c: Likewise.
* genpreds.c: Likewise.
* genrecog.c: Likewise.
* rtl.h (read_skip_spaces, copy_rtx_ptr_loc, print_rtx_ptr_loc)
(join_c_conditions, print_c_condition, read_rtx_filename)
(read_rtx_lineno): Move to read-md.h.
* read-rtl.c: Include read-md.h.
(ptr_loc, string_obstack, ptr_locs, ptr_loc_obstack)
(joined_conditions, joined_conditions_obstack, read_rtx_lineno)
(read_rtx_filename, fatal_with_file_and_line, fatal_expected_char)
(leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc, get_rtx_ptr_loc)
(copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions)
(print_c_condition, read_skip_spaces, read_escape, read_quoted_string)
(read_braced_string, read_string): Move to read-md.c.
(read_rtx): Move some initialization to init_md_reader and call
init_md_reader here.
* gensupport.h (message_with_line, n_comma_elts, scan_comma_elt):
Move to read-md.h.
* gensupport.c: Include read-md.h.
(message_with_line, n_comma_elts, scan_comma_elt): Move to
read-md.c.
* read-md.h, read-md.c: New files.
2010-06-10 Anatoly Sokolov <aesok@post.ru>
* config/moxie/moxie.h (FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE,
......
......@@ -871,6 +871,7 @@ RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) reg-notes.def insn-notes.def \
$(INPUT_H) $(REAL_H) statistics.h $(VEC_H) $(FIXED_VALUE_H) alias.h
FIXED_VALUE_H = fixed-value.h $(MACHMODE_H) double-int.h
RTL_H = $(RTL_BASE_H) genrtl.h vecir.h
READ_MD_H = $(OBSTACK_H) read-md.h
PARAMS_H = params.h params.def
BUILTINS_DEF = builtins.def sync-builtins.def omp-builtins.def
TREE_H = tree.h all-tree.def tree.def c-family/c-common.def \
......@@ -1036,8 +1037,9 @@ LDEXP_LIB = @LDEXP_LIB@
# even if we are cross-building GCC.
BUILD_LIBS = $(BUILD_LIBIBERTY)
BUILD_RTL = build/rtl.o build/read-rtl.o build/ggc-none.o build/vec.o \
build/min-insn-modes.o build/gensupport.o build/print-rtl.o
BUILD_RTL = build/read-md.o build/rtl.o build/read-rtl.o build/ggc-none.o \
build/vec.o build/min-insn-modes.o build/gensupport.o \
build/print-rtl.o
BUILD_ERRORS = build/errors.o
# Specify the directories to be searched for header files.
......@@ -2059,7 +2061,7 @@ lto-wrapper$(exeext): lto-wrapper.o intl.o $(LIBDEPS)
$(COMPILER) $(ALL_COMPILERFLAGS) $(LDFLAGS) -o T$@ lto-wrapper.o intl.o $(LIBS)
mv -f T$@ $@
lto-wrapper.o: lto-wrapper.c $(CONFIG_H) $(SYSTEM_H) defaults.h intl.h \
lto-wrapper.o: lto-wrapper.c $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h \
$(OBSTACK_H)
# Files used by all variants of C.
......@@ -3765,15 +3767,18 @@ build/%.o : # dependencies provided by explicit rule later
build/errors.o : errors.c $(BCONFIG_H) $(SYSTEM_H) errors.h
build/gensupport.o: gensupport.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
$(GTM_H) $(RTL_BASE_H) $(OBSTACK_H) errors.h $(HASHTAB_H) \
gensupport.h
$(READ_MD_H) gensupport.h
build/ggc-none.o : ggc-none.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
$(GGC_H)
build/min-insn-modes.o : min-insn-modes.c $(BCONFIG_H) $(SYSTEM_H) \
$(MACHMODE_H)
build/print-rtl.o: print-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
$(GTM_H) $(RTL_BASE_H)
build/read-md.o: read-md.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
$(HASHTAB_H) $(READ_MD_H)
build/read-rtl.o: read-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h \
$(GTM_H) $(RTL_BASE_H) $(OBSTACK_H) $(HASHTAB_H) gensupport.h
$(GTM_H) $(RTL_BASE_H) $(OBSTACK_H) $(HASHTAB_H) $(READ_MD_H) \
gensupport.h
build/rtl.o: rtl.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) \
$(RTL_H) $(GGC_H) errors.h
build/vec.o : vec.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(VEC_H) \
......@@ -3791,10 +3796,10 @@ build/gencondmd.o : \
# ...these are the programs themselves.
build/genattr.o : genattr.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h
coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
build/genattrtab.o : genattrtab.c $(RTL_BASE_H) $(OBSTACK_H) \
$(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(GGC_H) \
gensupport.h
$(READ_MD_H) gensupport.h
build/genautomata.o : genautomata.c $(RTL_BASE_H) $(OBSTACK_H) \
$(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(VEC_H) \
$(HASHTAB_H) gensupport.h
......@@ -3804,17 +3809,19 @@ build/genchecksum.o : genchecksum.c $(BCONFIG_H) $(SYSTEM_H) $(MD5_H)
build/gencodes.o : gencodes.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h
build/genconditions.o : genconditions.c $(RTL_BASE_H) $(BCONFIG_H) \
$(SYSTEM_H) coretypes.h $(GTM_H) errors.h
$(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(HASHTAB_H) $(READ_MD_H) \
gensupport.h
build/genconfig.o : genconfig.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h
build/genconstants.o : genconstants.c $(RTL_BASE_H) $(BCONFIG_H) \
$(SYSTEM_H) coretypes.h $(GTM_H) errors.h
build/genemit.o : genemit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h
coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
build/genextract.o : genextract.c $(RTL_BASE_H) $(BCONFIG_H) \
$(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h vecprim.h
$(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h \
vecprim.h
build/genflags.o : genflags.c $(RTL_BASE_H) $(OBSTACK_H) $(BCONFIG_H) \
$(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h
$(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
build/gengenrtl.o : gengenrtl.c $(BCONFIG_H) $(SYSTEM_H) rtl.def
build/gengtype-lex.o : gengtype-lex.c gengtype.h $(BCONFIG_H) $(SYSTEM_H)
build/gengtype-parse.o : gengtype-parse.c gengtype.h $(BCONFIG_H) \
......@@ -3828,13 +3835,13 @@ build/genmodes.o : genmodes.c $(BCONFIG_H) $(SYSTEM_H) errors.h \
build/genopinit.o : genopinit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h
build/genoutput.o : genoutput.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h
coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
build/genpeep.o : genpeep.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h $(TOPLEV_H)
build/genpreds.o : genpreds.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h $(OBSTACK_H)
coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h $(OBSTACK_H)
build/genrecog.o : genrecog.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
coretypes.h $(GTM_H) errors.h gensupport.h
coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
# Compile the programs that generate insn-* from the machine description.
# They are compiled with $(COMPILER_FOR_BUILD), and associated libraries,
......
......@@ -113,6 +113,15 @@ typedef const struct edge_def *const_edge;
struct basic_block_def;
typedef struct basic_block_def *basic_block;
typedef const struct basic_block_def *const_basic_block;
#define obstack_chunk_alloc ((void *(*) (long)) xmalloc)
#define obstack_chunk_free ((void (*) (void *)) free)
#define OBSTACK_CHUNK_SIZE 0
#define gcc_obstack_init(OBSTACK) \
_obstack_begin ((OBSTACK), OBSTACK_CHUNK_SIZE, 0, \
obstack_chunk_alloc, \
obstack_chunk_free)
#else
struct _dont_use_rtx_here_;
......
......@@ -32,14 +32,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GET_ENVIRONMENT(VALUE, NAME) do { (VALUE) = getenv (NAME); } while (0)
#endif
#define obstack_chunk_alloc ((void *(*) (long)) xmalloc)
#define obstack_chunk_free ((void (*) (void *)) free)
#define OBSTACK_CHUNK_SIZE 0
#define gcc_obstack_init(OBSTACK) \
_obstack_begin ((OBSTACK), OBSTACK_CHUNK_SIZE, 0, \
obstack_chunk_alloc, \
obstack_chunk_free)
/* Store in OUTPUT a string (made with alloca) containing an
assembler-name for a local static variable or function named NAME.
LABELNO is an integer which is different for each call. */
......
......@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "rtl.h"
#include "errors.h"
#include "read-md.h"
#include "gensupport.h"
......
......@@ -109,9 +109,10 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "gensupport.h"
#include "obstack.h"
#include "errors.h"
#include "read-md.h"
#include "gensupport.h"
/* Flags for make_internal_attr's `special' parameter. */
#define ATTR_NONE 0
......
......@@ -33,6 +33,7 @@
#include "rtl.h"
#include "errors.h"
#include "hashtab.h"
#include "read-md.h"
#include "gensupport.h"
/* so we can include except.h in the generated file. */
......
......@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "rtl.h"
#include "errors.h"
#include "read-md.h"
#include "gensupport.h"
......
......@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "rtl.h"
#include "errors.h"
#include "read-md.h"
#include "gensupport.h"
#include "vec.h"
#include "vecprim.h"
......
......@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "rtl.h"
#include "obstack.h"
#include "errors.h"
#include "read-md.h"
#include "gensupport.h"
/* Obstack to remember insns with. */
......
......@@ -88,6 +88,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "rtl.h"
#include "errors.h"
#include "read-md.h"
#include "gensupport.h"
/* No instruction can have more operands than this. Sorry for this
......
......@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "rtl.h"
#include "errors.h"
#include "obstack.h"
#include "read-md.h"
#include "gensupport.h"
/* Given a predicate expression EXP, from form NAME at line LINENO,
......
......@@ -56,6 +56,7 @@
#include "tm.h"
#include "rtl.h"
#include "errors.h"
#include "read-md.h"
#include "gensupport.h"
#define OUTPUT_LABEL(INDENT_STRING, LABEL_NUMBER) \
......
......@@ -26,6 +26,7 @@
#include "obstack.h"
#include "errors.h"
#include "hashtab.h"
#include "read-md.h"
#include "gensupport.h"
......@@ -119,20 +120,6 @@ static char *save_string (const char *, int);
static void init_predicate_table (void);
static void record_insn_name (int, const char *);
void
message_with_line (int lineno, const char *msg, ...)
{
va_list ap;
va_start (ap, msg);
fprintf (stderr, "%s:%d: ", read_rtx_filename, lineno);
vfprintf (stderr, msg, ap);
fputc ('\n', stderr);
va_end (ap);
}
/* Make a version of gen_rtx_CONST_INT so that GEN_INT can be used in
the gensupport programs. */
......@@ -1227,53 +1214,6 @@ traverse_c_tests (htab_trav callback, void *info)
htab_traverse (condition_table, callback, info);
}
/* Given a string, return the number of comma-separated elements in it.
Return 0 for the null string. */
int
n_comma_elts (const char *s)
{
int n;
if (*s == '\0')
return 0;
for (n = 1; *s; s++)
if (*s == ',')
n++;
return n;
}
/* Given a pointer to a (char *), return a pointer to the beginning of the
next comma-separated element in the string. Advance the pointer given
to the end of that element. Return NULL if at end of string. Caller
is responsible for copying the string if necessary. White space between
a comma and an element is ignored. */
const char *
scan_comma_elt (const char **pstr)
{
const char *start;
const char *p = *pstr;
if (*p == ',')
p++;
while (ISSPACE(*p))
p++;
if (*p == '\0')
return NULL;
start = p;
while (*p != ',' && *p != '\0')
p++;
*pstr = p;
return start;
}
/* Helper functions for define_predicate and define_special_predicate
processing. Shared between genrecog.c and genpreds.c. */
......
......@@ -29,9 +29,6 @@ extern int init_md_reader_args_cb (int, char **, bool (*)(const char *));
extern int init_md_reader_args (int, char **);
extern rtx read_md_rtx (int *, int *);
extern void message_with_line (int, const char *, ...)
ATTRIBUTE_PRINTF_2;
/* Set this to 0 to disable automatic elision of insn patterns which
can never be used in this configuration. See genconditions.c.
Must be set before calling init_md_reader. */
......@@ -60,9 +57,6 @@ extern int cmp_c_test (const void *, const void *);
extern void traverse_c_tests (htab_trav, void *);
#endif
extern int n_comma_elts (const char *);
extern const char *scan_comma_elt (const char **);
/* Predicate handling: helper functions and data structures. */
struct pred_data
......
......@@ -39,12 +39,12 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include <errno.h>
#include <signal.h>
#if ! defined( SIGCHLD ) && defined( SIGCLD )
# define SIGCHLD SIGCLD
#endif
#include "defaults.h"
#include "intl.h"
#include "libiberty.h"
#include "obstack.h"
......
......@@ -29,9 +29,6 @@ along with GCC; see the file COPYING3. If not see
#include <iconv.h>
#endif
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
/* A pointer to the formatted diagnostic message. */
#define pp_formatted_text_data(PP) \
((const char *) obstack_base (pp_base (PP)->buffer->obstack))
......
This diff is collapsed. Click to expand it.
/* MD reader definitions.
Copyright (C) 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
Free Software Foundation, Inc.
This file is part of GCC.
GCC 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 3, or (at your option) any later
version.
GCC 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 GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "obstack.h"
extern int read_rtx_lineno;
extern const char *read_rtx_filename;
extern struct obstack string_obstack;
extern void copy_rtx_ptr_loc (const void *, const void *);
extern void print_rtx_ptr_loc (const void *);
extern const char *join_c_conditions (const char *, const char *);
extern void print_c_condition (const char *);
extern void message_with_line (int, const char *, ...) ATTRIBUTE_PRINTF_2;
extern void fatal_with_file_and_line (FILE *, const char *, ...)
ATTRIBUTE_PRINTF_2 ATTRIBUTE_NORETURN;
extern void fatal_expected_char (FILE *, int, int) ATTRIBUTE_NORETURN;
extern int read_skip_spaces (FILE *);
extern char *read_quoted_string (FILE *);
extern char *read_string (FILE *, int);
extern int n_comma_elts (const char *);
extern const char *scan_comma_elt (const char **);
extern void init_md_reader (void);
......@@ -2361,14 +2361,7 @@ extern void traverse_md_constants (int (*) (void **, void *), void *);
struct md_constant { char *name, *value; };
/* In read-rtl.c */
extern int read_skip_spaces (FILE *);
extern bool read_rtx (FILE *, rtx *, int *);
extern void copy_rtx_ptr_loc (const void *, const void *);
extern void print_rtx_ptr_loc (const void *);
extern const char *join_c_conditions (const char *, const char *);
extern void print_c_condition (const char *);
extern const char *read_rtx_filename;
extern int read_rtx_lineno;
/* In alias.c */
extern rtx canon_rtx (rtx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment