On 06/02/2015 09:30 AM, Richard Biener wrote:
On Tue, Jun 2, 2015 at 2:34 PM, Andrew MacLeod <amacl...@redhat.com> wrote:
On 06/02/2015 04:26 AM, Richard Biener wrote:
On Mon, Jun 1, 2015 at 11:02 PM, Andrew MacLeod <amacl...@redhat.com>
wrote:

Bootstraps from scratch on x86_64-unknown-linux-gnu with no new test
regressions.  I also built it on all the config-list.mk targets with no
additional compilation errors.

OK for trunk?
Generally the idea is sound (amend coretypes.h), but I don't like the
GCC_CONFIG_H guard, why does !GENERATOR_FILE not work?
Target files also use coretypes.h. In particular, libgcc includes it and
does not have GENERATOR_FILE set.  Rather than checking for GCC_CONFIG_H we
could check

#if !defined (GENERATOR_FILE) && !defined (USED_FOR_TARGET)

I think that should work OK.
Furthermore I don't like the special-casing in rtl.h, instead have
coretypes.h contain sth like

#ifdef GENERATOR_FILE
... rtl.h special-case
#else
... GCC_CONFIG_H stuff
#endif

Thanks,
Richard.

This one is harder. I don't like the special case either, but you cant
really figure it out in coretypes.h.  The problem comes from some generator
files which compile rtl.c and and a couple of other files, and thus have
GENERATOR_FILE set... These run after the initial set of generators so
insn-modes.h and friends have been created, and these includes are now
required.   the presence of rtl.h seems to be the the litmus test and if it
occurs in the include chain after coretypes.h, then we'll need these files.

I suppose you could just include those files in rtl.h directly without the
guard...  it is probably the cleanest solution. Otherwise we'd either have
to add a new identifying macro to a dozen generator files, or include these
headers there, or some other such thing.
Well, then include the requirements in the generator files instead?  It looks
backwards to add to the includes in rtl.h.

Richard.
Except that it is rtl.h that actually has the compilation requirement. I could put those includes in each of the generator files which require it, but the list is non-trivial: Each of these files can be compiled with bconfig.h instead of config.h, and they each include rtl.h which requires these headers:
genattr.c
genattr-common.c
genattrtab.c
genautomata.c
gencodes.c
genconditions.c
genconfig.c
genemit.c
genextract.c
genflags.c
genmddump.c
genopinit.c
genoutput.c
genpeep.c
genpreds.c
genrecog.c
gensupport.c
print-rtl.c
read-rtl.c
rtl.c


so there are 20 files which require these headers, and there are 11 others which do not require rtl.h nor the headers (and will fail compile if they are included)
gencheck.c
genconstants.c
genenums.c
genmatch.c
genmddeps.c
genmodes.c
ggc-none.c
hash-table.c
inchash.c
read-md.c
vec.c


I suppose one could add something like:
#define EARLY_GENERATOR
in each of the 11 and check for that macro in coretypes.h instead of GENERATOR file. ThIs appears to work fine:

Andrew


diff -cpN /numerical/coretypes.h /CMP/coretypes.h
*** /numerical/coretypes.h	2015-06-01 18:00:36.284376498 -0400
--- /CMP/coretypes.h	2015-06-02 10:15:12.427363555 -0400
*************** typedef unsigned char uchar;
*** 300,306 ****
  #endif
  
  /* Most host source files will require the following headers.  */
! #ifdef GCC_CONFIG_H
  #include "machmode.h"
  #include "signop.h"
  #include "wide-int.h" 
--- 300,306 ----
  #endif
  
  /* Most host source files will require the following headers.  */
! #if !defined (EARLY_GENERATOR_FILE) && !defined (USED_FOR_TARGET)
  #include "machmode.h"
  #include "signop.h"
  #include "wide-int.h" 
diff -cpN /numerical/gencheck.c /CMP/gencheck.c
*** /numerical/gencheck.c	2015-06-01 18:00:36.290376342 -0400
--- /CMP/gencheck.c	2015-06-02 10:15:12.434363374 -0400
*************** along with GCC; see the file COPYING3.
*** 20,25 ****
--- 20,26 ----
  /* We don't have insn-modes.h, but we include tm.h.  */
  #define BITS_PER_UNIT 8
  
+ #define EARLY_GENERATOR_FILE
  #include "bconfig.h"
  #include "system.h"
  #include "coretypes.h"
diff -cpN /numerical/genconstants.c /CMP/genconstants.c
*** /numerical/genconstants.c	2015-06-01 18:00:36.290376342 -0400
--- /CMP/genconstants.c	2015-06-02 10:15:12.435363348 -0400
*************** along with GCC; see the file COPYING3.
*** 24,29 ****
--- 24,30 ----
     look at insn patterns, only (define_constants), and we want to
     minimize dependencies.  */
  
+ #define EARLY_GENERATOR_FILE
  #include "bconfig.h"
  #include "system.h"
  #include "coretypes.h"
diff -cpN /numerical/genenums.c /CMP/genenums.c
*** /numerical/genenums.c	2015-06-01 18:00:36.290376342 -0400
--- /CMP/genenums.c	2015-06-02 10:15:12.435363348 -0400
*************** You should have received a copy of the G
*** 17,22 ****
--- 17,23 ----
  along with GCC; see the file COPYING3.  If not see
  <http://www.gnu.org/licenses/>.  */
  
