Message ID | 001f01cdab72$0979efa0$1c6dcee0$@cheng@arm.com |
---|---|
State | New |
Headers | show |
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<bin.cheng@arm.com> > > * gcse.c: Update copyright dates. > (hoist_expr_reaches_here_p): Change parameter type from char * > to sbitmap. > > 2012-10-16 Bin Cheng<bin.cheng@arm.com> > > * 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
> -----Original Message----- > From: Jeff Law [mailto:law@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<bin.cheng@arm.com> > > > > * gcse.c: Update copyright dates. > > (hoist_expr_reaches_here_p): Change parameter type from char * > > to sbitmap. > > > > 2012-10-16 Bin Cheng<bin.cheng@arm.com> > > > > * 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.
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); }