RE: [PATCH RFA] Implement register pressure directed hoist pass

2012-10-18 Thread Bin Cheng


> -Original Message-
> From: Jeff Law [mailto:l...@redhat.com]
> Sent: Wednesday, October 17, 2012 1:02 AM
> To: Bin Cheng
> Cc: 'Steven Bosscher'; gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH RFA] Implement register pressure directed hoist pass
> 
> On 10/16/2012 01:44 AM, Bin Cheng wrote:
> > Hi Steven, Jeff,
> > I found a flaw in original patch, which results in inaccurate register
> > pressure.
> > Here comes the updated patches, improving code size a little bit on
> > Thumb2/powerpc comparing to original patches.
> > Please review.
> >
> > Thanks
> >
> > 2012-10-16  Bin Cheng
> >
> > * gcse.c: Update copyright dates.
> > (hoist_expr_reaches_here_p): Change parameter type from char *
> > to sbitmap.
> >
> > 2012-10-16  Bin Cheng
> >
> > * common.opt (flag_ira_hoist_pressure): New.
> > * doc/invoke.texi (-fira-hoist-pressure): Describe.
> > * ira-costs.c (ira_set_pseudo_classes): New parameter.
> > * ira.h: Update copyright dates.
> > (ira_set_pseudo_classes): Update prototype.
> > * haifa-sched.c (sched_init): Update call.
> > * ira.c (ira): Update call.
> > * regmove.c: Update copyright dates.
> > (regmove_optimize): Update call.
> > * loop-invariant.c: Update copyright dates.
> > (move_loop_invariants): Update call.
> > * gcse.c: (struct bb_data): New structure.
> > (BB_DATA): New macro.
> > (curr_bb, curr_reg_pressure): New static variables.
> > (should_hoist_expr_to_dom): Rename from hoist_expr_reaches_here_p.
> > Change parameter expr_index to expr.
> > New parameters pressure_class, nregs and hoisted_bbs.
> > Use reg pressure to determine the distance expr can be hoisted.
> > (hoist_code): Use reg pressure to direct the hoist process.
> > (get_regno_pressure_class, get_pressure_class_and_nregs)
> > (change_pressure, calculate_bb_reg_pressure): New.
> > (one_code_hoisting_pass): Calculate register pressure. Allocate
> > and free data.
> 
> 
> 
> > +
> > + /* Currently register pressure for each pressure class.  */ static
> > + int curr_reg_pressure[N_REG_CLASSES];
> "Currently" -> "Current"
> 
> OK for the mainline sources.
> 

Committed to trunk as r192603/r192604, after re-testing against recent trunk
codes.

Thanks.





Re: [PATCH RFA] Implement register pressure directed hoist pass

2012-10-16 Thread Jeff Law

On 10/16/2012 01:44 AM, Bin Cheng wrote:

Hi Steven, Jeff,
I found a flaw in original patch, which results in inaccurate register
pressure.
Here comes the updated patches, improving code size a little bit on
Thumb2/powerpc comparing to original patches.
Please review.

Thanks

2012-10-16  Bin Cheng

* gcse.c: Update copyright dates.
(hoist_expr_reaches_here_p): Change parameter type from char *
to sbitmap.

2012-10-16  Bin Cheng

* common.opt (flag_ira_hoist_pressure): New.
* doc/invoke.texi (-fira-hoist-pressure): Describe.
* ira-costs.c (ira_set_pseudo_classes): New parameter.
* ira.h: Update copyright dates.
(ira_set_pseudo_classes): Update prototype.
* haifa-sched.c (sched_init): Update call.
* ira.c (ira): Update call.
* regmove.c: Update copyright dates.
(regmove_optimize): Update call.
* loop-invariant.c: Update copyright dates.
(move_loop_invariants): Update call.
* gcse.c: (struct bb_data): New structure.
(BB_DATA): New macro.
(curr_bb, curr_reg_pressure): New static variables.
(should_hoist_expr_to_dom): Rename from hoist_expr_reaches_here_p.
Change parameter expr_index to expr.
New parameters pressure_class, nregs and hoisted_bbs.
Use reg pressure to determine the distance expr can be hoisted.
(hoist_code): Use reg pressure to direct the hoist process.
(get_regno_pressure_class, get_pressure_class_and_nregs)
(change_pressure, calculate_bb_reg_pressure): New.
(one_code_hoisting_pass): Calculate register pressure. Allocate
and free data.





+
+ /* Currently register pressure for each pressure class.  */
+ static int curr_reg_pressure[N_REG_CLASSES];

"Currently" -> "Current"

OK for the mainline sources.

Thanks for your patience,
Jeff


RE: [PATCH RFA] Implement register pressure directed hoist pass

2012-10-16 Thread Bin Cheng
Hi Steven, Jeff,
I found a flaw in original patch, which results in inaccurate register
pressure.
Here comes the updated patches, improving code size a little bit on
Thumb2/powerpc comparing to original patches.
Please review.

Thanks

2012-10-16  Bin Cheng  

* gcse.c: Update copyright dates.
(hoist_expr_reaches_here_p): Change parameter type from char *
to sbitmap.

2012-10-16  Bin Cheng  

* common.opt (flag_ira_hoist_pressure): New.
* doc/invoke.texi (-fira-hoist-pressure): Describe.
* ira-costs.c (ira_set_pseudo_classes): New parameter.
* ira.h: Update copyright dates.
(ira_set_pseudo_classes): Update prototype.
* haifa-sched.c (sched_init): Update call.
* ira.c (ira): Update call.
* regmove.c: Update copyright dates.
(regmove_optimize): Update call.
* loop-invariant.c: Update copyright dates.
(move_loop_invariants): Update call.
* gcse.c: (struct bb_data): New structure.
(BB_DATA): New macro.
(curr_bb, curr_reg_pressure): New static variables.
(should_hoist_expr_to_dom): Rename from hoist_expr_reaches_here_p.
Change parameter expr_index to expr.
New parameters pressure_class, nregs and hoisted_bbs.
Use reg pressure to determine the distance expr can be hoisted.
(hoist_code): Use reg pressure to direct the hoist process.
(get_regno_pressure_class, get_pressure_class_and_nregs)
(change_pressure, calculate_bb_reg_pressure): New.
(one_code_hoisting_pass): Calculate register pressure. Allocate
and free data.

gcc/testsuite/ChangeLog
2012-10-16  Bin Cheng  

* testsuite/gcc.dg/hoist-register-pressure.c: New test.


