On Tue, Jun 16, 2015 at 7:21 PM, Andrew MacLeod <amacl...@redhat.com> wrote: > function.h defines struct rtl_data which is used for generating rtl. In > particular, it defines an instance 'crtl' which for generating rtl appears > analagous to cfun for gimple and trees. > > That is the only reason function.h requires hard-reg-set.h. I tried a lot > of variations.. like moving it into rtl.h, moving it into its own file, and > eventually settled on putting it in emit-rtl.h In fact, it turns out > emit-rtl.c is where the instance is actually declared.... function.h was > simply providing a reference to it so someone didn't have to include > emit-rtl I guess. BUt then emit-rtl.h has most of the inline functions for > accessing it. There appears to be some historical reason for not wanting to > include emit-rtl.h? Im not sure. > > Placing it in rtl.h appeared to be someones original plan if I read the > various comments correctly. I tried that in many variations, but the > intricate dance between the generators and rtl.h and how to detect who > really needs it made it ugly, and I couldn't find any decent way to do it. > Putting it in Its own file worked OK, but it required that file to be > incliuded a lot of other places. Thats still an option however. Given > the changes to put it into emit-rtl.h are so simple in comparison, and all > the routines that manipulate are already declared there, it seems like the > most appropriate place. > > there were also 2 function prototypes in function.h which were guarded by > #ifdef RTX_CODE.... I remove that and let the prototypes be defined. I'm > not sure why they were guarded... they aren't called if there is no RTX_CODE > defined anyway... lots of other parameter lists refer to 'rtx' and there's > no compilation error if the prototypes is produced but not used. > > By doing that, there is no longer any ordering requirement that function.h > be included before rtl.h, and no dependency. And of course, function.h no > longer requires hard-reg-set.h etiher. > > bootstraps on x86_64-unknown-linux-gnu with no new regressions, and also > compiles stage 1 for all the targets in config-list.mk.
Ok. Thanks, Richard. > OK for trunk? > Andrew