genattr-common.c: New.

* genattr-common.c: New.  Based on genattr.c.
	* Makefile.in (INSN_ATTR_H): Include insn-attr-common.h.
	(MOSTLYCLEANFILES): Add insn-attr-common.h.
	(opts.o): Update dependencies.
	(.PRECIOUS): Add insn-attr-common.h.
	(simple_rtl_generated_h): Add insn-attr-common.h.
	(build/genattr-common.o): New.
	(genprogrtl): Add attr-common.
	* genattr.c (main): Include insn-attr-common.h.  Don't generate
	definitions of DELAY_SLOTS or INSN_SCHEDULING.
	* opts.c: Include insn-attr-common.h instead of rtl.h and
	insn-attr.h.

From-SVN: r175579
This commit is contained in:
Joseph Myers 2011-06-28 11:28:09 +01:00 committed by Joseph Myers
parent a9633db4d2
commit 88a00ef7d6
5 changed files with 114 additions and 13 deletions

View File

@ -1,3 +1,18 @@
2011-06-28 Joseph Myers <joseph@codesourcery.com>
* genattr-common.c: New. Based on genattr.c.
* Makefile.in (INSN_ATTR_H): Include insn-attr-common.h.
(MOSTLYCLEANFILES): Add insn-attr-common.h.
(opts.o): Update dependencies.
(.PRECIOUS): Add insn-attr-common.h.
(simple_rtl_generated_h): Add insn-attr-common.h.
(build/genattr-common.o): New.
(genprogrtl): Add attr-common.
* genattr.c (main): Include insn-attr-common.h. Don't generate
definitions of DELAY_SLOTS or INSN_SCHEDULING.
* opts.c: Include insn-attr-common.h instead of rtl.h and
insn-attr.h.
2011-06-28 Georg-Johann Lay <avr@gjlay.de>
* config.gcc (tm_file): Add elfos.h and avr/elf.h for

View File

@ -965,7 +965,7 @@ GCC_H = gcc.h version.h $(DIAGNOSTIC_CORE_H)
GGC_H = ggc.h gtype-desc.h statistics.h
GGC_INTERNAL_H = ggc-internal.h $(GGC_H)
TIMEVAR_H = timevar.h timevar.def
INSN_ATTR_H = insn-attr.h $(INSN_ADDR_H)
INSN_ATTR_H = insn-attr.h insn-attr-common.h $(INSN_ADDR_H)
INSN_ADDR_H = $(srcdir)/insn-addr.h vecprim.h
C_COMMON_H = c-family/c-common.h c-family/c-common.def \
$(SPLAY_TREE_H) $(CPPLIB_H) $(GGC_H) $(DIAGNOSTIC_CORE_H)
@ -1524,7 +1524,8 @@ BACKEND = main.o @TREEBROWSER@ libbackend.a libcommon-target.a libcommon.a \
MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \
insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
insn-attr.h insn-attrtab.c insn-opinit.c insn-preds.c insn-constants.h \
insn-attr.h insn-attr-common.h insn-attrtab.c insn-opinit.c \
insn-preds.c insn-constants.h \
tm-preds.h tm-constrs.h checksum-options \
tree-check.h min-insn-modes.c insn-modes.c insn-modes.h \
genrtl.h gt-*.h gtype-*.h gtype-desc.c gtyp-input.list \
@ -2848,8 +2849,8 @@ fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
diagnostic.o : diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
version.h $(INPUT_H) intl.h $(DIAGNOSTIC_H) diagnostic.def
opts.o : opts.c $(OPTS_H) $(OPTIONS_H) $(DIAGNOSTIC_CORE_H) $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(RTL_H) \
$(DIAGNOSTIC_H) $(INSN_ATTR_H) intl.h $(COMMON_TARGET_H) \
coretypes.h $(TM_H) \
$(DIAGNOSTIC_H) insn-attr-common.h intl.h $(COMMON_TARGET_H) \
$(FLAGS_H) $(PARAMS_H) opts-diagnostic.h
opts-global.o : opts-global.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(DIAGNOSTIC_H) $(OPTS_H) $(FLAGS_H) $(GGC_H) $(TREE_H) langhooks.h \
@ -3589,7 +3590,7 @@ mips-tdump.o : mips-tdump.c $(CONFIG_H) $(SYSTEM_H) \
.PRECIOUS: insn-config.h insn-flags.h insn-codes.h insn-constants.h \
insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
insn-attr.h insn-attrtab.c insn-preds.c
insn-attr.h insn-attr-common.h insn-attrtab.c insn-preds.c
# Dependencies for the md file. The first time through, we just assume
# the md file itself and the generated dependency file (in order to get
@ -3646,7 +3647,8 @@ insn-recog.o : insn-recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
# The "; @true" construct forces Make to recheck the timestamp on
# the target file.
simple_rtl_generated_h = insn-attr.h insn-codes.h insn-config.h insn-flags.h
simple_rtl_generated_h = insn-attr.h insn-attr-common.h insn-codes.h \
insn-config.h insn-flags.h
simple_rtl_generated_c = insn-attrtab.c insn-automata.c insn-emit.c \
insn-extract.c insn-opinit.c insn-output.c \
@ -3962,6 +3964,8 @@ 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 $(READ_MD_H) gensupport.h
build/genattr-common.o : genattr-common.c $(RTL_BASE_H) $(BCONFIG_H) \
$(SYSTEM_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) \
$(READ_MD_H) gensupport.h vecprim.h
@ -4021,7 +4025,7 @@ build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF) \
# even if GCC is being compiled to run on some other machine.
# All these programs use the RTL reader ($(BUILD_RTL)).
genprogrtl = attr attrtab automata codes conditions config emit \
genprogrtl = attr attr-common attrtab automata codes conditions config emit \
extract flags opinit output peep preds recog
$(genprogrtl:%=build/gen%$(build_exeext)): $(BUILD_RTL)