> -Original Message-
> From: gcc-patches-ow...@gcc.gnu.org [mailto:gcc-patches-ow...@gcc.gnu.org]
On
> Behalf Of Bin Cheng
> Sent: Friday, October 12, 2012 4:09 PM
> To: 'Steven Bosscher'
> Cc: Jeff Law; gcc-patches@gcc.gnu.org
> Subject: RE: [PATCH RFA] Implement register pressure directed hoist pass
> 
> Hi,
> This is the updated patches split from original one according to Steven's
> suggestion. Also fixed spelling errors.
> 
> Apart from this, I also implemented a draft patch simulating register
pressure
> accurately during hoisting, unfortunately the size data isn't better than
this
> patch. If it's right, this can prove my previous observation that decrease
of
> register pressure during hoisting process is rare. I will continue
> investigating the correctness of the patch and see what I can get.
> 
> Please review. Thanks
> 
> And the ChangeLog:
> 
> 2012-10-12  Bin Cheng  
> 
>   * gcse.c: Update copyright dates.
>   (hoist_expr_reaches_here_p): Change parameter type from char *
>   to sbitmap.
> 
> 2012-10-12  Bin Cheng  
> 
>   * common.opt (flag_ira_hoist_pressure): New.
>   * doc/invoke.texi (-fira-hoist-pressure): Describe.
>   * ira-costs.c (ira_set_pseudo_classes): New parameter.
>   * ira.h: Update copyright dates.
>   (ira_set_pseudo_classes): Update prototype.
>   * haifa-sched.c (sched_init): Update call.
>   * ira.c (ira): Update call.
>   * regmove.c: Update copyright dates.
>   (regmove_optimize): Update call.
>   * loop-invariant.c: Update copyright dates.
>   (move_loop_invariants): Update call.
>   * gcse.c: (struct bb_data): New structure.
>   (BB_DATA): New macro.
>   (curr_bb, curr_reg_pressure): New static variables.
>   (should_hoist_expr_to_dom): Rename from hoist_expr_reaches_here_p.
>   Change parameter expr_index to expr.
>   New parameters pressure_class, nregs and hoisted_bbs.
>   Use reg pressure to determine the distance expr can be hoisted.
>   (hoist_code): Use reg pressure to direct the hoist process.
>   (get_regno_pressure_class, get_pressure_class_and_nregs)
>   (change_pressure, calculate_bb_reg_pressure): New.
>   (one_code_hoisting_pass): Calculate register pressure. Allocate
>   and free data.
> 
> gcc/testsuite/ChangeLog
> 2012-10-12  Bin Cheng  
> 
>   * testsuite/gcc.dg/hoist-register-pressure.c: New test.diff -x .svn -rpN wc1/gcc/common.opt wc2/gcc/common.opt
*** wc1/gcc/common.opt  2012-10-12 15:13:41.679617846 +0800
--- wc2/gcc/common.opt  2012-10-16 15:19:35.231674135 +0800
*** Enum(ira_region) String(all) Value(IRA_R
*** 1392,1397 
--- 1392,1402 
  EnumValue
  Enum(ira_region) String(mixed) Value(IRA_REGION_MIXED)
  
+ fira-hoist-pressure
+ Common Report Var(flag_ira_hoist_pressure) Init(1) Optimization
+ Use IRA based register pressure calculation
+ in RTL hoist optimizations.
+ 
  fira-loop-pressure
  Common Report Var(flag_ira_loop_pressure)
  Use IRA based register pressure calculation
di

RE: [PATCH RFA] Implement register pressure directed hoist pass

2012-10-12 Thread Bin Cheng
Hi,
This is the updated patches split from original one according to Steven's
suggestion. Also fixed spelling errors.

Apart from this, I also implemented a draft patch simulating register
pressure accurately during hoisting, unfortunately the size data isn't
better than this patch. If it's right, this can prove my previous
observation that decrease of register pressure during hoisting process is
rare. I will continue investigating the correctness of the patch and see
what I can get.

Please review. Thanks

And the ChangeLog:

2012-10-12  Bin Cheng  

* gcse.c: Update copyright dates.
(hoist_expr_reaches_here_p): Change parameter type from char *
to sbitmap.

2012-10-12  Bin Cheng  

* common.opt (flag_ira_hoist_pressure): New.
* doc/invoke.texi (-fira-hoist-pressure): Describe.
* ira-costs.c (ira_set_pseudo_classes): New parameter.
* ira.h: Update copyright dates.
(ira_set_pseudo_classes): Update prototype.
* haifa-sched.c (sched_init): Update call.
* ira.c (ira): Update call.
* regmove.c: Update copyright dates.
(regmove_optimize): Update call.
* loop-invariant.c: Update copyright dates.
(move_loop_invariants): Update call.
* gcse.c: (struct bb_data): New structure.
(BB_DATA): New macro.
(curr_bb, curr_reg_pressure): New static variables.
(should_hoist_expr_to_dom): Rename from hoist_expr_reaches_here_p.
Change parameter expr_index to expr.
New parameters pressure_class, nregs and hoisted_bbs.
Use reg pressure to determine the distance expr can be hoisted.
(hoist_code): Use reg pressure to direct the hoist process.
(get_regno_pressure_class, get_pressure_class_and_nregs)
(change_pressure, calculate_bb_reg_pressure): New.
(one_code_hoisting_pass): Calculate register pressure. Allocate
and free data.

gcc/testsuite/ChangeLog
2012-10-12  Bin Cheng  

* testsuite/gcc.dg/hoist-register-pressure.c: New test.
Index: gcc/gcse.c
===
--- gcc/gcse.c  (revision 192194)
+++ gcc/gcse.c  (working copy)
@@ -1,6 +1,6 @@
 /* Partial redundancy elimination / Hoisting for RTL.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -460,7 +460,7 @@ static void alloc_code_hoist_mem (int, int);
 static void free_code_hoist_mem (void);
 static void compute_code_hoist_vbeinout (void);
 static void compute_code_hoist_data (void);
-static int hoist_expr_reaches_here_p (basic_block, int, basic_block, char *,
+static int hoist_expr_reaches_here_p (basic_block, int, basic_block, sbitmap,
  int, int *);
 static int hoist_code (void);
 static int one_code_hoisting_pass (void);
@@ -2842,7 +2842,7 @@ compute_code_hoist_data (void)
 
 static int
 hoist_expr_reaches_here_p (basic_block expr_bb, int expr_index, basic_block bb,
-  char *visited, int distance, int *bb_size)
+  sbitmap visited, int distance, int *bb_size)
 {
   edge pred;
   edge_iterator ei;
@@ -2863,7 +2863,8 @@ hoist_expr_reaches_here_p (basic_block expr_bb, in
   if (visited == NULL)
 {
   visited_allocated_locally = 1;
-  visited = XCNEWVEC (char, last_basic_block);
+  visited = sbitmap_alloc (last_basic_block);
+  sbitmap_zero (visited);
 }
 
   FOR_EACH_EDGE (pred, ei, bb->preds)
@@ -2874,7 +2875,7 @@ hoist_expr_reaches_here_p (basic_block expr_bb, in
break;
   else if (pred_bb == expr_bb)
continue;
-  else if (visited[pred_bb->index])
+  else if (TEST_BIT (visited, pred_bb->index))
continue;
 
   else if (! TEST_BIT (transp[pred_bb->index], expr_index))
@@ -2883,14 +2884,14 @@ hoist_expr_reaches_here_p (basic_block expr_bb, in
   /* Not killed.  */
   else
{
- visited[pred_bb->index] = 1;
+ SET_BIT (visited, pred_bb->index);
  if (! hoist_expr_reaches_here_p (expr_bb, expr_index, pred_bb,
   visited, distance, bb_size))
break;
}
 }
   if (visited_allocated_locally)
