public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@linaro.org>
To: Jeff Law <law@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: Reorganise machmode.h headers
Date: Wed, 24 May 2017 15:08:00 -0000	[thread overview]
Message-ID: <87zie2xq37.fsf@linaro.org> (raw)
In-Reply-To: <319770d3-c529-8f86-8cf8-f52b90dcfce0@redhat.com> (Jeff Law's	message of "Mon, 19 Dec 2016 16:30:04 -0700")

Jeff Law <law@redhat.com> writes:
> On 11/16/2016 09:32 AM, Richard Sandiford wrote:
>> Later patches will make machmode.h rely on wide-int.h and the
>> new poly-int.h, so it needs to appear later in the coretypes.h
>> include list.
>>
>> Previously machmode.h included insn-modes.h, which as well as
>> the main mode enum contains configuration information like
>> MAX_BITSIZE_MODE_ANY_INT.  This still needs to come first,
>> since files like wide-int.h depend on the configuration
>> information.
>>
>> Similarly, later patches will make the auto-generated inline
>> mode size functions use poly-int.h, so the patch splits them
>> out into their own header file and includes it after the
>> integer utilities.
>>
>> The patch also makes the generator files include machmode.h
>> via coretypes.h.  Previously they did it by more indirect means.
>>
>> Finally, the patch makes wide-int-print.h available via coretypes.h
>> too.  There didn't seem to be any reason to force only the print
>> routines to be included directly, and it would be painful to extend
>> that approach to the new polynomial integer classes.
>>
>> Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?
>>
>> Thanks,
>> Richard
>>
>>
>> [ This patch is part of the SVE series posted here:
>>   https://gcc.gnu.org/ml/gcc/2016-11/msg00030.html ]
>>
>> gcc/
>> 2016-11-16  Richard Sandiford  <richard.sandiford@arm.com>
>> 	    Alan Hayward  <alan.hayward@arm.com>
>> 	    David Sherwood  <david.sherwood@arm.com>
>>
>> 	* Makefile.in (MACHMODE_H): Remove insn-modes.h
>> 	(CORETYPES_H): New define.
>> 	(MOSTLYCLEANFILES): Add insn-modes-inline.h.
>> 	(insn-modes-inline.h, s-modes-inline-h): New rules.
>> 	(generated_files): Add insn-modes-inline.h.
>> 	(RTL_BASE_H, TREE_CORE_H): Use CORETYPES_H instead of coretypes.h.
>> 	(build/gensupport.o, build/print-rtl.o, build/read-md.o): Likewise.
>> 	(build/read-rtl.o, build/rtl.o, build/vec.o, build/hash-table.o)
>> 	(build/inchash.o, build/gencondmd.o, build/genattr.o): Likewise.
>> 	(build/genattr-common.o, build/genattrtab.o, build/genautomata.o)
>> 	(build/gencheck.o, build/gencodes.o, build/genconditions.o): Likewise.
>> 	(build/genconfig.o, build/genconstants.o, build/genemit.o): Likewise.
>> 	(build/genenums.o, build/genextract.o, build/genflags.o): Likewise.
>> 	(build/gentarget-def.o, build/genmddeps.o, build/genopinit.o)
>> 	(build/genoutput.o, build/genpeep.o, build/genpreds.o): Likewise.
>> 	(build/genrecog.o, build/genmddump.o, build/genmatch.o): Likewise.
>> 	(build/gencfn-macros.o, build/gcov-iov.o): Likewise.
>> 	* coretypes.h: Include everything up to real.h for generators.
>> 	Include insn-modes.h first.  Include wide-int-print.h after
>> 	wide-int.h.  Include insn-modes-inline.h and then machmode.h.
>> 	* machmode.h: Don't include insn-modes.h here.
>> 	* function-tests.c: Remove includes of signop.h, machmode.h,
>> 	double-int.h and wide-int.h.
>> 	* rtl.h: Likewise.
>> 	* gcc-rich-location.c: Remove includes of machmode.h, double-int.h
>> 	and wide-int.h.
>> 	* optc-save-gen.awk: Likewise.
>> 	* gencheck.c (BITS_PER_UNIT): Delete dummy definition.
>> 	* godump.c: Remove include of wide-int-print.h.
>> 	* pretty-print.h: Likewise.
>> 	* wide-int-print.cc: Likewise.
>> 	* wide-int.cc: Likewise.
>> 	* hash-map-tests.c: Remove include of signop.h.
>> 	* hash-set-tests.c: Likewise.
>> 	* rtl-tests.c: Likewise.
>> 	* mkconfig.sh: Remove include of machmode.h.
>> 	* genmodes.c (emit_insn_modes_h): Split emission of inline functions
>> 	into...
>> 	(emit_insn_modes_inline_h): ...this new function.  Emit the code
>> 	into an insn-modes-inline.h header file, adding appropriate
>> 	include guards and end comments.
>> 	(emit_insn_modes_c_header): Remove include of machmode.h.
>> 	(emit_min_insn_modes_c_header): Include coretypes.h rather than
>> 	machmode.h.
>> 	(main): Handle -i flag and call emit_insn_modes_inline_h when
>> 	it is passed.
> So I don't see anything here particularly problematical.  My question is 
> whether or not there's anything significant to be gained to moving 
> forward with this kit, assuming the 67 piece kit is not likely to move 
> forward.
>
> I do think you'll need some tweaks to the contrib/header-tools which 
> know about the core headers and dependencies.  Hopefully what's in there 
> is easy enough to figure out how to twiddle appropriately.

OK, thanks for the pointer.  I think this patch should do that.

gcc-order-headers seems to have bitrotted a bit, since it gives:

Traceback (most recent call last):
  File "../contrib/header-tools/gcc-order-headers", line 267, in <module>
    process_known_dups ()
  File "../contrib/header-tools/gcc-order-headers", line 101, in process_known_dups
    if dups[i] and "rtl.h" in dups[i]:
KeyError: 'dumpfile.h'

But the change itself looks obvious.

Tested on aarch64-linux-gnu and x86_64-linux-gnu.  Also tested by
compiling one target for each cpu directory.  OK to install?

Thanks,
Richard


[Based on the code ARM contributed in branches/ARM/sve-branch@242100]

2016-11-16  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

contrib/header-tools/
	* graph-header-logs (ignore): Update coretypes.h header list.

gcc/
	* Makefile.in (MACHMODE_H): Remove insn-modes.h
	(CORETYPES_H): New define.
	(MOSTLYCLEANFILES): Add insn-modes-inline.h.
	(insn-modes-inline.h, s-modes-inline-h): New rules.
	(generated_files): Add insn-modes-inline.h.
	(RTL_BASE_H, TREE_CORE_H): Use CORETYPES_H instead of coretypes.h.
	(build/gensupport.o, build/ggc-none.o, build/print-rtl.o): Likewise.
	(build/read-md.o, build/read-rtl.o, build/rtl.o): Likewise.
	(build/vec.o, build/hash-table.o, build/inchash.o): Likewise.
	(build/gencondmd.o, build/genattr.o, build/genattr-common.o): Likewise.
	(build/genattrtab.o, build/genautomata.o, build/gencheck.o): Likewise.
	(build/gencodes.o, build/genconditions.o): Likewise.
	(build/genconfig.o, build/genconstants.o, build/genemit.o): Likewise.
	(build/genenums.o, build/genextract.o, build/genflags.o): Likewise.
	(build/gentarget-def.o, build/genmddeps.o, build/genopinit.o)
	(build/genoutput.o, build/genpeep.o, build/genpreds.o): Likewise.
	(build/genrecog.o, build/genmddump.o, build/genmatch.o): Likewise.
	(build/gencfn-macros.o, build/gcov-iov.o): Likewise.
	* coretypes.h: Include everything up to real.h for generators.
	Include insn-modes.h first.  Include wide-int-print.h after
	wide-int.h.  Include insn-modes-inline.h and then machmode.h.
	* machmode.h: Don't include insn-modes.h here.
	* function-tests.c: Remove includes of signop.h, machmode.h,
	double-int.h and wide-int.h.
	* rtl.h: Likewise.
	* gcc-rich-location.c: Remove includes of machmode.h, double-int.h
	and wide-int.h.
	* optc-save-gen.awk: Likewise.
	* gencheck.c (BITS_PER_UNIT): Delete dummy definition.
	* godump.c: Remove include of wide-int-print.h.
	* pretty-print.h: Likewise.
	* wide-int-print.cc: Likewise.
	* wide-int.cc: Likewise.
	* hash-map-tests.c: Remove include of signop.h.
	* hash-set-tests.c: Likewise.
	* rtl-tests.c: Likewise.
	* mkconfig.sh: Remove include of machmode.h.
	* genmodes.c (emit_insn_modes_h): Split emission of inline functions
	into...
	(emit_insn_modes_inline_h): ...this new function.  Emit the code
	into an insn-modes-inline.h header file, adding appropriate
	include guards and end comments.
	(emit_insn_modes_c_header): Remove include of machmode.h.
	(emit_min_insn_modes_c_header): Include coretypes.h rather than
	machmode.h.
	(main): Handle -i flag and call emit_insn_modes_inline_h when
	it is passed.

Index: contrib/header-tools/graph-header-logs
===================================================================
--- contrib/header-tools/graph-header-logs	2015-11-11 15:40:07.000000000 +0000
+++ contrib/header-tools/graph-header-logs	2017-05-24 14:37:44.737223605 +0100
@@ -25,9 +25,12 @@ depstring = ("In file included from", "
 
 # indentation indicates nesting levels of included files
 ignore = [ "coretypes_h",
-             "machmode_h",
+             "insn_modes_h",
              "signop_h",
              "wide_int_h",
+             "wide_int_print_h",
+             "insn_modes_inline_h",
+             "machmode_h",
              "double_int_h",
              "real_h",
              "fixed_value_h",
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	2017-05-23 19:29:59.645724759 +0100
+++ gcc/Makefile.in	2017-05-24 14:37:44.737223605 +0100
@@ -900,14 +900,15 @@ COMMON_TARGET_DEF = common/common-target
 TARGET_H = $(TM_H) target.h $(TARGET_DEF) insn-modes.h insn-codes.h
 C_TARGET_H = c-family/c-target.h $(C_TARGET_DEF)
 COMMON_TARGET_H = common/common-target.h $(INPUT_H) $(COMMON_TARGET_DEF)
-MACHMODE_H = machmode.h mode-classes.def insn-modes.h
+MACHMODE_H = machmode.h mode-classes.def
 HOOKS_H = hooks.h $(MACHMODE_H)
 HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H)
 LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H)
 TARGET_DEF_H = target-def.h target-hooks-def.h $(HOOKS_H) targhooks.h
 C_TARGET_DEF_H = c-family/c-target-def.h c-family/c-target-hooks-def.h \
   $(TREE_H) $(C_COMMON_H) $(HOOKS_H) common/common-targhooks.h
-RTL_BASE_H = coretypes.h rtl.h rtl.def $(MACHMODE_H) reg-notes.def \
+CORETYPES_H = coretypes.h insn-modes.h insn-modes-inline.h
+RTL_BASE_H = $(CORETYPES_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 $(HASHTAB_H)
 FIXED_VALUE_H = fixed-value.h $(MACHMODE_H) double-int.h
@@ -919,7 +920,7 @@ BUILTINS_DEF = builtins.def sync-builtin
 	hsa-builtins.def
 INTERNAL_FN_DEF = internal-fn.def
 INTERNAL_FN_H = internal-fn.h $(INTERNAL_FN_DEF)
-TREE_CORE_H = tree-core.h coretypes.h all-tree.def tree.def \
+TREE_CORE_H = tree-core.h $(CORETYPES_H) all-tree.def tree.def \
 	c-family/c-common.def $(lang_tree_files) $(MACHMODE_H) \
 	$(BUILTINS_DEF) $(INPUT_H) statistics.h \
 	$(VEC_H) treestruct.def $(HASHTAB_H) \
@@ -1631,7 +1632,7 @@ MOSTLYCLEANFILES = insn-flags.h insn-con
  insn-attr.h insn-attr-common.h insn-attrtab.c insn-dfatab.c \
  insn-latencytab.c insn-opinit.c insn-opinit.h insn-preds.c insn-constants.h \
  tm-preds.h tm-constrs.h checksum-options gimple-match.c generic-match.c \
- tree-check.h min-insn-modes.c insn-modes.c insn-modes.h \
+ tree-check.h min-insn-modes.c insn-modes.c insn-modes.h insn-modes-inline.h \
  genrtl.h gt-*.h gtype-*.h gtype-desc.c gtyp-input.list \
  case-cfn-macros.h cfn-operators.pd \
  xgcc$(exeext) cpp$(exeext) $(FULL_DRIVER_NAME) \
@@ -2317,6 +2318,7 @@ s-genrtl-h: build/gengenrtl$(build_exeex
 
 insn-modes.c: s-modes; @true
 insn-modes.h: s-modes-h; @true
+insn-modes-inline.h: s-modes-inline-h; @true
 min-insn-modes.c: s-modes-m; @true
 
 s-modes: build/genmodes$(build_exeext)
@@ -2329,6 +2331,12 @@ s-modes-h: build/genmodes$(build_exeext)
 	$(SHELL) $(srcdir)/../move-if-change tmp-modes.h insn-modes.h
 	$(STAMP) s-modes-h
 
+s-modes-inline-h: build/genmodes$(build_exeext)
+	$(RUN_GEN) build/genmodes$(build_exeext) -i > tmp-modes-inline.h
+	$(SHELL) $(srcdir)/../move-if-change tmp-modes-inline.h \
+	  insn-modes-inline.h
+	$(STAMP) s-modes-inline-h
+
 s-modes-m: build/genmodes$(build_exeext)
 	$(RUN_GEN) build/genmodes$(build_exeext) -m > tmp-min-modes.c
 	$(SHELL) $(srcdir)/../move-if-change tmp-min-modes.c min-insn-modes.c
@@ -2565,7 +2573,8 @@ s-gtype: build/gengtype$(build_exeext) $
 
 generated_files = config.h tm.h $(TM_P_H) $(TM_H) multilib.h \
        $(simple_generated_h) specs.h \
-       tree-check.h genrtl.h insn-modes.h tm-preds.h tm-constrs.h \
+       tree-check.h genrtl.h insn-modes.h insn-modes-inline.h \
+       tm-preds.h tm-constrs.h \
        $(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gcov-iov.h \
        options.h target-hooks-def.h insn-opinit.h \
        common/common-target-hooks-def.h pass-instances.def \
@@ -2592,30 +2601,30 @@ build/version.o:  version.c version.h \
 # Header dependencies for the programs that generate source code.
 # These are library modules...
 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)		\
-  $(READ_MD_H) $(GENSUPPORT_H)
-build/ggc-none.o : ggc-none.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h 	\
+build/gensupport.o: gensupport.c $(BCONFIG_H) $(SYSTEM_H) 		\
+  $(CORETYPES_H) $(GTM_H) $(RTL_BASE_H) $(OBSTACK_H) errors.h		\
+  $(HASHTAB_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	\
+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		\
+build/read-md.o: read-md.c $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H)	\
   $(HASHTAB_H) errors.h $(READ_MD_H)
-build/read-rtl.o: read-rtl.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h	\
+build/read-rtl.o: read-rtl.c $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_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)	\
+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)	\
-   $(GGC_H) toplev.h $(DIAGNOSTIC_CORE_H)
-build/hash-table.o : hash-table.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h  \
-   $(HASH_TABLE_H) $(GGC_H) toplev.h $(DIAGNOSTIC_CORE_H)
-build/inchash.o : inchash.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h  \
-   $(HASHTAB_H) inchash.h
+build/vec.o : vec.c $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H) $(VEC_H)	\
+  $(GGC_H) toplev.h $(DIAGNOSTIC_CORE_H)
+build/hash-table.o : hash-table.c $(BCONFIG_H) $(SYSTEM_H)		\
+  $(CORETYPES_H) $(HASH_TABLE_H) $(GGC_H) toplev.h $(DIAGNOSTIC_CORE_H)
+build/inchash.o : inchash.c $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H)	\
+  $(HASHTAB_H) inchash.h
 build/gencondmd.o : build/gencondmd.c $(BCONFIG_H) $(SYSTEM_H)		\
