[dataflow][RFC] missing update of subregs_of_mode
Seongbae Park
seongbae.park@gmail.com
Thu Mar 8 18:22:00 GMT 2007
On 3/8/07, Kenneth Zadeck <zadeck@naturalbridge.com> wrote:
> Seongbae Park wrote:
> > Attached patch fixes one regression on ia64 on dataflow branch -
> > builtins-32.c testcase in check-gcc fails.
> >
> > The patch has been bootstrapped and reg-tested on i686 and ia64.
> >
> > That said, I'm not quite sure this is the long term right approach,
> > as potentially any pass can create new subregs that need to be updated.
> >
> > As far as I can tell, the only places that use
> > regclass.c::subregs_of_mode
> > are:
> > cannot_change_mode_set_regs() and invalid_mode_change_p().
> >
> > And those are only used by local and global register allocator -
> > hence I think we can get away with building this just before
> > local-alloc only
> > - e.g. move pass_subregs_of_mode_init to just before pass_local_alloc
> > (and get rid of record_subregs_of_mode() call in combine).
> >
> > What do you think ?
> >
> > BTW, this turns out dataflow branch specific,
> > because in mainline, flow.c updates subregs_of_mode
> > (which has been changed in dataflow).
> >
> This was certainly an omission on my part. We could certainly add this
> to the rescaning. However, i actually agree that if the only used of
> this is in the register allocators, then the right thing to do is to
> make this part of the register allocators and remove the access from the
> rest of the passes.
>
> btw - did you check that none of the ports use this?
Yes. I've grepped all files and as far as I can tell,
register allocators are the only ones using it
(beside combine updating it).
I've bootstrapped & regtested it on ia64.
Below is the patch.
We may want to add this to the df scanning
(after all, it's a global characteristic of subregs)
but certainly we can do that later
and this patch won't make it any more difficult (if not easier).
Seongbae
ChangeLog entry:
2007-03-08 Seongbae Park <seongbae.park@gmail.com>
* combine.c (gen_lowpart_for_combine): Remove update
of subregs_of_mode.
* passes.c (init_optimization_passes): Move
subregs_of_mode_init just before local-alloc.
Add a new pass subregs_of_mode_finish after global-alloc.
* regclass.c (cannot_change_mode_set_regs, invalid_mode_change_p):
Add a new assert.
(finish_subregs_of_mode): New function.
(pass_subregs_of_mode_finish): New pass structure.
* tree-pass.h (pass_subregs_of_mode_finish): Declaration for
a new pass.
# HG changeset patch
# User spark@iowa
# Node ID 9d365184e83ee0279d69c096af1bb0bb23899bd0
# Parent 678bfeeff746c36220a879f3385129c646a3ae2f
Better subregs-of-mode fix by building it just before local-alloc and
destroying it right after global-alloc.
diff -r 678bfeeff746 -r 9d365184e83e gcc/combine.c
--- a/gcc/combine.c Mon Mar 05 14:15:00 2007 -0800
+++ b/gcc/combine.c Thu Mar 08 09:51:30 2007 -0800
@@ -9808,11 +9808,6 @@ gen_lowpart_for_combine (enum machine_mo
result = gen_lowpart_common (omode, x);
-#ifdef CANNOT_CHANGE_MODE_CLASS
- if (result != 0 && GET_CODE (result) == SUBREG)
- record_subregs_of_mode (result);
-#endif
-
if (result)
return result;
diff -r 678bfeeff746 -r 9d365184e83e gcc/passes.c
--- a/gcc/passes.c Mon Mar 05 14:15:00 2007 -0800
+++ b/gcc/passes.c Thu Mar 08 09:51:30 2007 -0800
@@ -714,7 +714,6 @@ init_optimization_passes (void)
NEXT_PASS (pass_rtl_dse1);
NEXT_PASS (pass_rtl_fwprop_addr);
NEXT_PASS (pass_regclass_init);
- NEXT_PASS (pass_subregs_of_mode_init);
NEXT_PASS (pass_inc_dec);
NEXT_PASS (pass_stack_ptr_mod);
NEXT_PASS (pass_initialize_regs);
@@ -730,8 +729,10 @@ init_optimization_passes (void)
NEXT_PASS (pass_see);
NEXT_PASS (pass_sms);
NEXT_PASS (pass_sched);
+ NEXT_PASS (pass_subregs_of_mode_init);
NEXT_PASS (pass_local_alloc);
NEXT_PASS (pass_global_alloc);
+ NEXT_PASS (pass_subregs_of_mode_finish);
NEXT_PASS (pass_postreload);
{
struct tree_opt_pass **p = &pass_postreload.sub;
diff -r 678bfeeff746 -r 9d365184e83e gcc/regclass.c
--- a/gcc/regclass.c Mon Mar 05 14:15:00 2007 -0800
+++ b/gcc/regclass.c Thu Mar 08 09:51:30 2007 -0800
@@ -2765,6 +2765,7 @@ cannot_change_mode_set_regs (HARD_REG_SE
unsigned char mask;
unsigned int i;
+ gcc_assert (subregs_of_mode);
dummy.block = regno & -8;
node = htab_find_with_hash (subregs_of_mode, &dummy, dummy.block);
if (node == NULL)
@@ -2790,6 +2791,7 @@ invalid_mode_change_p (unsigned int regn
enum machine_mode to;
unsigned char mask;
+ gcc_assert (subregs_of_mode);
dummy.block = regno & -8;
node = htab_find_with_hash (subregs_of_mode, &dummy, dummy.block);
if (node == NULL)
@@ -2803,9 +2805,21 @@ invalid_mode_change_p (unsigned int regn
return false;
}
+
+static unsigned int
+finish_subregs_of_mode (void)
+{
+ subregs_of_mode = 0;
+ return 0;
+}
#else
static unsigned int
init_subregs_of_mode (void)
+{
+ return 0;
+}
+static unsigned int
+finish_subregs_of_mode (void)
{
return 0;
}
@@ -2839,6 +2853,23 @@ struct tree_opt_pass pass_subregs_of_mod
0 /* letter */
};
+struct tree_opt_pass pass_subregs_of_mode_finish =
+{
+ "subregs_of_mode_finish", /* name */
+ gate_subregs_of_mode_init, /* gate */
+ finish_subregs_of_mode, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
+ 0 /* letter */
+};
+
#include "gt-regclass.h"
diff -r 678bfeeff746 -r 9d365184e83e gcc/tree-pass.h
--- a/gcc/tree-pass.h Mon Mar 05 14:15:00 2007 -0800
+++ b/gcc/tree-pass.h Thu Mar 08 09:51:30 2007 -0800
@@ -370,6 +370,7 @@ extern struct tree_opt_pass pass_df_init
extern struct tree_opt_pass pass_df_initialize;
extern struct tree_opt_pass pass_regclass_init;
extern struct tree_opt_pass pass_subregs_of_mode_init;
+extern struct tree_opt_pass pass_subregs_of_mode_finish;
extern struct tree_opt_pass pass_inc_dec;
extern struct tree_opt_pass pass_no_new_pseudos;
extern struct tree_opt_pass pass_stack_ptr_mod;
More information about the Gcc-patches
mailing list