-free (visited);
+sbitmap_free (visited);
 
   return (pred == NULL);
 }
diff -x .svn -rpN wc1/gcc/common.opt wc2/gcc/common.opt
*** wc1/gcc/common.opt  2012-10-12 15:13:41.679617846 +0800
--- wc2/gcc/common.opt  2012-10-12 15:12:15.614174292 +0800
*** Enum(ira_region) String(all) Value(IRA_R
*** 1392,1397 
--- 1392,1402 
  EnumValue
  Enum(ira_region) String(mixed) Value(IRA_REGION_MIXED)
  
+ fira-hoist-pressure
+ Common Report Var(flag_ira_hoist_pressure) Init(1) Optimization
+ Use IRA based register pressure calculation
+ in RTL hoist optimizations.
+ 
  fira-lo

RE: [PATCH RFA] Implement register pressure directed hoist pass

2012-10-11 Thread Bin Cheng


> -Original Message-
> From: Steven Bosscher [mailto:stevenb@gmail.com]
> Sent: Friday, October 12, 2012 7:04 AM
> To: Bin Cheng
> Cc: Jeff Law; gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH RFA] Implement register pressure directed hoist pass
> 
> On Thu, Oct 11, 2012 at 8:50 AM, Bin Cheng wrote:
> 
> > +  /* x+y won't be hoisted without defaultly enabled
> > + "-fira-hoist-pressure",
> 
> defaulty comment.
> 
> > + kinds of code motion(including code hoisting) in a unified way.
> 
> needs space between "motion" and "(".
> 
> > +   flow graph, given if it can reach BB unimpared.  Stop the search
> > + if the
> 
> s/given if/if/
> 
> 
> > +should_hoist_expr_to_dom (basic_block expr_bb, struct expr *expr,
> > + basic_block bb, sbitmap visited, int distance,
> > + int *bb_size, enum reg_class pressure_class,
> > + int *nregs, bitmap hoisted_bbs)
> 
> At least BB_SIZE and DISTANCE are not documented (also not before your
patch).
> While there, can you document these please?
> 
> 
> > +becasue hoisting constant expr aggresively results in worse code
> > +as observed.  */
> 
> s/becasue/because/
> s/aggresively/aggressively/
> 
> Not sure what you mean with "as observed". Observed where/how?
> 
> > -  visited = XCNEWVEC (char, last_basic_block);
> > +  visited = sbitmap_alloc (last_basic_block);
> > +  sbitmap_zero (visited);
> 
> Send a separate patch for this change please. Really. Reviewing patches is
> much easier if you post things one change at a time.
> 
> 
> > +   The code hoisting pass hoists multiple computations of expression
> > +   to dominator basic block, like from b2/b3 to b1 as depicted below:
> 
> "The code hoisting pass can hoist multiple computations of the same
expression
> along dominated paths to a dominating basic block, like from ..."
> 
> 
> > +   Unfortunately code hoisting generally extend live range of output
> 
> s/extend/extends the/
> s/of output/of an output/
> 
> 
> > +   from rtx cost of corresponding expression and it's used to control
> 
> s/of corresponding/of the corresponding/ Similarly elsewhere in comments.
> 
> 
> > +   of shrinked live range of input pseudo register when hoisting an
> 
> s/range/ranges/
> s/register/registers/
> After all this is only possible, AFAICT, if there's more than one input
> register.
> 
> I'll leave all the algorithmic stuff to Jeff...

Very sorry I didn't realize there are so many language errors. Since English
is not my native language, I will pay more attention to comments in the
future.

Thanks very much for your patient.





Re: [PATCH RFA] Implement register pressure directed hoist pass

2012-10-11 Thread Steven Bosscher
On Thu, Oct 11, 2012 at 8:50 AM, Bin Cheng wrote:

> +  /* x+y won't be hoisted without defaultly enabled "-fira-hoist-pressure",

defaulty comment.

> + kinds of code motion(including code hoisting) in a unified way.

needs space between "motion" and "(".

> +   flow graph, given if it can reach BB unimpared.  Stop the search if the

s/given if/if/


> +should_hoist_expr_to_dom (basic_block expr_bb, struct expr *expr,
> +   basic_block bb, sbitmap visited, int distance,
> +   int *bb_size, enum reg_class pressure_class,
> +   int *nregs, bitmap hoisted_bbs)

At least BB_SIZE and DISTANCE are not documented (also not before your
patch). While there, can you document these please?


> +  becasue hoisting constant expr aggresively results in worse code
> +  as observed.  */

s/becasue/because/
s/aggresively/aggressively/

Not sure what you mean with "as observed". Observed where/how?

> -  visited = XCNEWVEC (char, last_basic_block);
> +  visited = sbitmap_alloc (last_basic_block);
> +  sbitmap_zero (visited);

Send a separate patch for this change please. Really. Reviewing
patches is much easier if you post things one change at a time.


> +   The code hoisting pass hoists multiple computations of expression
> +   to dominator basic block, like from b2/b3 to b1 as depicted below:

"The code hoisting pass can hoist multiple computations of the same
expression along dominated paths to a dominating basic block, like
from ..."


> +   Unfortunately code hoisting generally extend live range of output

s/extend/extends the/
s/of output/of an output/


