On Thu, Jul 5, 2012 at 11:53 PM, Steven Bosscher <stevenb....@gmail.com> wrote: > Hello, > > This is a first stab at making the core CFG code independent of the > expression intermediate representation datatypes. This patch deals > with cfg.c and cfganal.c but it shouldn't be a surprise that the patch > touches a lot of other files. > > I removed all IR headers (tree.h and rtl.h) from function.h and > basic-block.h, and that caused some fall-out left and right. Who would > have expected that ira-conflicts.c depends on tree.h?! Or that cfg.c > did not include basic-block.h directly, but only inherited from > cfgloop.h? > > There were also a couple of places where an RTL pass was ported to > GIMPLE but still used RTL CFG dump functions. > > The only bit I'm not very happy with, is the > set_loop_copy/get_loop_copy change. I did not want cfg.c to be > dependent on cfgloop.h ony for struct loop, but I also did not want to > duplicate the original_table machinery from cfg.c, or export it from > there. This was the least ugly solution I could come up with. Looking > back at the change now, I wonder whether I can use a pointer-set > instead and move set_loop_copy and get_loop_copy to cfgloopmanip.c. > > Otherwise, I think this shows the direction I'm trying to take things. > My plan for the CFG code is to end up with one common CFG header and a > cfgrtl.h and tree-cfg.h. It is unfortunate that this involves moving a > lot of functions from one file to another, but that is IMHO an > inevitable cost of trying for a more towards a more modular build-up > of the compiler. > > Bootstrapped and tested on powerpc64-unknown-linux-gnu. I have a bug > somewhere in the profiling code that gives a bunch of test suite > failures, but I'm looking for comments/suggestions/... already, so > that I don't do too much useless work :-) > (Without IBM's gcc110 donation, I would not have been able to do all this > work!)
Wow ;) I agree about the set_loop_copy/get_loop_copy change - I'd simply postpone it with a comment why cfgloop.h is needed and investigate the pointer-map idea. Generally I think dump_* routines should work even when cfun is not the function we dump an edge for. Thus, - /* both ENTRY_BLOCK_PTR & EXIT_BLOCK_PTR depend upon cfun. */ - if (cfun && side == ENTRY_BLOCK_PTR) + if (side == ENTRY_BLOCK_PTR) fputs (" ENTRY", file); - else if (cfun && side == EXIT_BLOCK_PTR) + else if (side == EXIT_BLOCK_PTR) fputs (" EXIT", file); should instead test side->index == ENTRY_BLOCK / EXIT_BLOCK. Otherwise the patch looks really good - best if teamed with updating doc/cfg.texi ;) Thanks, Richard. > Ciao! > Steven