83
gcc/genattr-common.c Normal file
View File

@ -0,0 +1,83 @@
/* Generate attribute information shared between driver and core
compilers (insn-attr-common.h) from machine description. Split out
of genattr.c.
Copyright (C) 1991, 1994, 1996, 1998, 1999, 2000, 2003, 2004, 2007, 2008,
2010, 2011 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 "bconfig.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "errors.h"
#include "read-md.h"
#include "gensupport.h"
int
main (int argc, char **argv)
{
rtx desc;
bool have_delay = false;
bool have_sched = false;
progname = "genattr-common";
if (!init_rtx_reader_args (argc, argv))
return (FATAL_EXIT_CODE);
puts ("/* Generated automatically by the program `genattr-common'");
puts (" from the machine description file `md'. */\n");
puts ("#ifndef GCC_INSN_ATTR_COMMON_H");
puts ("#define GCC_INSN_ATTR_COMMON_H\n");
/* Read the machine description. */
while (1)
{
int line_no, insn_code_number;
desc = read_md_rtx (&line_no, &insn_code_number);
if (desc == NULL)
break;
if (GET_CODE (desc) == DEFINE_DELAY)
{
if (!have_delay)
{
printf ("#define DELAY_SLOTS\n");
have_delay = true;
}
}
else if (GET_CODE (desc) == DEFINE_INSN_RESERVATION)
{
if (!have_sched)
{
printf ("#define INSN_SCHEDULING\n");
have_sched = true;
}
}
}
puts ("\n#endif /* GCC_INSN_ATTR_COMMON_H */");
if (ferror (stdout) || fflush (stdout) || fclose (stdout))
return FATAL_EXIT_CODE;
return SUCCESS_EXIT_CODE;
}

View File

@ -1,6 +1,6 @@
/* Generate attribute information (insn-attr.h) from machine description.
Copyright (C) 1991, 1994, 1996, 1998, 1999, 2000, 2003, 2004, 2007, 2008,
2010 Free Software Foundation, Inc.
2010, 2011 Free Software Foundation, Inc.
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
This file is part of GCC.
@ -180,6 +180,8 @@ main (int argc, char **argv)
puts ("#ifndef GCC_INSN_ATTR_H");
puts ("#define GCC_INSN_ATTR_H\n");
puts ("#include \"insn-attr-common.h\"\n");
/* For compatibility, define the attribute `alternative', which is just
a reference to the variable `which_alternative'. */
@ -204,7 +206,6 @@ main (int argc, char **argv)
{
if (! have_delay)
{
printf ("#define DELAY_SLOTS\n");
printf ("extern int num_delay_slots (rtx);\n");
printf ("extern int eligible_for_delay (rtx, int, rtx, int);\n\n");
printf ("extern int const_num_delay_slots (rtx);\n\n");
@ -242,7 +243,6 @@ main (int argc, char **argv)
= find_tune_attr (XEXP (VEC_index (rtx, reservations, 0), 2));
/* Output interface for pipeline hazards recognition based on
DFA (deterministic finite state automata. */
printf ("\n#define INSN_SCHEDULING\n");
printf ("\n/* DFA based pipeline interface. */");
printf ("\n#ifndef AUTOMATON_ALTS\n");
printf ("#define AUTOMATON_ALTS 0\n");

View File

@ -23,17 +23,16 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "intl.h"
#include "coretypes.h"
#include "tm.h" /* Needed by rtl.h and used for STACK_CHECK_BUILTIN,
#include "tm.h" /* For STACK_CHECK_BUILTIN,
STACK_CHECK_STATIC_BUILTIN, DEFAULT_GDB_EXTENSIONS,
DWARF2_DEBUGGING_INFO and DBX_DEBUGGING_INFO. */
#include "rtl.h" /* Needed by insn-attr.h. */
#include "opts.h"
#include "options.h"
#include "flags.h"
#include "params.h"
#include "diagnostic.h"
#include "opts-diagnostic.h"
#include "insn-attr.h" /* For INSN_SCHEDULING and DELAY_SLOTS. */
#include "insn-attr-common.h"
#include "common/common-target.h"
/* Parse the -femit-struct-debug-detailed option value