> +   from rtx cost of corresponding expression and it's used to control

s/of corresponding/of the corresponding/
Similarly elsewhere in comments.


> + of shrinked live range of input pseudo register when hoisting an

s/range/ranges/
s/register/registers/
After all this is only possible, AFAICT, if there's more than one
input register.

I'll leave all the algorithmic stuff to Jeff...

Ciao!
Steven


RE: [PATCH RFA] Implement register pressure directed hoist pass

2012-10-10 Thread Bin Cheng
Hi Jeff, Steven,

This is the updated patch according to your comments. The main changes
includes:
1. Enable the option for all target at Os level by default.
2. Add a target independent test case.
3. Add comments on how the algorithm works.
4. Simplify the calculation of register pressure info by using DF caches.

Jeff, as for accurately simulating the change of register pressure made by
hoisting expression, I explained a little in previous message. According to
observation, cases in which register pressure decreases are relatively rare,
so this patch does not implement it. I can continue to improve code hoisting
that way in the future.

I bootstrapped it on x86_64 and x86, also tested on x86_64/x86/arm.
I recollected size info for CSiBE on miscellaneous targets as following:
improvement
ARM 0.12%
Thumb1  0.13%
mips0.24%
powerpc 0.59%
Thumb2  X
x86 X
x86_64  X
(X means no obvious effect, unfortunately.)

Also, since this is the simplification of previous patch, I think there is
no slowdown in compilation.
 
Please review. Thanks.

And updated ChangeLog entry:

2012-10-11  Bin Cheng  

* common.opt (flag_ira_hoist_pressure): New.
* doc/invoke.texi (-fira-hoist-pressure): Describe.
* ira-costs.c (ira_set_pseudo_classes): New parameter.
* ira.h: Update copyright dates.
(ira_set_pseudo_classes): Update prototype.
* haifa-sched.c (sched_init): Update call.
* ira.c (ira): Update call.
* regmove.c: Update copyright dates.
(regmove_optimize): Update call.
* loop-invariant.c: Update copyright dates.
(move_loop_invariants): Update call.
* gcse.c: Update copyright dates.
(struct bb_data): New structure.
(BB_DATA): New macro.
(curr_bb, curr_reg_pressure): New static variables.
(should_hoist_expr_to_dom): Rename from hoist_expr_reaches_here_p.
Change parameter expr_index to expr.
Change parameter visited.
New parameters pressure_class, nregs and hoisted_bbs.
Use reg pressure to determine the distance expr can be hoisted.
(hoist_code): Use reg pressure to direct the hoist process.
(get_regno_pressure_class, get_pressure_class_and_nregs)
(change_pressure, calculate_bb_reg_pressure): New.
(one_code_hoisting_pass): Calculate register pressure. Allocate
and free data.

gcc/testsuite/ChangeLog
2012-10-11  Bin Cheng  

* testsuite/gcc.dg/hoist-register-pressure.c: New test.


> -Original Message-
> From: Jeff Law [mailto:l...@redhat.com]
> Sent: Tuesday, October 02, 2012 8:58 PM
> To: Bin Cheng
> Cc: 'Steven Bosscher'; gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH RFA] Implement register pressure directed hoist pass
> 
> On 09/29/2012 12:37 AM, Bin Cheng wrote:
> > Hi Steven,
> >
> > This is the updated patch according to your comments. Please review.
> > I also re-collected code size data and found it is improved by about
> > 0.24% for mips, which is better than previous data. I believe this
> > should be caused by recent changes in trunk, rather than by using DF
> > caches to calculate register pressure.
> >
> > Thanks.
> >
> > 2012-09-29  Bin Cheng
> >
> > * common.opt (flag_ira_hoist_pressure): New.
> > * doc/invoke.texi (-fira-hoist-pressure): Describe.
> > * ira-costs.c (ira_set_pseudo_classes): New parameter.
> > * ira.h (ira_set_pseudo_classes): Update prototype.
> > * haifa-sched.c (sched_init): Update call.
> > * ira.c (ira): Update call.
> > * regmove.c (regmove_optimize): Update call.
> > * loop-invariant.c (move_loop_invariants): Update call.
> > * gcse.c (struct bb_data): New structure.
> > (BB_DATA): New macro.
> > (curr_bb, curr_regs_live, curr_reg_pressure, regs_set)
> > (n_regs_set): New static variables.
> > (hoist_expr_reaches_here_p): Use reg pressure to determine the
> > distance expr can be hoisted.
> > (hoist_code): Use reg pressure to direct the hoist process.
> > (get_regno_pressure_class, get_pressure_class_and_nregs)
> > (change_pressure, mark_regno_live, mark_regno_death)
> > (mark_reg_death, mark_reg_store, calculate_bb_reg_pressure): New.
> > (one_code_hoisting_pass): Calculate register pressure. Free data.
> > * config/arm/arm.c (arm_option_override): Set
flag_ira_hoist_pressure
> > on Thumb1 when optimizing for size.
> >
> >
> > hoist-reg-pressure-20120929.txt
> > +@item -fira-hoist-pressure
> > +@opindex fira-hoist-pressure
> > +Use IRA to evaluate register pressure in hoist pass for decisions to
hoist
> > +expressions.  This option usually 

RE: [PATCH RFA] Implement register pressure directed hoist pass

2012-10-07 Thread Bin Cheng
Hi Jeff,
Thanks for reviewing and sorry for this delayed message.

> 
> > +  /* Only decrease distance if bb has high register pressure or
EXPR
> > +is const expr, otherwise EXPR can be hoisted through bb without
> > +cost.  */
> ?!?  This comment makes no sense to me.  To accurately know how hoisting
> an expression affects pressure you have to look at the inputs and output
> and see how their lifetime has changed.
> 
> In general:
> 
> For inputs, hoisting *may* reduce pressure.  You really have to look at
> how the life of the input changes based on the new location of the insn.
>   For example, if the input's lifetime is unchanged (say perhaps because
> it was live after the insn we want to hoist), then hoisting will have no
> impact. Otherwise the input's life is shortened, but to know by how much
> you have to determine whether the new death of the input occurs (it may
> still die in the hoisted insn or it may die elsewhere).
> 
> For an output, hoisting will (effectively) always extend the lifetime.
> 
> I've speculated that the right way to deal with register pressure in
> code motion is to actually build the dependency graph and use that to
> guide the code motions.  I've never cobbled together any real code to do
> this though.

