On 07/08/2015 06:43 PM, Jeff Law wrote:
On 07/07/2015 05:53 PM, Andrew MacLeod wrote:
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 :_)
Works for me... I'm sure Martin S. is cringing at my python scripts
right now, so I completely understand.
yeah, dmalcolm is not allowed to look at them :-)
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*.
Might be something for a follow-up (moving the enums).
blah, not so trivial. One of the primary things predict.h does is
create enum br_predictor by including predict,def.. so moving that enum
doesnt really make sense.
Fixing gimple,h isn't too bad, I could split the prediction stuff out
into gimple-predict.h and include it in the 4 places its needed (as you
might be able to tell, Ive tried this :-)
However, it doesn't do much good. cfghooks.h is included by
basic-block.h.. which is needed virtually everywhere :-P
There are just 2 entries in the hooks table which require 'enum
br_predictor', but I dont think it makes sense to move things out of the
cfghook structure.. I suppose once could create a prediction_hooks
structure.. and put it in predict_hooks.h... but I think thats probably
going to far to avoid including a file which makes some logical sense..
The other option is to pull cfghooks.h out of basic-block.h and include
it seperately on its own.. What is the reason its in there now? It
appears to not have a cyclic dependency which is the usual reason to
have an include in the middle of a file. Or perhaps the reason no
longer exists? There is a comment at the top of cfghooks.h :
/* Only basic-block.h includes this. */
but no rationale.
I moved it to the very bottom of the file and everything still seems to
compile fine I can try flattening it out of basic-block.h and only
including it in places that need it... that should eliminate the need to
put predict.h in a lot of places I would think.
Andrew