Re: [patch] Flatten function.h take 2

2014-10-10 Thread Andrew MacLeod

On 10/10/2014 04:51 PM, Jeff Law wrote:

On 09/29/14 11:23, Andrew MacLeod wrote:


OK, here's take 2.. I left all the include files except ones which were
duplicated as a result of the flattening. The first one was left, and
any subsequent #Includes of the files were removed.  we'll address
"unneeded" includes separately and all at once.. perhaps with a newer
tool that has been taught about input and output dependencies

Bootstrapepd on x86_64-unknown-linux-gnu with no new regressions.
Currently config-list.mk is building, but Im not expecting any issues
there.  assuming all is oK, ok to check in?

Andrew

PS.. the original commentary:

This flattens function.h.  It wasn't too bad, there were a few
prototypes and defines in expr.h and rtl.h that belong in function.h,
and a couple of other prototypes that belonged in other .h files.  A
bunch of the gen*.c generated files actually use function.h.. so they
needed some tweaking.
This version is fine assuming your testing went OK.  It's a highly 
mechanical patch once you get to the .c files.  SO it wasn't nearly as 
bad as I expected when I saw its size :-)


Yeah.. the nature of these flattening patches..   they tend to look very 
large, but in reality only the first few files tend to have any changes 
that aren't mechanical.


i use to list them in separate patches, now I just list them first and 
try to describe the bits that are not obvious  :)


Thanks
Andrew

PS. Testing went fine :-)


Re: [patch] Flatten function.h take 2

2014-10-10 Thread Jeff Law

On 09/29/14 11:23, Andrew MacLeod wrote:


OK, here's take 2.. I left all the include files except ones which were
duplicated as a result of the flattening. The first one was left, and
any subsequent #Includes of the files were removed.  we'll address
"unneeded" includes separately and all at once.. perhaps with a newer
tool that has been taught about input and output dependencies

Bootstrapepd on x86_64-unknown-linux-gnu with no new regressions.
Currently config-list.mk is building, but Im not expecting any issues
there.  assuming all is oK, ok to check in?

Andrew

PS.. the original commentary:

This flattens function.h.  It wasn't too bad, there were a few
prototypes and defines in expr.h and rtl.h that belong in function.h,
and a couple of other prototypes that belonged in other .h files.  A
bunch of the gen*.c generated files actually use function.h.. so they
needed some tweaking.
This version is fine assuming your testing went OK.  It's a highly 
mechanical patch once you get to the .c files.  SO it wasn't nearly as 
bad as I expected when I saw its size :-)




Re: [patch] Flatten function.h take 2

2014-10-06 Thread Andrew MacLeod

Ping... anyone want to take a look?

Andrew

On 09/29/2014 01:23 PM, Andrew MacLeod wrote:

On 09/16/2014 05:23 PM, Andrew MacLeod wrote:

On 09/16/2014 05:12 PM, Joseph S. Myers wrote:

On Tue, 16 Sep 2014, Andrew MacLeod wrote:

I did an include file reduction on all the language/*.[ch] and core 
*.[ch]
files, but left the target files with the full complement of 7 
includes that
function.h use to have.  Its probably easier when this is all done 
to fully
reduce the targets one at a time... there are so many nooks and 
crannies I
figured I'd bust something right now if i tried to do all the 
targets as well

:-)
How did you determine what includes to remove?  You appear to have 
removed
tm.h includes from various files that do in fact use target macros; 
maybe

they get it indirectly included by some other header, but I thought a
principle of this flattening was to avoid relying on such indirect
inclusions.  Because of possible use of target macros in #ifdef
conditionals, "compiles with the include removed" is not a sufficient
condition for removing it.

cfgrtl.c
gimple-fold.c
mode-switching.c
tree-inline.c
vmsdbgout.c
fortran/f95-lang.c
fortran/trans-decl.c
objc/objc-act.c

Many of those files do in fact get numerous include files from 
expr.h, which are likely to get put back in when expr.h is 
flattened,  but there is a risk as you point out.


Perhaps I should proceed by simply moving the includes and removing 
any duplicate includes,  leaving the reduction for later date. There 
is less chance of that causing issues.  I did forget about the 
discussion last year concerning target macros from the RTL end of 
things... My mind is slowly going :-).



OK, here's take 2.. I left all the include files except ones which 
were duplicated as a result of the flattening. The first one was left, 
and any subsequent #Includes of the files were removed. we'll address 
"unneeded" includes separately and all at once.. perhaps with a newer 
tool that has been taught about input and output dependencies


Bootstrapepd on x86_64-unknown-linux-gnu with no new regressions. 
Currently config-list.mk is building, but Im not expecting any issues 
there.  assuming all is oK, ok to check in?


Andrew

PS.. the original commentary:

This flattens function.h.  It wasn't too bad, there were a few 
prototypes and defines in expr.h and rtl.h that belong in function.h, 
and a couple of other prototypes that belonged in other .h files.  A 
bunch of the gen*.c generated files actually use function.h.. so they 
needed some tweaking.




function.patch.gz
Description: application/gzip


[patch] Flatten function.h take 2

2014-09-29 Thread Andrew MacLeod

On 09/16/2014 05:23 PM, Andrew MacLeod wrote:

On 09/16/2014 05:12 PM, Joseph S. Myers wrote:

On Tue, 16 Sep 2014, Andrew MacLeod wrote:

I did an include file reduction on all the language/*.[ch] and core 
*.[ch]
files, but left the target files with the full complement of 7 
includes that
function.h use to have.  Its probably easier when this is all done 
to fully
reduce the targets one at a time... there are so many nooks and 
crannies I
figured I'd bust something right now if i tried to do all the 
targets as well

:-)
How did you determine what includes to remove?  You appear to have 
removed
tm.h includes from various files that do in fact use target macros; 
maybe

they get it indirectly included by some other header, but I thought a
principle of this flattening was to avoid relying on such indirect
inclusions.  Because of possible use of target macros in #ifdef
conditionals, "compiles with the include removed" is not a sufficient
condition for removing it.

cfgrtl.c
gimple-fold.c
mode-switching.c
tree-inline.c
vmsdbgout.c
fortran/f95-lang.c
fortran/trans-decl.c
objc/objc-act.c

Many of those files do in fact get numerous include files from expr.h, 
which are likely to get put back in when expr.h is flattened,  but 
there is a risk as you point out.


Perhaps I should proceed by simply moving the includes and removing 
any duplicate includes,  leaving the reduction for later date. There 
is less chance of that causing issues.  I did forget about the 
discussion last year concerning target macros from the RTL end of 
things... My mind is slowly going :-).



OK, here's take 2.. I left all the include files except ones which were 
duplicated as a result of the flattening. The first one was left, and 
any subsequent #Includes of the files were removed.  we'll address 
"unneeded" includes separately and all at once.. perhaps with a newer 
tool that has been taught about input and output dependencies


Bootstrapepd on x86_64-unknown-linux-gnu with no new regressions. 
Currently config-list.mk is building, but Im not expecting any issues 
there.  assuming all is oK, ok to check in?


Andrew

PS.. the original commentary:

This flattens function.h.  It wasn't too bad, there were a few 
prototypes and defines in expr.h and rtl.h that belong in function.h, 
and a couple of other prototypes that belonged in other .h files.  A 
bunch of the gen*.c generated files actually use function.h.. so they 
needed some tweaking.


	* function.h: Flatten file.  Remove includes, adjust prototypes to 
	reflect only what is in function.h.
	(enum direction, struct args_size, struct locate_and_pad_arg_data,
	ADD_PARM_SIZE, SUB_PARM_SIZE, ARGS_SIZE_TREE, ARGS_SIZE_RTX): Relocate
	from expr.h.
	(ASLK_REDUCE_ALIGN, ASLK_RECORD_PAD): Relocate from rtl.h.
	(optimize_function_for_size_p, optimize_function_for_speed_p): Move
	prototypes to predict.h.
	(init_varasm_status): Move prototype to varasm.h.

	* expr.h: Adjust include files.
	(enum direction, struct args_size, struct locate_and_pad_arg_data,
	ADD_PARM_SIZE, SUB_PARM_SIZE, ARGS_SIZE_TREE, ARGS_SIZE_RTX): Move
	to function.h.
	(locate_and_pad_parm): Move prototype to function.h.
	* rtl.h: (assign_stack_local, ASLK_REDUCE_ALIGN, ASLK_RECORD_PAD,
	assign_stack_local_1, assign_stack_temp, assign_stack_temp_for_type,
	assign_temp, reposition_prologue_and_epilogue_notes,
	prologue_epilogue_contains, sibcall_epilogue_contains,
	update_temp_slot_address, maybe_copy_prologue_epilogue_insn,
	set_return_jump_label): Move prototypes to function.h.
	* predict.h (optimize_function_for_size_p,
	optimize_function_for_speed_p): Relocate prototypes from function.h.
	* shrink-wrap.h (emit_return_into_block, active_insn_between,
	convert_jumps_to_returns, emit_return_for_exit): Move prototypes to
	function.h.
	* varasm.h (init_varasm_status): Relocate prototype from function.h.
	* genattrtab.c (write_header): Add predict.h to include list.
	* genconditions.c (write_header): Add predict.h to include list.
	* genemit.c (main): Adjust header file includes.
	* gengtype.c (ifiles): Add flattened function.h header files.
	* genoutput.c (output_prologue): Add predict.h to include list.
	* genpreds.c (write_insn_preds_c): Adjust header file includes.
	* genrecog.c (write_header): Add flattened function.h header files.

	* alias.c: Adjust include files.
	* auto-inc-dec.c: Likewise.
	* basic-block.h: Likewise.
	* bb-reorder.c: Likewise.
	* bt-load.c: Likewise.
	* builtins.c: Likewise.
	* caller-save.c: Likewise.
	* calls.c: Likewise.
	* cfgbuild.c: Likewise.
	* cfgcleanup.c: Likewise.
	* cfgexpand.c: Likewise.
	* cfgloop.c: Likewise.
	* cfgloop.h: Likewise.
	* cfgrtl.c: Likewise.
	* cgraph.h: Likewise.
	* cgraphclones.c: Likewise.
	* cgraphunit.c: Likewise.
	* combine-stack-adj.c: Likewise.
	* combine.c: Likewise.
	* coverage.c: Likewise.
	* cprop.c: Likewise.
	* cse.c: Likewise.
	* cselib.c: Likewise.
	* dbxout.c: Likewise.
	* ddg.c: Likewise.
	* df-core.c: Likewise.
	* df-problems.c: Likewise.
	* df-

Re: Flatten function.h

2014-09-16 Thread Andrew MacLeod

On 09/16/2014 05:12 PM, Joseph S. Myers wrote:

On Tue, 16 Sep 2014, Andrew MacLeod wrote:


I did an include file reduction on all the language/*.[ch] and core *.[ch]
files, but left the target files with the full complement of 7 includes that
function.h use to have.  Its probably easier when this is all done to fully
reduce the targets one at a time... there are so many nooks and crannies I
figured I'd bust something right now if i tried to do all the targets as well
:-)

How did you determine what includes to remove?  You appear to have removed
tm.h includes from various files that do in fact use target macros; maybe
they get it indirectly included by some other header, but I thought a
principle of this flattening was to avoid relying on such indirect
inclusions.  Because of possible use of target macros in #ifdef
conditionals, "compiles with the include removed" is not a sufficient
condition for removing it.

cfgrtl.c
gimple-fold.c
mode-switching.c
tree-inline.c
vmsdbgout.c
fortran/f95-lang.c
fortran/trans-decl.c
objc/objc-act.c

Many of those files do in fact get numerous include files from expr.h, 
which are likely to get put back in when expr.h is flattened,  but there 
is a risk as you point out.


Perhaps I should proceed by simply moving the includes and removing any 
duplicate includes,  leaving the reduction for later date. There is less 
chance of that causing issues.  I did forget about the discussion last 
year concerning target macros from the RTL end of things... My mind is 
slowly going :-).




Andrew





Re: Flatten function.h

2014-09-16 Thread Joseph S. Myers
On Tue, 16 Sep 2014, Andrew MacLeod wrote:

> I did an include file reduction on all the language/*.[ch] and core *.[ch]
> files, but left the target files with the full complement of 7 includes that
> function.h use to have.  Its probably easier when this is all done to fully
> reduce the targets one at a time... there are so many nooks and crannies I
> figured I'd bust something right now if i tried to do all the targets as well
> :-)

How did you determine what includes to remove?  You appear to have removed 
tm.h includes from various files that do in fact use target macros; maybe 
they get it indirectly included by some other header, but I thought a 
principle of this flattening was to avoid relying on such indirect 
inclusions.  Because of possible use of target macros in #ifdef 
conditionals, "compiles with the include removed" is not a sufficient 
condition for removing it.

cfgrtl.c
gimple-fold.c
mode-switching.c
tree-inline.c
vmsdbgout.c
fortran/f95-lang.c
fortran/trans-decl.c
objc/objc-act.c

-- 
Joseph S. Myers
jos...@codesourcery.com


Flatten function.h

2014-09-16 Thread Andrew MacLeod
Im currently focusing on flattening middle/backend files which are 
included from front-ends files so we can clean up the include interface 
a bit.


This flattens function.h.  It wasn't too bad, there were a few 
prototypes and defines in expr.h and rtl.h that belong in function.h, 
and a couple of other prototypes that belonged in other .h files.  A 
bunch of the gen*.c generated files actually use function.h.. so they 
needed some tweaking.


I did an include file reduction on all the language/*.[ch] and core 
*.[ch] files, but left the target files with the full complement of 7 
includes that function.h use to have.  Its probably easier when this is 
all done to fully reduce the targets one at a time... there are so many 
nooks and crannies I figured I'd bust something right now if i tried to 
do all the targets as well :-)


Before the final commit, I will do an include reduction on 
ada/gcc-interface/misc.c... my previous build didnt have Ada enabled, so 
I missed the reduction there.


Bootstraps on x86_64-unknown-linux-gnu with no new test regressions (one 
plugin test required adding an include). I've also run all the targets 
in  config-list.mk and the ones that built seem to build fine, but its 
still running.. I'll verify before checking in.


for the record, this patch relocates the following include to where ever 
function.h is included from.  Any plugins which include function.h may 
want to add these to the include list just before function.h


#include "hashtab.h"
#include "hash-set.h"
#include "vec.h"
#include "machmode.h"
#include "tm.h"
#include "hard-reg-set.h"
#include "input.h"

OK for trunk?

Andrew

	* function.h: Flatten file.  Remove includes, adjust prototypes to 
	reflect only what is in function.h.
	(enum direction, struct args_size, struct locate_and_pad_arg_data,
	ADD_PARM_SIZE, SUB_PARM_SIZE, ARGS_SIZE_TREE, ARGS_SIZE_RTX): Relocate
	from expr.h.
	(ASLK_REDUCE_ALIGN, ASLK_RECORD_PAD): Relocate from rtl.h.
	(optimize_function_for_size_p, optimize_function_for_speed_p): Move
	prototypes to predict.h.
	(init_varasm_status): Move prototype to varasm.h.

	* expr.h: Adjust include files.
	(enum direction, struct args_size, struct locate_and_pad_arg_data,
	ADD_PARM_SIZE, SUB_PARM_SIZE, ARGS_SIZE_TREE, ARGS_SIZE_RTX): Move
	to function.h.
	(locate_and_pad_parm): Move prototype to function.h.
	* rtl.h: (assign_stack_local, ASLK_REDUCE_ALIGN, ASLK_RECORD_PAD,
	assign_stack_local_1, assign_stack_temp, assign_stack_temp_for_type,
	assign_temp, reposition_prologue_and_epilogue_notes,
	prologue_epilogue_contains, sibcall_epilogue_contains,
	update_temp_slot_address, maybe_copy_prologue_epilogue_insn,
	set_return_jump_label): Move prototypes to function.h.
	* predict.h (optimize_function_for_size_p,
	optimize_function_for_speed_p): Relocate prototypes from function.h.
	* shrink-wrap.h (emit_return_into_block, active_insn_between,
	convert_jumps_to_returns, emit_return_for_exit): Move prototypes to
	function.h.
	* varasm.h (init_varasm_status): Relocate prototype from function.h.
	* genattrtab.c (write_header): Add predict.h to include list.
	* genconditions.c (write_header): Add predict.h to include list.
	* genemit.c (main): Adjust header file includes.
	* gengtype.c (ifiles): Add flattened function.h header files.
	* genoutput.c (output_prologue): Add predict.h to include list.
	* genpreds.c (write_insn_preds_c): Adjust header file includes.
	* genrecog.c (write_header): Add flattened function.h header files.

	* alias.c: Adjust include files.
	* auto-inc-dec.c: Likewise.
	* basic-block.h: Likewise.
	* bb-reorder.c: Likewise.
	* bt-load.c: Likewise.
	* builtins.c: Likewise.
	* caller-save.c: Likewise.
	* calls.c: Likewise.
	* cfgbuild.c: Likewise.
	* cfgcleanup.c: Likewise.
	* cfgexpand.c: Likewise.
	* cfgloop.c: Likewise.
	* cfgloop.h: Likewise.
	* cfgrtl.c: Likewise.
	* cgraph.h: Likewise.
	* cgraphclones.c: Likewise.
	* cgraphunit.c: Likewise.
	* combine-stack-adj.c: Likewise.
	* combine.c: Likewise.
	* coverage.c: Likewise.
	* cprop.c: Likewise.
	* cse.c: Likewise.
	* cselib.c: Likewise.
	* dbxout.c: Likewise.
	* ddg.c: Likewise.
	* df-core.c: Likewise.
	* df-problems.c: Likewise.
	* df-scan.c: Likewise.
	* dojump.c: Likewise.
	* dwarf2cfi.c: Likewise.
	* dwarf2out.c: Likewise.
	* emit-rtl.c: Likewise.
	* except.c: Likewise.
	* explow.c: Likewise.
	* expr.c: Likewise.
	* final.c: Likewise.
	* function.c: Likewise.
	* gcse.c: Likewise.
	* gimple-fold.c: Likewise.
	* gimple-low.c: Likewise.
	* gimple-streamer.h: Likewise.
	* haifa-sched.c: Likewise.
	* ifcvt.c: Likewise.
	* ira.c: Likewise.
	* jump.c: Likewise.
	* lcm.c: Likewise.
	* loop-invariant.c: Likewise.
	* lra-assigns.c: Likewise.
	* lra-coalesce.c: Likewise.
	* lra-constraints.c: Likewise.
	* lra-eliminations.c: Likewise.
	* lra-lives.c: Likewise.
	* lra-spills.c: Likewise.
	* lra.c: Likewise.
	* lto-cgraph.c: Likewise.
	* lto-section-in.c: Likewise.
	* lto-section-out.c: Likewise.
	* lto-streamer-in.c: Likewise.
	* lto-strea