Yes, that's exactly what I mean "simulate register pressure change of each
basic block accurately" in the patch. The current patch works in the way it
only extend the lifetime of output registers of hoisted expressions, while
does not consider the possibility of decreasing of register pressure because
of input registers. The rationales are:
1. Calculation live range info and maintain of the info during hoisting
process are very costly.
2. From the observation during the work, I found most of expression hoisted
are constants and base-addresses, means the possibility of decreasing
register pressure in hoisting expression is relatively low.

This patch does not decrease distance if the basic block's register pressure
is low, making the expression can be hoisted up in flow graph longer. When
register pressure is high, the patch retreats to original algorithm.

Also I observed lots of size regressions by hoisting constant expressions
aggressively along with other expressions, so the patch uses original
heuristic for constant expressions.

> > @@ -2863,7 +2909,8 @@ static int
> > if (visited == NULL)
> >   {
> > visited_allocated_locally = 1;
> > -  visited = XCNEWVEC (char, last_basic_block);
> > +  visited = sbitmap_alloc (last_basic_block);
> > +  sbitmap_zero (visited);
> >   }
> What's the purpose behind changing visited from a simple array to a
> sbitmap?  I'm not objecting, but would like to hear the rationale behind
> that change.  I'll also note it wasn't mentioned in the ChangeLog.

Because I have to iterate over visited basic blocks to update register
pressure information, the operation is less effective on integer array.
Maybe I should submit this as a separate patch as suggested by Steven.

> 
> Similarly what's the rationale behind passing the expression itself
> rather than just its index?  I don't see where we need to use anything
> other than the index in this code.  And again, this change isn't
> mentioned in the ChangeLog.

The expression itself is needed to check "CONST_INT_P (expr->expr)".

> 
> > +  /* Considered invariant insns have only one set.  */
> > +  gcc_assert (set != NULL_RTX);
> > +  reg = SET_DEST (set);
> > +  if (GET_CODE (reg) == SUBREG)
> > +reg = SUBREG_REG (reg);
> > +  if (MEM_P (reg))
> > +{
> > +  *nregs = 0;
> > +  pressure_class = NO_REGS;
> > +}
> Don't you need to look at the addresses within the MEM?

This function is a copy from register pressure calculation code in
loop-invariant.c
I think MEM should be ignored here, because as in function hash_scan_set, we
won't honor stores in memory when flag_gcse_las is not enabled. 

> 
> > Index: gcc/config/arm/arm.c
> > ===
> > --- gcc/config/arm/arm.c(revision 191816)
> > +++ gcc/config/arm/arm.c(working copy)
> > @@ -2021,6 +2021,11 @@ arm_option_override (void)
> > && current_tune->num_prefetch_slots > 0)
> >   flag_prefetch_loop_arrays = 1;
> >
> > +  /* Enable register pressure hoist when optimizing for size on Thumb1
set.
> */
> > +  if (TARGET_THUMB1 && optimize_function_for_size_p (cfun)
> > +  && flag_ira_hoist_pressure == -1)
> > +flag_ira_hoist_pressure = 1;
> I'd rather see this enabled for all targets when optimizing for size;
> that guarantees more testing.  Even if it doesn't help a particular
> target, as long as it isn't hurting we're better off enabling it.

I will collect size data for more targets.

> 
> I don't see any testsuite additions -- it'd really help long term to
> have some tests for this stuff.

It's some kind of difficult to create stable cases for hoist, especially
having register pressure information i

RE: [PATCH RFA] Implement register pressure directed hoist pass

2012-10-07 Thread Bin Cheng
Hi Steven,
Thanks for the comments and sorry for the delay with this message.

> -Original Message-
> 
> Hello,
> 
> Thanks for the update. The first look wasn't a very thorough review, so I
have
> more comments now. Sorry for that, I should have taken the time for this
the
> first time round...

It's OK.

> > -   - do rough calc of how many regs are needed in each block, and a
rough
> > - calc of how many regs are available in each class and use that to
> > - throttle back the code in cases where RTX_COST is minimal.
> 
> This comment still applies to LCM.

It seems this comment just express the idea using register pressure
information to direct code movement for expressions with small
RTX_COST(max_distance). But the threshold of max_distance is only
implemented for hoist in GCC, I assume this comment does not affect LCM.
Could you explain more how this comments applies to LCM?