-  coretypes.h $(GTM_H) insn-constants.h					\
+  $(CORETYPES_H) $(GTM_H) insn-constants.h				\
   $(filter-out insn-flags.h, $(RTL_H) $(TM_P_H) $(FUNCTION_H) $(REGS_H) \
   $(RECOG_H) output.h $(FLAGS_H) $(RESOURCE_H) toplev.h $(DIAGNOSTIC_CORE_H) reload.h 	\
   $(EXCEPT_H) tm-constrs.h)
@@ -2627,39 +2636,39 @@ 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)
+  $(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)
+  $(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)	\
+  $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H) $(GTM_H) errors.h $(GGC_H)	\
   $(READ_MD_H) $(GENSUPPORT_H) $(FNMATCH_H)
 build/genautomata.o : genautomata.c $(RTL_BASE_H) $(OBSTACK_H)		\
-  $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(VEC_H)	\
+  $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H) $(GTM_H) errors.h $(VEC_H)	\
   $(HASHTAB_H) $(GENSUPPORT_H) $(FNMATCH_H)
 build/gencheck.o : gencheck.c all-tree.def $(BCONFIG_H) $(GTM_H)	\
-	$(SYSTEM_H) coretypes.h tree.def c-family/c-common.def		\
+	$(SYSTEM_H) $(CORETYPES_H) tree.def c-family/c-common.def	\
 	$(lang_tree_files) gimple.def
 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)