+ #define EARLY_GENERATOR_FILE
  #include "bconfig.h"
  #include "system.h"
  #include "coretypes.h"
diff -cpN /numerical/genmatch.c /CMP/genmatch.c
*** /numerical/genmatch.c	2015-06-01 18:00:36.291376316 -0400
--- /CMP/genmatch.c	2015-06-02 10:15:12.435363348 -0400
*************** You should have received a copy of the G
*** 21,26 ****
--- 21,27 ----
  along with GCC; see the file COPYING3.  If not see
  <http://www.gnu.org/licenses/>.  */
  
+ #define EARLY_GENERATOR_FILE
  #include "bconfig.h"
  #include <new>
  #include "system.h"
diff -cpN /numerical/genmddeps.c /CMP/genmddeps.c
*** /numerical/genmddeps.c	2015-06-01 18:00:36.291376316 -0400
--- /CMP/genmddeps.c	2015-06-02 10:15:12.435363348 -0400
***************
*** 15,20 ****
--- 15,21 ----
     along with this program; see the file COPYING3.  If not see
     <http://www.gnu.org/licenses/>.  */
  
+ #define EARLY_GENERATOR_FILE
  #include "bconfig.h"
  #include "system.h"
  #include "coretypes.h"
diff -cpN /numerical/genmodes.c /CMP/genmodes.c
*** /numerical/genmodes.c	2015-06-01 18:00:36.291376316 -0400
--- /CMP/genmodes.c	2015-06-02 10:15:12.436363323 -0400
*************** You should have received a copy of the G
*** 17,22 ****
--- 17,23 ----
  along with GCC; see the file COPYING3.  If not see
  <http://www.gnu.org/licenses/>.  */
  
+ #define EARLY_GENERATOR_FILE
  #include "bconfig.h"
  #include "system.h"
  #include "errors.h"
diff -cpN /numerical/ggc-none.c /CMP/ggc-none.c
*** /numerical/ggc-none.c	2015-06-01 18:00:36.292376290 -0400
--- /CMP/ggc-none.c	2015-06-02 10:15:12.436363323 -0400
***************
*** 21,26 ****
--- 21,27 ----
     targets (such as java), where we don't really need GC at all.
     This prevents problems with pulling in all the tree stuff.  */
  
+ #define EARLY_GENERATOR_FILE
  #ifdef GENERATOR_FILE
  #include "bconfig.h"
  #else
diff -cpN /numerical/hash-table.c /CMP/hash-table.c
*** /numerical/hash-table.c	2015-06-01 18:00:36.295376212 -0400
--- /CMP/hash-table.c	2015-06-02 10:15:12.440363220 -0400
*************** along with GCC; see the file COPYING3.
*** 22,27 ****
--- 22,28 ----
  /* This file implements a typed hash table.
     The implementation borrows from libiberty's hashtab.  */
  
+ #define EARLY_GENERATOR_FILE
  #ifdef GENERATOR_FILE
  #include "bconfig.h"
  #else
diff -cpN /numerical/inchash.c /CMP/inchash.c
*** /numerical/inchash.c	2015-06-01 18:00:36.296376186 -0400
--- /CMP/inchash.c	2015-06-02 10:15:12.440363220 -0400
*************** You should have received a copy of the G
*** 17,22 ****
--- 17,23 ----
  along with GCC; see the file COPYING3.  If not see
  <http://www.gnu.org/licenses/>.  */
  
+ #define EARLY_GENERATOR_FILE
  #ifdef GENERATOR_FILE
  #include "bconfig.h"
  #else
diff -cpN /numerical/read-md.c /CMP/read-md.c
*** /numerical/read-md.c	2015-06-01 18:00:36.302376030 -0400
--- /CMP/read-md.c	2015-06-02 10:15:12.450362962 -0400
*************** You should have received a copy of the G
*** 17,22 ****
--- 17,23 ----
  along with GCC; see the file COPYING3.  If not see
  <http://www.gnu.org/licenses/>.  */
  
+ #define EARLY_GENERATOR_FILE
  #include "bconfig.h"
  #include "system.h"
  #include "coretypes.h"
diff -cpN /numerical/rtl.h /CMP/rtl.h
*** /numerical/rtl.h	2015-06-01 18:00:36.303376004 -0400
--- /CMP/rtl.h	2015-06-02 10:15:12.454362858 -0400
*************** along with GCC; see the file COPYING3.
*** 20,37 ****
  #ifndef GCC_RTL_H
  #define GCC_RTL_H
  
- /* This file is occasionally included by generator files which expect
-    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"
- #endif  /* GENERATOR_FILE */
- 
  #include "statistics.h"
  #include "input.h"
  #include "vec.h"
--- 20,25 ----
diff -cpN /numerical/vec.c /CMP/vec.c
*** /numerical/vec.c	2015-06-01 18:00:36.314375718 -0400
--- /CMP/vec.c	2015-06-02 10:15:12.471362420 -0400
*************** along with GCC; see the file COPYING3.
*** 22,27 ****
--- 22,28 ----
  /* This file is compiled twice: once for the generator programs
     once for the compiler.  */
  #ifdef GENERATOR_FILE
+ #define EARLY_GENERATOR_FILE
  #include "bconfig.h"
  #else
  #include "config.h"

Reply via email to