> But then again...
> 
> > + while (n_regs_set-- > 0)
> > +   {
> > + rtx note = find_regno_note (insn, REG_UNUSED,
> > + REGNO (regs_set[n_regs_set]));
> > + if (! note)
> > +   continue;
> > +
> > + mark_reg_death (XEXP (note, 0));
> > +   }
> 
> Why not just mark all registers mentioned in REG_UNUSED notes as death,
i.e.:
> 
> for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
>   if ((REG_NOTE_KIND (note) == REG_UNUSED)
> mark_reg_death (XEXP (note, 0));
> 
> ?

I don't know the exact reason, can only guess REG_UNUSED notes are recorded
only for set registers here. Since this calculation code is a copy of
existing codes, maybe Vlad can help explain this? Thanks.

> 
> 
> > +fira-hoist-pressure
> > +Common Report Var(flag_ira_hoist_pressure) Init(-1) Use IRA based
> > +register pressure calculation in hoist optimizations.
> 
> Please add the "Optimization" marker. Why initialize to -1? The default
> initialization is 0, and if the flag is set it takes a value 1. If you
follow
> that common behavior, you can replace all occurrences of "if
> (flag_ira_hoist_pressure == 1)" with just ""if (flag_ira_hoist_pressure)".
> 

The reason is because we only want to enable this for Thumb1 originally, and
make it possible to disable it for Thumb1 on command line by specifying
"-fno-ira-hoist-pressure".

> 
> > +  /* Enable register pressure hoist when optimizing for size on
> > + Thumb1 set.  */  if (TARGET_THUMB1 && optimize_function_for_size_p
(cfun)
> > +  && flag_ira_hoist_pressure == -1)
> > +flag_ira_hoist_pressure = 1;
> 
> One would expect this to be a win on all targets, but you probably looked
at
> this (at least Thumb2 and plain ARM). Did your patch not help there?
Otherwise,
> I'd be in favor of enabling this option by default for all targets.

>From the data I collected, it helps for Thumb1/ARM/Mips and maybe x86_64 a
little bit. It has no obvious effect on Thumb2/x86.
Since Jeff also expressed that it might be enabled for all targets, I will
collect size data for more targets. Your previous concern will also be
addressed in this way.

> 
> 
> > +  reg = SET_DEST (set);
> > +  if (GET_CODE (reg) == SUBREG)
> > +reg = SUBREG_REG (reg);
> > +  if (MEM_P (reg))
> > +{
> > +  *nregs = 0;
> > +  pressure_class = NO_REGS;
> > +}
> > +  else
> > +{
> > +  if (! REG_P (reg))
> > +   reg = NULL_RTX;
> > +  if (reg == NULL_RTX)
> > +   pressure_class = GENERAL_REGS;
> 
> gcc_assert (REG_P (reg))? If reg is not a MEM, it must be a REG or it's
not
> recorded in compute_hash_table. In fact, AFAIR reg must be a REG unless
> flag_gcse_las is set, and I don't know if that even works with code
hoisting.
> It's not a particularly well tested flag (although it's a very useful one
for
> most RISC targets, maybe you should have a look at that, too, for ARM
> variants).

Again, it is a copy from loop-invariant.c. It might be rewritten/optimized
for hoist, but should we keep it same with original copy in
loop-invariant.c?

> 
> Ciao!
> Steven

Thanks again for your review, all other comments are accepted and I will
work out an updated patch for review.






Re: [PATCH RFA] Implement register pressure directed hoist pass

2012-10-02 Thread Jeff Law

On 09/29/2012 12:37 AM, Bin Cheng wrote:

Hi Steven,

This is the updated patch according to your comments. Please review.
I also re-collected code size data and found it is improved by about 0.24%
for mips, which is better than previous data. I believe this should be
caused by recent changes in trunk, rather than by using DF caches to
calculate register pressure.

Thanks.

2012-09-29  Bin Cheng

* common.opt (flag_ira_hoist_pressure): New.
* doc/invoke.texi (-fira-hoist-pressure): Describe.
* ira-costs.c (ira_set_pseudo_classes): New parameter.
* ira.h (ira_set_pseudo_classes): Update prototype.
* haifa-sched.c (sched_init): Update call.
* ira.c (ira): Update call.
* regmove.c (regmove_optimize): Update call.
* loop-invariant.c (move_loop_invariants): Update call.
* gcse.c (struct bb_data): New structure.
(BB_DATA): New macro.
(curr_bb, curr_regs_live, curr_reg_pressure, regs_set)
(n_regs_set): New static variables.
(hoist_expr_reaches_here_p): Use reg pressure to determine the
distance expr can be hoisted.
(hoist_code): Use reg pressure to direct the hoist process.
(get_regno_pressure_class, get_pressure_class_and_nregs)
(change_pressure, mark_regno_live, mark_regno_death)
(mark_reg_death, mark_reg_store, calculate_bb_reg_pressure): New.
(one_code_hoisting_pass): Calculate register pressure. Free data.
* config/arm/arm.c (arm_option_override): Set
flag_ira_hoist_pressure
on Thumb1 when optimizing for size.


hoist-reg-pressure-20120929.txt
+@item -fira-hoist-pressure
+@opindex fira-hoist-pressure
+Use IRA to evaluate register pressure in hoist pass for decisions to hoist
+expressions.  This option usually results in generation of smaller code on
+RISC machines, but it can slow the compiler down.
I wouldn't use CISC/RISC here; I'd just say it usually results in 
smaller code.


You need to update the copyright year in gcse.c, ira.h, regmove.c, and 
loop-invariant.c.



+  /* Only decrease distance if bb has high register pressure or EXPR
+is const expr, otherwise EXPR can be hoisted through bb without
+cost.  */
?!?  This comment makes no sense to me.  To accurately know how hoisting 
an expression affects pressure you have to look at the inputs and output 
and see how their lifetime has changed.


In general:

For inputs, hoisting *may* reduce pressure.  You really have to look at 
how the life of the input changes based on the new location of the insn. 
 For example, if the input's lifetime is unchanged (say perhaps because 
it was live after the insn we want to hoist), then hoisting will have no 
impact. Otherwise the input's life is shortened, but to know by how much 
you have to determine whether the new death of the input occurs (it may 
still die in the hoisted insn or it may die elsewhere).


For an output, hoisting will (effectively) always extend the lifetime.

I've speculated that the right way to deal with register pressure in 
code motion is to actually build the dependency graph and use that to 
guide the code motions.  I've never cobbled together any real code to do 
this though.


Can we find a better name for hoist_expr_reaches_here_p since it's no 
longer just dealing with reachability -- it has heuristics now for 
profitability as well.



@@ -2863,7 +2909,8 @@ static int
if (visited == NULL)
  {
visited_allocated_locally = 1;
-  visited = XCNEWVEC (char, last_basic_block);
+  visited = sbitmap_alloc (last_basic_block);
+  sbitmap_zero (visited);
  }
What's the purpose behind changing visited from a simple array to a 
sbitmap?  I'm not objecting, but would like to hear the rationale behind 
that change.  I'll also note it wasn't mentioned in the ChangeLog.


Similarly what's the rationale behind passing the expression itself 
rather than just its index?  I don't see where we need to use anything 
other than the index in this code.  And again, this change isn't 
mentioned in the ChangeLog.



+  /* Considered invariant insns have only one set.  */
+  gcc_assert (set != NULL_RTX);
+  reg = SET_DEST (set);
+  if (GET_CODE (reg) == SUBREG)
+reg = SUBREG_REG (reg);
+  if (MEM_P (reg))
+{
+  *nregs = 0;
+  pressure_class = NO_REGS;
+}

Don't you need to look at the addresses within the MEM?




Index: gcc/config/arm/arm.c
===
--- gcc/config/arm/arm.c(revision 191816)
+++ gcc/config/arm/arm.c(working copy)
@@ -2021,6 +2021,11 @@ arm_option_override (void)
&& current_tune->num_prefetch_slots > 0)
  flag_prefetch_loop_arrays = 1;

+  /* Enable register pressure hoist when optimizing for size on Thumb1 set.  */
+  if (TARGET_THUMB1 && optimize_function_for_size_p (cfun)
+  && flag_ira_hoist_pressure == -1)
+flag_ira_hoist_pressure = 1;
I'd rather see this enable

Re: [PATCH RFA] Implement register pressure directed hoist pass

2012-10-01 Thread Steven Bosscher
On Sat, Sep 29, 2012 at 8:37 AM, Bin Cheng  wrote:
> This is the updated patch according to your comments. Please review.
> I also re-collected code size data and found it is improved by about 0.24%
> for mips, which is better than previous data. I believe this should be
> caused by recent changes in trunk, rather than by using DF caches to
> calculate register pressure.

