This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Cleanup tree-ssa-ter.c exports


On Thu, Sep 12, 2013 at 11:09 PM, Andrew MacLeod <amacleod@redhat.com> 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
> tree-ssa-ter.c
>
> 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).

Thanks,
Richard.







More

20 of 66


[patch] Cleanup tree-ssa-ter.c exports
Inbox
x
gcc
x

Andrew MacLeod
11:09 PM (10 hours ago)


to gcc-patches, me, Diego
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 tree-ssa-ter.c

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.

Passes bootstrap with no new regressions on x86_64-unknown-linux-gnu.
r4.diff
16K   Download

Andrew MacLeod, gcc-patches (gcc-patches@gcc.gnu.org)1 more







Saved

Why this ad?Ads –
Registry Repair Software The Trusted Registry Cleaner.
Download Now!
www.iolo.com/Registry-Repair
2.33 GB (15%) of 15 GB used
Manage
Last account activity: 17 hours ago
Details

Ads
Remove Windows Fix.
How to Remove Windows Fix. Windows Fix Removal Instructions.
www.spywareremove.com
Disk-Backup for Windows
Servers & workstations. Easy to install & restore data. Free trial.
www.backup-for-workgroups.com
BadCdDvdRecovery v.4.4
Efective recovery lost sessions Rescue, Recovery, Repair Bad CD DVD
www.badcddvdrecovery.com
WindowsXP Restore Removal
Remove Windows XP Restore Instr. How to remove Windows XP Restore.
www.wiki-security.com

> Passes bootstrap with no new regressions on x86_64-unknown-linux-gnu.
>
> Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]