+  $(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 $(HASHTAB_H) $(READ_MD_H)	\
-  $(GENSUPPORT_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)
+  $(CORETYPES_H) $(GTM_H) errors.h $(GENSUPPORT_H)
 build/genconstants.o : genconstants.c $(BCONFIG_H) $(SYSTEM_H)		\
-  coretypes.h errors.h $(READ_MD_H)
+  $(CORETYPES_H) errors.h $(READ_MD_H)
 build/genemit.o : genemit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
-  coretypes.h $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H) internal-fn.def
+  $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H) internal-fn.def
 build/genenums.o : genenums.c $(BCONFIG_H) $(SYSTEM_H)			\
-  coretypes.h errors.h $(READ_MD_H)
+  $(CORETYPES_H) errors.h $(READ_MD_H)
 build/genextract.o : genextract.c $(RTL_BASE_H) $(BCONFIG_H)		\
-  $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
+  $(SYSTEM_H) $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
 build/genflags.o : genflags.c $(RTL_BASE_H) $(OBSTACK_H) $(BCONFIG_H)	\
-  $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
+  $(SYSTEM_H) $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
 build/gentarget-def.o : gentarget-def.c $(BCONFIG_H) $(SYSTEM_H)	\
-  coretypes.h $(GTM_H) $(RTL_BASE_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)	\
-  $(HASH_TABLE_H) target-insns.def
+  $(CORETYPES_H) $(GTM_H) $(RTL_BASE_H) errors.h $(READ_MD_H)		\
+  $(GENSUPPORT_H) $(HASH_TABLE_H) target-insns.def
 build/gengenrtl.o : gengenrtl.c $(BCONFIG_H) $(SYSTEM_H) rtl.def
 
 # The gengtype generator program is special: Two versions are built.
