diff mbox

[1/9] header additions and aggregators

Message ID 559BD767.6010401@redhat.com
State New
Headers show

Commit Message

Andrew MacLeod July 7, 2015, 1:43 p.m. UTC
This patch implements most of the core concepts described in my previous 
email (https://gcc.gnu.org/ml/gcc-patches/2015-06/msg01846.html)  It 
goes into detail of the analysis which resulted in this layout.  Most of 
the unnecessary prerequisites have been removed, so we can start 
introducing back some of the required files.

  The changes in this patch:

* symtab.h is required for tree-core.h to compile, so include it.

* rtl.h does not require flagfs.h, but it does need hard-reg-set.h, and 
it turns out that any build files which need rtl.h actually have 
hard-reg-set.h available... so we can simply include it there.
   Furthermore, now that hard-reg-set.h is being included, all the 
conditional compilation code on HARD_CONST can also be removed. This 
removes a subtle ordering that you needed to make sure hard-reg-set.h 
was included before rtl.h, or certain routines didn't appear to be 
available.

* regs.h includes both hard-reg-set.h and rtl.h.  Turns out 153 of the 
155 files which include regs.h also included rtl.h already... so simple 
remove the includes.

* cfg.h requires dominance to compile, so include it.

* gimple.h requires tree-ssa-alias.h and gimple-expr.h to compile, so 
include them

* introduce backend.h which includes the files most frequently required 
by libbackend.a objects. they are tm.h, function.h, bitmap.h, sbitmap.h, 
predict.h, basic-block.h, and cfg.h

gimple-ssa.h does not need tree-hasher.h., so remove it.

* Introduce ssa.h as an aggregator for commonly needs ssa files.  I 
originally thought I could use tree-ssa-operands.h, but alas, there are 
ordering issues where many of the headers require the contents of 
tree-ssa-operands.h.  So I'd either have to put all these includes at 
the bottom of the file, or create a new file.  I think a new file is a 
better solution.

This patch actually compiles as is, but there are  a number of followup 
manipulations in the final source update. For each source file, any 
includes which occur in one of these files are removed, avoiding 
duplicates.

In the case of backend.h and ssa.h, any backend file which used 3 or 
more of the aggregated includes are replaced with the aggregator.

Further aggregations may be done for front end and other components 
after the include reduction is eventually performed.

Bootstraps from scratch on x86_64-unknown-linux-gnu with no new 
regressions. Also compiles all the files in config-list.mk.

Andrew
diff mbox

Patch


	* tree-core.h: Include symtab.h.
	* rtl.h: Include hard-reg-set.h but not flags.h.
	(HARD_CONST): Remove condition compilation involving HARD_CONST since 
	hard-reg-set.h is always included.
	* regs.h: Don't include hard-reg-set.h or rtl.h.
	* cfg.h: Include dominance.h.
	* gimple.h: Include tree-ssa-alias.h and gimple-expr.h.
	* backend.h: New.  Aggregate commonly used backend header files.
	* gimple-ssa.h: Don't include tree-hasher.h.
	* ssa.h: New.  Aggregate commonly used SSA header files.

Index: tree-core.h
===================================================================
*** tree-core.h	(revision 224988)
--- tree-core.h	(working copy)
*************** along with GCC; see the file COPYING3.
*** 20,25 ****
--- 20,27 ----
  #ifndef GCC_TREE_CORE_H
  #define GCC_TREE_CORE_H
  
+ #include "symtab.h"
+ 
  /* This file contains all the data structures that define the 'tree' type.
     There are no accessor macros nor functions in this file. Only the
     basic data structures, extern declarations and type definitions.  */
Index: rtl.h
===================================================================
*** rtl.h	(revision 224988)
--- rtl.h	(working copy)
*************** along with GCC; see the file COPYING3.
*** 38,44 ****
  #include "is-a.h"
  #endif  /* GENERATOR_FILE */
  
! #include "flags.h"
  
  /* Value used by some passes to "recognize" noop moves as valid
   instructions.  */
--- 38,44 ----
  #include "is-a.h"
  #endif  /* GENERATOR_FILE */
  
! #include "hard-reg-set.h"
  
  /* Value used by some passes to "recognize" noop moves as valid
   instructions.  */
*************** extern bool val_signbit_known_clear_p (m
*** 2880,2888 ****
  /* In reginfo.c  */
  extern machine_mode choose_hard_reg_mode (unsigned int, unsigned int,
  					       bool);
- #ifdef HARD_CONST
  extern const HARD_REG_SET &simplifiable_subregs (const subreg_shape &);
- #endif
  
  /* In emit-rtl.c  */
  extern rtx set_for_reg_notes (rtx);
--- 2880,2886 ----
*************** extern int reg_overlap_mentioned_p (cons
*** 2939,2948 ****
  extern const_rtx set_of (const_rtx, const_rtx);
  extern void record_hard_reg_sets (rtx, const_rtx, void *);
  extern void record_hard_reg_uses (rtx *, void *);
- #ifdef HARD_CONST
  extern void find_all_hard_regs (const_rtx, HARD_REG_SET *);
  extern void find_all_hard_reg_sets (const rtx_insn *, HARD_REG_SET *, bool);
- #endif
  extern void note_stores (const_rtx, void (*) (rtx, const_rtx, void *), void *);
  extern void note_uses (rtx *, void (*) (rtx *, void *), void *);
  extern int dead_or_set_p (const_rtx, const_rtx);
--- 2937,2944 ----
*************** extern bool can_assign_to_reg_without_cl
*** 3572,3580 ****
  extern rtx fis_get_condition (rtx_insn *);
  
  /* In ira.c */
- #ifdef HARD_CONST
  extern HARD_REG_SET eliminable_regset;
- #endif
  extern void mark_elimination (int, int);
  
  /* In reginfo.c */
--- 3568,3574 ----
*************** extern void init_reg_sets (void);
*** 3590,3598 ****
  extern void regclass (rtx, int);
  extern void reg_scan (rtx_insn *, unsigned int);
  extern void fix_register (const char *, int, int);
- #ifdef HARD_CONST
  extern const HARD_REG_SET *valid_mode_changes_for_regno (unsigned int);
- #endif
  
  /* In reload1.c */
  extern int function_invariant_p (const_rtx);
--- 3584,3590 ----
*************** extern void _fatal_insn (const char *, c
*** 3709,3715 ****
  /* reginfo.c */
  extern tree GTY(()) global_regs_decl[FIRST_PSEUDO_REGISTER];
  
- #ifdef HARD_CONST
  /* Information about the function that is propagated by the RTL backend.
     Available only for functions that has been already assembled.  */
  
--- 3701,3706 ----
*************** struct GTY(()) cgraph_rtl_info {
*** 3723,3729 ****
    /* Set if function_used_regs is valid.  */
    unsigned function_used_regs_valid: 1;
  };
- #endif
  
  
  #endif /* ! GCC_RTL_H */
--- 3714,3719 ----
Index: regs.h
===================================================================
*** regs.h	(revision 225452)
--- regs.h	(working copy)
*************** along with GCC; see the file COPYING3.
*** 20,28 ****
  #ifndef GCC_REGS_H
  #define GCC_REGS_H
  
- #include "hard-reg-set.h"
- #include "rtl.h"
- 
  #define REG_BYTES(R) mode_size[(int) GET_MODE (R)]
  
  /* When you only have the mode of a pseudo register before it has a hard
--- 20,25 ----
Index: cfg.h
===================================================================
*** cfg.h	(revision 224988)
--- cfg.h	(working copy)
*************** along with GCC; see the file COPYING3.
*** 20,25 ****
--- 20,27 ----
  #ifndef GCC_CFG_H
  #define GCC_CFG_H
  
+ #include "dominance.h"
+ 
  /* What sort of profiling information we have.  */
  enum profile_status_d
  {
Index: gimple.h
===================================================================
*** gimple.h	(revision 224989)
--- gimple.h	(working copy)
*************** along with GCC; see the file COPYING3.
*** 22,27 ****
--- 22,30 ----
  #ifndef GCC_GIMPLE_H
  #define GCC_GIMPLE_H
  
+ #include "tree-ssa-alias.h"
+ #include "gimple-expr.h"
+ 
  typedef gimple gimple_seq_node;
  
  enum gimple_code {
Index: backend.h
===================================================================
*** backend.h	(revision 0)
--- backend.h	(working copy)
***************
*** 0 ****
--- 1,33 ----
+ /* Common Backend requirements. 
+ 
+    Copyright (C) 2015 Free Software Foundation, Inc.
+    Contributed by Andrew MacLeod <amacleod@redhat.com>
+ 
+ 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/>.  */
+ 
+ #ifndef GCC_BACKEND_H
+ #define GCC_BACKEND_H
+ 
+ #include "tm.h"
+ #include "function.h"
+ #include "bitmap.h"
+ #include "sbitmap.h"
+ #include "predict.h"
+ #include "basic-block.h"
+ #include "cfg.h"
+ 
+ #endif /*GCC_BACKEND_H */
Index: gimple-ssa.h
===================================================================
*** gimple-ssa.h	(revision 224988)
--- gimple-ssa.h	(working copy)
*************** along with GCC; see the file COPYING3.
*** 21,27 ****
  #ifndef GCC_GIMPLE_SSA_H
  #define GCC_GIMPLE_SSA_H
  
- #include "tree-hasher.h"
  #include "tree-ssa-operands.h"
  
  /* This structure is used to map a gimple statement to a label,
--- 21,26 ----
Index: ssa.h
===================================================================
*** ssa.h	(revision 0)
--- ssa.h	(working copy)
***************
*** 0 ****
--- 1,29 ----
+ /* Common SSA files
+    Copyright (C) 2015 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/>.  */
+ 
+ #ifndef GCC_SSA_H
+ #define GCC_SSA_H
+ 
+ #include "stringpool.h"
+ #include "gimple-ssa.h"
+ #include "tree-ssanames.h"
+ #include "tree-phinodes.h"
+ #include "ssa-iterators.h" 
+ 
+ #endif  /* GCC_SSA_H  */