Hello,

Thanks for the update. The first look wasn't a very thorough review,
so I have more comments now. Sorry for that, I should have taken the
time for this the first time round...


First, as a general note: Please add a fat comment somewhere before
the code of the pass to explain how the register pressure driven
hoisting pass works. The existing implementation used to be an almost
one-to-one copy from Muchnick's book, but lately the code has moved
away from that (e.g. with Maxim's patches from last year) and it gets
a bit hard to follow without some explanation. You should at least
document your own algorithm, but I'd really appreciate if you could
also spend some time writing down how things work in general and/or
how the GCC implementation differs from Muchnick's original algorithm.


> +Use IRA to evaluate register pressure in hoist pass for decisions to hoist

"the code hoisting pass" (brownie points for an xref to the flag for
code hoisting).


> -   - do rough calc of how many regs are needed in each block, and a rough
> - calc of how many regs are available in each class and use that to
> - throttle back the code in cases where RTX_COST is minimal.

This comment still applies to LCM.


> +/* Record all regs that are set in any one insn.  Communication from
> +   mark_reg_{store,clobber} and global_conflicts.  Asm can refer to
> +   all hard-registers.  */
> +static rtx regs_set[(FIRST_PSEUDO_REGISTER > MAX_RECOG_OPERANDS
> +  ? FIRST_PSEUDO_REGISTER : MAX_RECOG_OPERANDS) * 2];
> +/* Number of regs stored in the previous array.  */
> +static int n_regs_set;

You can use DF_INSN_DEFS for this in calculate_bb_reg_pressure.

But then again...

> +   while (n_regs_set-- > 0)
> + {
> +   rtx note = find_regno_note (insn, REG_UNUSED,
> +   REGNO (regs_set[n_regs_set]));
> +   if (! note)
> + continue;
> +
> +   mark_reg_death (XEXP (note, 0));
> + }

Why not just mark all registers mentioned in REG_UNUSED notes as death, i.e.:

for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
  if ((REG_NOTE_KIND (note) == REG_UNUSED)
mark_reg_death (XEXP (note, 0));

?


> +static int hoist_expr_reaches_here_p (basic_block, struct expr*, basic_block,

space between "struct expr" and "*".


> +   int *, bitmap_head *);

"bitmap_head *" => "bitmap".
Likewise here:

> /* Basic blocks that have occurrences reachable from BB.  */
> bitmap_head _from_bbs, *from_bbs = &_from_bbs;
>+/* Basic blocks through which expr is hoisted.  */
>+bitmap_head _hoisted_bbs, *hoisted_bbs = &_hoisted_bbs;

And using BITMAP_ALLOC here:
> bitmap_initialize (from_bbs, 0);
> +   if (flag_ira_hoist_pressure == 1)
> + bitmap_initialize (hoisted_bbs, 0);

(Some older code uses the "bitmap_head *" form, but that pre-dates
coretypes.h. Newer code that uses the "old form" should really be
fixed also.)

Please also use an obstack for the hoisted_bbs and from_bbs bitmaps.
They're currently allocated in GC space but that's completely
unnecessary for objects with such a clearly identifiable life time.
You can even allocate these bitmaps outside the loop, you're already
calling bitmap_clear on them.


> EXPR_BB. Stop

Two spaces after a period in comments.


> @@ -2863,7 +2909,8 @@ static int
>if (visited == NULL)
>  {
>visited_allocated_locally = 1;
> -  visited = XCNEWVEC (char, last_basic_block);
> +  visited = sbitmap_alloc (last_basic_block);
> +  sbitmap_zero (visited);
>  }

Can you please submit this as a separate patch? I'd go ahead and
commit it as obvious, but it's always good to have one change per
patch and this bit is independent of the reg-pressure dependent
hoisting.


> +fira-hoist-pressure
> +Common Report Var(flag_ira_hoist_pressure) Init(-1)
> +Use IRA based register pressure calculation
> +in hoist optimizations.

Please add the "Optimization" marker. Why initialize to -1? The
default initialization is 0, and if the flag is set it takes a value
1. If you follow that common behavior, you can replace all occurrences
of "if (flag_ira_hoist_pressure == 1)" with just ""if
(flag_ira_hoist_pressure)".


> +  /* Enable register pressure hoist when optimizing for size on Thumb1 set.  
> */
> +  if (TARGET_THUMB1 && optimize_function_for_size_p (cfun)
> +  && flag_ira_hoist_pressure == -1)
> +flag_ira_hoist_pressure = 1;

One would expect this to be a win on all targets, but you probably
looked at th

RE: [PATCH RFA] Implement register pressure directed hoist pass

2012-09-28 Thread Bin Cheng

> -Original Message-
> From: Steven Bosscher [mailto:stevenb@gmail.com]
> Sent: Friday, September 28, 2012 4:29 PM
> To: Bin Cheng
> Cc: gcc-patches@gcc.gnu.org; Eric Botcazou; Richard Sandiford;
> vmaka...@redhat.com
> Subject: Re: [PATCH RFA] Implement register pressure directed hoist pass
> 
> On Fri, Sep 28, 2012 at 9:18 AM, Bin Cheng  wrote:
> > (get_regno_pressure_class, get_pressure_class_and_nregs)
> 
> Broken long lines in a ChangeLog entry end with a ",".
> 
> 
> > (change_pressure, mark_regno_live, mark_regno_death,
mark_reg_death)
> > (mark_reg_store, mark_reg_clobber, calculate_bb_reg_pressure)
> 
> Please use the DF caches instead of note_stores, note_uses, etc.
> 
> 
> > (free_bb_data): New.
> 
> Please use alloc_aux_for_blocks (in calculate_bb_reg_pressure) and
> free_aux_for_block.
> 

Hi Steven,

This is the updated patch according to your comments. Please review.
I also re-collected code size data and found it is improved by about 0.24%
for mips, which is better than previous data. I believe this should be
caused by recent changes in trunk, rather than by using DF caches to
calculate register pressure. 

Thanks.

2012-09-29  Bin Cheng  

* common.opt (flag_ira_hoist_pressure): New.
* doc/invoke.texi (-fira-hoist-pressure): Describe.
* ira-costs.c (ira_set_pseudo_classes): New parameter.
* ira.h (ira_set_pseudo_classes): Update prototype.
* haifa-sched.c (sched_init): Update call.
* ira.c (ira): Update call.
* regmove.c (regmove_optimize): Update call.
* loop-invariant.c (move_loop_invariants): Update call.
* gcse.c (struct bb_data): New structure.
(BB_DATA): New macro.
(curr_bb, curr_regs_live, curr_reg_pressure, regs_set)
(n_regs_set): New static variables.
(hoist_expr_reaches_here_p): Use reg pressure to determine the
distance expr can be hoisted.
(hoist_code): Use reg pressure to direct the hoist process.
(get_regno_pressure_class, get_pressure_class_and_nregs)
(change_pressure, mark_regno_live, mark_regno_death)
(mark_reg_death, mark_reg_store, calculate_bb_reg_pressure): New.
(one_code_hoisting_pass): Calculate register pressure. Free data.
* config/arm/arm.c (arm_option_override): Set
flag_ira_hoist_pressure
on Thumb1 when optimizing for size.Index: gcc/doc/invoke.texi
===
--- gcc/doc/invoke.texi (revision 191816)
+++ gcc/doc/invoke.texi (working copy)
@@ -370,7 +370,7 @@ Objective-C and Objective-C++ Dialects}.
 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference @gol
 -fira-algorithm=@var{algorithm} @gol
--fira-region=@var{region} @gol
+-fira-region=@var{region} -fira-hoist-pressure @gol
 -fira-loop-pressure -fno-ira-share-save-slots @gol
 -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
 -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
@@ -6904,6 +6904,14 @@ This typically results in the smallest code size,
 
 @end table
 
+@item -fira-hoist-pressure
+@opindex fira-hoist-pressure
+Use IRA to evaluate register pressure in hoist pass for decisions to hoist
+expressions.  This option usually results in generation of smaller code on
+RISC machines, but it can slow the compiler down.
+
+This option is enabled at level @option{-Os} for some targets.
+
 @item -fira-loop-pressure
 @opindex fira-loop-pressure
 Use IRA to evaluate register pressure in loops for decisions to move
Index: gcc/haifa-sched.c
===
--- gcc/haifa-sched.c   (revision 191816)
+++ gcc/haifa-sched.c   (working copy)
@@ -6629,7 +6629,7 @@ sched_init (void)
/* We need info about pseudos for rtl dumps about pseudo
   classes and costs.  */
regstat_init_n_sets_and_refs ();
-  ira_set_pseudo_classes (sched_verbose ? sched_dump : NULL);
+  ira_set_pseudo_classes (true, sched_verbose ? sched_dump : NULL);
   sched_regno_pressure_class
= (enum reg_class *) xmalloc (max_regno * sizeof (enum reg_class));
   for (i = 0; i < max_regno; i++)
Index: gcc/regmove.c
===
--- gcc/regmove.c   (revision 191816)
+++ gcc/regmove.c   (working copy)
@@ -1237,7 +1237,7 @@ regmove_optimize (void)
   regstat_compute_ri ();
 
   if (flag_ira_loop_pressure)
-ira_set_pseudo_classes (dump_file);
+ira_set_pseudo_classes (true, dump_file);
 
   regno_src_regno = XNEWVEC (int, nregs);
   for (i = nregs; --i >= 0; )
Index: gcc/gcse.c
===
--- gcc/gcse.c  (revision 191816)
+++ gcc/gcse.c  (working copy)
@@ -20,9 +20,9 @@ along with GCC; see the file COPYIN

Re: [PATCH RFA] Implement register pressure directed hoist pass

2012-09-28 Thread Pedro Alves
On 09/28/2012 09:29 AM, Steven Bosscher wrote:
> On Fri, Sep 28, 2012 at 9:18 AM, Bin Cheng  wrote:
>> (get_regno_pressure_class, get_pressure_class_and_nregs)
> 
> Broken long lines in a ChangeLog entry end with a ",".

>From 
>:

Break long lists of function names by closing continued lines with ‘)’, rather 
than ‘,’, and opening the continuation with ‘(’ as in this example:

* keyboard.c (menu_bar_items, tool_bar_items)
(Fexecute_extended_command): Deal with 'keymap' property.

-- 
Pedro Alves



RE: [PATCH RFA] Implement register pressure directed hoist pass

2012-09-28 Thread Bin Cheng
Thanks for comments.

> -Original Message-
> From: Steven Bosscher [mailto:stevenb@gmail.com]
> Sent: Friday, September 28, 2012 4:29 PM
> To: Bin Cheng
> Cc: gcc-patches@gcc.gnu.org; Eric Botcazou; Richard Sandiford;
> vmaka...@redhat.com
> Subject: Re: [PATCH RFA] Implement register pressure directed hoist pass
> 
> On Fri, Sep 28, 2012 at 9:18 AM, Bin Cheng  wrote:
> > (get_regno_pressure_class, get_pressure_class_and_nregs)
> 
> Broken long lines in a ChangeLog entry end with a ",".

Did the mail-client wrap this line? I found no line exceeding 80 characters,
or I missed something?

> 
> 
> > (change_pressure, mark_regno_live, mark_regno_death,
mark_reg_death)
> > (mark_reg_store, mark_reg_clobber, calculate_bb_reg_pressure)
> 
> Please use the DF caches instead of note_stores, note_uses, etc.

These register pressure calculation codes are copied from loop-invariant.c.
I was thinking: Should we just export these interfaces from
loop-invariant.c, or copy it as in this patch. Maybe we can abstract these
function/data-structure into a common file? I would like to hear your
comments.

If we decide to keep these codes in gcse.c, I will make the change using DF
caches according to your comments. 
Moreover, it seems I still have to iterate REG_NOTES to find
REG_UNUSED/REG_DEAD information, or I can get them from DF caches too?
Thanks.
 
> 
> 
> > (free_bb_data): New.
> 
> Please use alloc_aux_for_blocks (in calculate_bb_reg_pressure) and
> free_aux_for_block.

Yes.






Re: [PATCH RFA] Implement register pressure directed hoist pass

2012-09-28 Thread Steven Bosscher
On Fri, Sep 28, 2012 at 9:18 AM, Bin Cheng  wrote:
> (get_regno_pressure_class, get_pressure_class_and_nregs)

Broken long lines in a ChangeLog entry end with a ",".


> (change_pressure, mark_regno_live, mark_regno_death, mark_reg_death)
> (mark_reg_store, mark_reg_clobber, calculate_bb_reg_pressure)

Please use the DF caches instead of note_stores, note_uses, etc.


> (free_bb_data): New.

Please use alloc_aux_for_blocks (in calculate_bb_reg_pressure) and
free_aux_for_block.

Ciao!
Steven