@@ -2695,30 +2704,32 @@ build/gengtype.o: $(BCONFIG_H)
 
 CFLAGS-errors.o += -DHOST_GENERATOR_FILE
 
-build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h	\
+build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H)	\
   errors.h $(READ_MD_H)
 build/genmodes.o : genmodes.c $(BCONFIG_H) $(SYSTEM_H) errors.h		\
   $(HASHTAB_H) machmode.def $(extra_modes_file)
 build/genopinit.o : genopinit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
-  coretypes.h $(GTM_H) errors.h $(GENSUPPORT_H) optabs.def
+  $(CORETYPES_H) $(GTM_H) errors.h $(GENSUPPORT_H) optabs.def
 build/genoutput.o : genoutput.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
-  coretypes.h $(GTM_H) errors.h $(READ_MD_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 $(DIAGNOSTIC_CORE_H)
+  $(CORETYPES_H) $(GTM_H) errors.h $(GENSUPPORT_H) toplev.h		\
+  $(DIAGNOSTIC_CORE_H)
 build/genpreds.o : genpreds.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
-  coretypes.h $(GTM_H) errors.h $(READ_MD_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 $(READ_MD_H) $(GENSUPPORT_H)		\
+  $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)		\
   $(HASH_TABLE_H) inchash.h
 build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF)		\
   $(COMMON_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h
 build/genmddump.o : genmddump.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)	\
