This is the mail archive of the
mailing list for the GCC project.
Re: [patch] Cleanup tree-ssa-ter.c exports
- From: Andrew MacLeod <amacleod at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Diego Novillo <dnovillo at google dot com>
- Date: Fri, 13 Sep 2013 11:11:06 -0400
- Subject: Re: [patch] Cleanup tree-ssa-ter.c exports
- Authentication-results: sourceware.org; auth=none
- References: <52322D91 dot 8000706 at redhat dot com> <CAFiYyc3mcMJ9rU7YX2AOaAK_Qs7EzgRxe-X=pbEnkNf2czJCNw at mail dot gmail dot com>
On 09/13/2013 03:54 AM, Richard Biener wrote:
I actually figured as much :-) I had actually done that split before I
remembered there were other exports, and considered undoing that part,
but figured since I had done it I'd get opinion :-)
On Thu, Sep 12, 2013 at 11:09 PM, Andrew MacLeod <firstname.lastname@example.org> wrote:
There are 2 parts of tre-ssa-ter.c to address.
is_replaceable_p() is also used in expr.c, It has a flag to indicate where
its being called from, and we do different checks for each one. There is a
wrapper function stmt_is_replaceable_p() in tree-ssa-ter.c which hides the
setting of the flag to expr.c. Most of the function is common, so I
extracted out the common part, and put it in tree-ssa.c.
I then moved stmt_is_replaceable() to expr.c, has it call the common routine
and then added the extra bit it needs there. Similarly tree-ssa-ter.c gets
ter_is_replaceable_p() which calls the common part, and then does its own
special checking. This removes that general export and messiness from
I think I got the logic of the function right, but you might want to double
check... It was giving me a headache when I split it :-)
Unfortunately, tree-ssa-ter.c also has 2 functions
(find_replaceable_exprs() and dump_replaceable_exprs()) which are exported
and utilized by tree-outof-ssa.c (the file is a part of the out-of-ssa
module). So I moved the prototypes from tree-ssa-live.h into a newly
created tree-ssa-ter.h file, and included it directly from
tree-outof-ssa.c, the only consumer.
I also could have just left the is_replaceable_p() function as is, put the
prototype and the 'stmt_is_replaceable_p()' wrapper function in
tree-ssa-ter.h, and then included that from expr.c... but it just seems
like an odd thing to include directly there.... but that is an option...
eventually we mighty want to look at splitting expr.c.. it seems a bit
multi-personality with some pure RTL, some tree/rtl and some ssa... even
though they all serve the same ultimate function, it is 11,000+ lines long
now :-) . A task for another day.
is_replaceable_p and friends is purely specific to the area of RTL expansion,
so putting it in tree-ssa.[ch] is definitely wrong. It doesn't make sense to
use it anywhere else.
The main driver of the RTL expansion process is in cfgexpand.c (the expand
pass itself) in gimple_expand_cfg. We have one header file related to
the RTL expansion process and is_replaceable_p would simply fit in
ssaexpand.h (which doesn't have a .c file, so leaving the stuff in the .c files
where they are now is ok).
So - I fear you have to re-do this patch (in a much simpler way).
Or are you suggesting we also bail on tree-ssa-ter.h and put those
prototypes in ssaexpand.h?
If we want to make this fully consistent (.h's match .c exports) , I
could put is_replaceable_p() into a new ssaexpand.c, move the 3
tree-outof-ssa prototypes in ssaexpand.h into tree-outof-ssa.h, and have
ssaexpand.h include tree-ssa-ter.h and tree-outof-ssa.h. That would
then be clean. and consistent.
actually, we could just make is_replaceable_p() static inline in
ssaexpand.h... thats not unreasonable either, but we'll probably find
functions which belong in ssaexpand.c sooner or later.
No worries, I figured these first few patches would be slower and more
painful until a reasonable formula was determined :-)