On 07/07/2015 06:21 PM, Jeff Law wrote:
On 07/07/2015 07:40 AM, Andrew MacLeod wrote:
I can adjust any of this quite easily, or present them in a different
way if you don't like it this way. Again, my goal is to check in just
the final patch which does all the work of first 8 patches. It would
be a lot less turmoil on the branch. I can do it in smaller chunks if
need be.
The set of 9 patches is fine for the trunk. Just a few discussion
points...
One of the things I keep thinking about as these changes fly by is
your scripts. Is there a reasonable possibility for you to add your
scripts to the contrib/ directory or something similar to aid us in
any future header file refactoring? Yes, I know that in theory we
should never have to do this again, but I also know that reality can
be rather different.
yes, with a bit of tweaking and enhancement they can be generally
useful. They are all in python. And no one is allowed to make comments
like "OMG thats so inefficient" or "what a horrible way to do that"
:-) My goal was getting things done and sometimes the brute force
approach works great when the machine sare fast enough :_)
Presumably the aggregators, by policy, are to have #includes and
nothing else, right? If so, we might want a comment to that effect in
them.
Yeah, will do.
It's a bit of a shame that function.h is in backend.h, along with
predict (which is presumably needed by basic-block/cfg?).
Yeah,once things settle down someone could tweak things more. If I make
the tools available, people can do their own analysis and adjusting.
function.h provides cfun which is used all over the place..9 backend
header files use it,and a few like gimple.h actually require struct
function to be defined.
predict.h is actually required by gimple.h for a few reasons, enum
be_predictor is used in parameter lists and a few inlines use the TAKEN,
NOT_TAKEN macros
Its also needed by cfghooks.h, and betwen those 2 files, its just needed
by a very good chunk of the backend. .. 219 of the 263 files which
include backend.h need it.
We could move the 2 enums and TAKEN/NOT_TAKEN to coretypes or something
like that and it would probably cut the requirements for it by a *lot*.
Andrew
For the sake of amusement, here's the output from my initial include
reduction logs for each file. Its basically all the unique errors
produced by trying to remove the header from every source file in
libbackend.a:
predict.h:
gimple_h : use of enum ‘br_predictor’ without previous declaration
gimple_h : use of enum ‘prediction’ without previous declaration
gimple_h : ‘TAKEN’ was not declared in this scope
gimple_h : ‘NOT_TAKEN’ was not declared in this scope
cfghooks_h : use of enum ‘br_predictor’ without previous declaration
(1) : predict_h -> cfghooks_h
use of enum ‘br_predictor’ without previous declaration
(4) : predict_h -> gimple_h
use of enum ‘br_predictor’ without previous declaration
use of enum ‘prediction’ without previous declaration
‘TAKEN’ was not declared in this scope
‘NOT_TAKEN’ was not declared in this scope
function.h:
emit_rtl_h : field ‘expr’ has incomplete type ‘expr_status’
emit_rtl_h : field ‘emit’ has incomplete type ‘emit_status’
emit_rtl_h : field ‘varasm’ has incomplete type ‘varasm_status’
emit_rtl_h : field ‘subsections’ has incomplete type ‘function_subsections’
emit_rtl_h : field ‘eh’ has incomplete type ‘rtl_eh’
emit_rtl_h : invalid use of incomplete type ‘struct sequence_stack’
gimple_h : invalid use of incomplete type ‘struct function’
gimple_ssa_h : invalid use of incomplete type ‘const struct function’
gimple_ssa_h : ‘cfun’ was not declared in this scope
tree_ssanames_h : ‘cfun’ was not declared in this scope
cfgloop_h : ‘loops_for_fn’ was not declared in this scope
cfgloop_h : ‘current_loops’ was not declared in this scope
cfgloop_h : ‘cfun’ was not declared in this scope
cilk_h : invalid use of incomplete type ‘struct function’
ssa_iterators_h : ‘cfun’ was not declared in this scope
tree_scalar_evolution_h : ‘cfun’ was not declared in this scope
(1) : function_h -> tree_scalar_evolution_h
‘cfun’ was not declared in this scope
(1) : function_h -> tree_ssanames_h
‘cfun’ was not declared in this scope
(1) : function_h -> ssa_iterators_h
‘cfun’ was not declared in this scope
(1) : function_h -> cilk_h
invalid use of incomplete type ‘struct function’
(1) : function_h -> gimple_h
invalid use of incomplete type ‘struct function’
(2) : function_h -> gimple_ssa_h
invalid use of incomplete type ‘const struct function’
‘cfun’ was not declared in this scope
(3) : function_h -> cfgloop_h
‘loops_for_fn’ was not declared in this scope
‘current_loops’ was not declared in this scope
‘cfun’ was not declared in this scope
(6) : function_h -> emit_rtl_h
field ‘expr’ has incomplete type ‘expr_status’
field ‘emit’ has incomplete type ‘emit_status’
field ‘varasm’ has incomplete type ‘varasm_status’
field ‘subsections’ has incomplete type ‘function_subsections’
field ‘eh’ has incomplete type ‘rtl_eh’
invalid use of incomplete type ‘struct sequence_stack’