-  coretypes.h $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
+  $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H)
 build/genmatch.o : genmatch.c $(BCONFIG_H) $(SYSTEM_H) \
-  coretypes.h errors.h $(HASH_TABLE_H) hash-map.h $(GGC_H) is-a.h \
+  $(CORETYPES_H) errors.h $(HASH_TABLE_H) hash-map.h $(GGC_H) is-a.h \
   tree.def builtins.def internal-fn.def
 build/gencfn-macros.o : gencfn-macros.c $(BCONFIG_H) $(SYSTEM_H)	\
-  coretypes.h errors.h $(HASH_TABLE_H) hash-set.h builtins.def internal-fn.def
+  $(CORETYPES_H) errors.h $(HASH_TABLE_H) hash-set.h builtins.def	\
+  internal-fn.def
 
 # Compile the programs that generate insn-* from the machine description.
 # They are compiled with $(COMPILER_FOR_BUILD), and associated libraries,
@@ -2816,8 +2827,8 @@ CFLAGS-cppdefault.o += $(PREPROCESSOR_DE
 # having an empty command (nothing following the semicolon).
 
 # gcov-iov.c is run on the build machine to generate gcov-iov.h from version.c
-build/gcov-iov.o: gcov-iov.c $(BCONFIG_H) coretypes.h $(GTM_H) \
-  $(SYSTEM_H) coretypes.h $(TM_H)
+build/gcov-iov.o: gcov-iov.c $(BCONFIG_H) $(CORETYPES_H) $(GTM_H) \
+  $(SYSTEM_H) $(CORETYPES_H) $(TM_H)
 
 build/gcov-iov$(build_exeext): build/gcov-iov.o
 	+$(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) \
Index: gcc/coretypes.h
===================================================================
--- gcc/coretypes.h	2017-05-18 07:51:11.876801735 +0100
+++ gcc/coretypes.h	2017-05-24 14:37:44.737223605 +0100
@@ -358,12 +358,17 @@ typedef void (*gt_pointer_operator) (voi
 typedef unsigned char uchar;
 #endif
 
-/* Most host source files will require the following headers.  */
-#if !defined (GENERATOR_FILE) && !defined (USED_FOR_TARGET)
-#include "machmode.h"
+/* Most source files will require the following headers.  */
+#if !defined (USED_FOR_TARGET)
+#include "insn-modes.h"
 #include "signop.h"
 #include "wide-int.h" 
+#include "wide-int-print.h"
+#include "insn-modes-inline.h"
+#include "machmode.h"
 #include "double-int.h"
+/* Most host source files will require the following headers.  */
+#if !defined (GENERATOR_FILE)
 #include "real.h"
 #include "fixed-value.h"
 #include "hash-table.h"
@@ -372,6 +377,7 @@ typedef unsigned char uchar;
 #include "is-a.h"
 #include "memory-block.h"
 #include "dumpfile.h"
+#endif
 #endif /* GENERATOR_FILE && !USED_FOR_TARGET */
 
 #endif /* coretypes.h */
Index: gcc/machmode.h
===================================================================
--- gcc/machmode.h	2017-02-23 19:54:03.000000000 +0000
+++ gcc/machmode.h	2017-05-24 14:37:44.739230513 +0100
@@ -20,9 +20,6 @@ Software Foundation; either version 3, o
 #ifndef HAVE_MACHINE_MODES
 #define HAVE_MACHINE_MODES
 
-/* Make an enum class that gives all the machine modes.  */
-#include "insn-modes.h"
-
 /* Get the name of mode MODE as a string.  */
 
 extern const char * const mode_name[NUM_MACHINE_MODES];
Index: gcc/function-tests.c
===================================================================
--- gcc/function-tests.c	2017-02-23 19:54:03.000000000 +0000
+++ gcc/function-tests.c	2017-05-24 14:37:44.738227059 +0100
@@ -22,7 +22,6 @@ Software Foundation; either version 3, o
 #include "coretypes.h"
 #include "tm.h"
 #include "opts.h"
-#include "signop.h"
 #include "hash-set.h"
 #include "fixed-value.h"
 #include "alias.h"
@@ -38,7 +37,6 @@ Software Foundation; either version 3, o
 #include "vec.h"
 #include "hashtab.h"
 #include "hash-set.h"
-#include "machmode.h"
 #include "hard-reg-set.h"
 #include "input.h"
 #include "function.h"
@@ -56,10 +54,8 @@ Software Foundation; either version 3, o
 #include "gimplify.h"
 #include "tree-cfg.h"
 #include "basic-block.h"
-#include "double-int.h"
 #include "alias.h"
 #include "symtab.h"
-#include "wide-int.h"
 #include "inchash.h"
 #include "tree.h"
 #include "fold-const.h"
Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h	2017-03-28 16:19:28.000000000 +0100
+++ gcc/rtl.h	2017-05-24 14:37:44.739230513 +0100
@@ -24,10 +24,6 @@ #define GCC_RTL_H
    machmode.h and other files to exist and would not normally have been
    included by coretypes.h.  */
 #ifdef GENERATOR_FILE
-#include "machmode.h"     
-#include "signop.h"
-#include "wide-int.h"
-#include "double-int.h"
 #include "real.h"
 #include "fixed-value.h"
 #include "statistics.h"
Index: gcc/gcc-rich-location.c
===================================================================
--- gcc/gcc-rich-location.c	2017-02-23 19:54:12.000000000 +0000
+++ gcc/gcc-rich-location.c	2017-05-24 14:37:44.738227059 +0100
@@ -23,13 +23,10 @@ Software Foundation; either version 3, o
 #include "tm.h"
 #include "rtl.h"
 #include "hash-set.h"
-#include "machmode.h"
 #include "vec.h"
-#include "double-int.h"
 #include "input.h"
 #include "alias.h"
 #include "symtab.h"
-#include "wide-int.h"
 #include "inchash.h"
 #include "tree-core.h"
 #include "tree.h"
Index: gcc/optc-save-gen.awk
===================================================================
--- gcc/optc-save-gen.awk	2017-02-23 19:54:15.000000000 +0000
+++ gcc/optc-save-gen.awk	2017-05-24 14:37:44.739230513 +0100
@@ -41,13 +41,10 @@ print "#include " quote "flags.h" quote
 print "#include " quote "target.h" quote
 print "#include " quote "inchash.h" quote
 print "#include " quote "hash-set.h" quote
-print "#include " quote "machmode.h" quote
 print "#include " quote "vec.h" quote
-print "#include " quote "double-int.h" quote
 print "#include " quote "input.h" quote
 print "#include " quote "alias.h" quote
 print "#include " quote "symtab.h" quote
-print "#include " quote "wide-int.h" quote
 print "#include " quote "inchash.h" quote
 print "#include " quote "tree.h" quote
 print "#include " quote "fold-const.h" quote
Index: gcc/gencheck.c
===================================================================
--- gcc/gencheck.c	2017-02-23 19:54:03.000000000 +0000
+++ gcc/gencheck.c	2017-05-24 14:37:44.738227059 +0100
@@ -17,9 +17,6 @@ Software Foundation; either version 3, o
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-/* We don't have insn-modes.h, but we include tm.h.  */
-#define BITS_PER_UNIT 8
-
 #include "bconfig.h"
 #include "system.h"
 #include "coretypes.h"
Index: gcc/godump.c
===================================================================
--- gcc/godump.c	2017-02-23 19:54:03.000000000 +0000
+++ gcc/godump.c	2017-05-24 14:37:44.738227059 +0100
@@ -31,7 +31,6 @@ Software Foundation; either version 3, o
 #include "system.h"
 #include "coretypes.h"
 #include "tree.h"
-#include "wide-int-print.h"
 #include "diagnostic-core.h"
 #include "debug.h"
 #include "stor-layout.h"
Index: gcc/pretty-print.h
===================================================================
--- gcc/pretty-print.h	2017-02-23 19:54:04.000000000 +0000
+++ gcc/pretty-print.h	2017-05-24 14:37:44.739230513 +0100
@@ -22,7 +22,6 @@ Software Foundation; either version 3, o
 #define GCC_PRETTY_PRINT_H
 
 #include "obstack.h"
-#include "wide-int-print.h"
 
 /* Maximum number of format string arguments.  */
 #define PP_NL_ARGMAX   30
Index: gcc/wide-int-print.cc
===================================================================
--- gcc/wide-int-print.cc	2017-02-23 19:54:03.000000000 +0000
+++ gcc/wide-int-print.cc	2017-05-24 14:37:44.740233967 +0100
@@ -21,7 +21,6 @@ along with GCC; see the file COPYING3.
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "wide-int-print.h"
 
 /*
  * public printing routines.
Index: gcc/wide-int.cc
===================================================================
--- gcc/wide-int.cc	2017-02-23 19:54:04.000000000 +0000
+++ gcc/wide-int.cc	2017-05-24 14:37:44.740233967 +0100
@@ -24,7 +24,6 @@ along with GCC; see the file COPYING3.
 #include "tm.h"
 #include "tree.h"
 #include "selftest.h"
-#include "wide-int-print.h"
 
 
 #define HOST_BITS_PER_HALF_WIDE_INT 32
Index: gcc/hash-map-tests.c
===================================================================
--- gcc/hash-map-tests.c	2017-02-23 19:54:12.000000000 +0000
+++ gcc/hash-map-tests.c	2017-05-24 14:37:44.738227059 +0100
@@ -22,7 +22,6 @@ Software Foundation; either version 3, o
 #include "coretypes.h"
 #include "tm.h"
 #include "opts.h"
-#include "signop.h"
 #include "hash-set.h"
 #include "fixed-value.h"
 #include "alias.h"
Index: gcc/hash-set-tests.c
===================================================================
--- gcc/hash-set-tests.c	2017-02-23 19:54:15.000000000 +0000
+++ gcc/hash-set-tests.c	2017-05-24 14:37:44.739230513 +0100
@@ -22,7 +22,6 @@ Software Foundation; either version 3, o
 #include "coretypes.h"
 #include "tm.h"
 #include "opts.h"
-#include "signop.h"
 #include "hash-set.h"
 #include "selftest.h"
 
Index: gcc/rtl-tests.c
===================================================================
--- gcc/rtl-tests.c	2017-02-23 19:54:15.000000000 +0000
+++ gcc/rtl-tests.c	2017-05-24 14:37:44.739230513 +0100
@@ -22,7 +22,6 @@ Software Foundation; either version 3, o
 #include "coretypes.h"
 #include "tm.h"
 #include "opts.h"
-#include "signop.h"
 #include "hash-set.h"
 #include "fixed-value.h"
 #include "alias.h"
Index: gcc/mkconfig.sh
===================================================================
--- gcc/mkconfig.sh	2017-02-23 19:54:03.000000000 +0000
+++ gcc/mkconfig.sh	2017-05-24 14:37:44.739230513 +0100
@@ -100,9 +100,6 @@ case $output in
 #if defined IN_GCC && !defined GENERATOR_FILE
 # include "insn-modes.h"
 #endif
-#if defined IN_GCC && defined GENERATOR_FILE && !defined BITS_PER_UNIT
-#include "machmode.h"
-#endif
 EOF
     ;;
 esac
Index: gcc/genmodes.c
===================================================================
--- gcc/genmodes.c	2017-03-28 16:19:28.000000000 +0100
+++ gcc/genmodes.c	2017-05-24 14:37:44.738227059 +0100
@@ -1204,6 +1204,24 @@ enum machine_mode\n{");
 
   printf ("#define NUM_INT_N_ENTS %d\n", n_int_n_ents);
 
+  puts ("\
+\n\
+#endif /* insn-modes.h */");
+}
+
+static void
+emit_insn_modes_inline_h (void)
+{
+  printf ("/* Generated automatically from machmode.def%s%s\n",
+	   HAVE_EXTRA_MODES ? " and " : "",
+	   EXTRA_MODES_FILE);
+
+  puts ("\
+   by genmodes.  */\n\
+\n\
+#ifndef GCC_INSN_MODES_INLINE_H\n\
+#define GCC_INSN_MODES_INLINE_H");
+
   puts ("\n#if !defined (USED_FOR_TARGET) && GCC_VERSION >= 4001\n");
   emit_mode_size_inline ();
   emit_mode_nunits_inline ();
@@ -1214,7 +1232,7 @@ enum machine_mode\n{");
 
   puts ("\
 \n\
-#endif /* insn-modes.h */");
+#endif /* insn-modes-inline.h */");
 }
 
 static void
@@ -1231,7 +1249,6 @@ emit_insn_modes_c_header (void)
 #include \"system.h\"\n\
 #include \"coretypes.h\"\n\
 #include \"tm.h\"\n\
-#include \"machmode.h\"\n\
 #include \"real.h\"");
 }
 
@@ -1247,7 +1264,7 @@ emit_min_insn_modes_c_header (void)
 \n\
 #include \"bconfig.h\"\n\
 #include \"system.h\"\n\
-#include \"machmode.h\"");
+#include \"coretypes.h\"");
 }
 
 static void
@@ -1799,18 +1816,20 @@ emit_min_insn_modes_c (void)
 int
 main (int argc, char **argv)
 {
-  bool gen_header = false, gen_min = false;
+  bool gen_header = false, gen_inlines = false, gen_min = false;
   progname = argv[0];
 
   if (argc == 1)
     ;
   else if (argc == 2 && !strcmp (argv[1], "-h"))
     gen_header = true;
+  else if (argc == 2 && !strcmp (argv[1], "-i"))
+    gen_inlines = true;
   else if (argc == 2 && !strcmp (argv[1], "-m"))
     gen_min = true;
   else
     {
-      error ("usage: %s [-h|-m] > file", progname);
+      error ("usage: %s [-h|-i|-m] > file", progname);
       return FATAL_EXIT_CODE;
     }
 
@@ -1826,6 +1845,8 @@ main (int argc, char **argv)
 
   if (gen_header)
     emit_insn_modes_h ();
+  else if (gen_inlines)
+    emit_insn_modes_inline_h ();
   else if (gen_min)
     emit_min_insn_modes_c ();
   else

  parent reply	other threads:[~2017-05-24 14:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-16 16:32 Richard Sandiford
2016-12-20  0:43 ` Jeff Law
2016-12-22 16:19   ` Richard Sandiford
2017-05-24 15:08   ` Richard Sandiford [this message]
2017-06-12  6:37     ` Richard Sandiford
2017-06-22 11:34       ` Richard Sandiford
2017-06-29 22:39     ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zie2xq37.fsf@linaro.org \
    --to=richard.sandiford@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).