From: Anatoly Sokolov Date: Sat, 19 Mar 2011 17:33:45 +0000 (+0300) Subject: cfgcleanup.c (mark_effect): Use bitmap_set_range/bitmap_clear_range instead of loop. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f773c2bd761b15c79456aae0390b854ab5a7a1cd;p=gcc.git cfgcleanup.c (mark_effect): Use bitmap_set_range/bitmap_clear_range instead of loop. * cfgcleanup.c (mark_effect): Use bitmap_set_range/bitmap_clear_range instead of loop. Use HARD_REGISTER_NUM_P predicate. * haifa-sched.c (setup_ref_regs): Ditto. * caller-save.c (add_used_regs_1): Ditto. * dse.c (look_for_hardregs): Ditto. * df-problems.c (df_simulate_one_insn_forwards): Ditto. * sched-rgn.c (check_live_1): Ditto. From-SVN: r171183 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7c2b4d73711..bf32ebb9e50 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2011-03-19 Anatoly Sokolov + + * cfgcleanup.c (mark_effect): Use bitmap_set_range/bitmap_clear_range + instead of loop. Use HARD_REGISTER_NUM_P predicate. + * haifa-sched.c (setup_ref_regs): Ditto. + * caller-save.c (add_used_regs_1): Ditto. + * dse.c (look_for_hardregs): Ditto. + * df-problems.c (df_simulate_one_insn_forwards): Ditto. + * sched-rgn.c (check_live_1): Ditto. + 2011-03-18 Joseph Myers * c-decl.c (diagnose_mismatched_decls): Give an error for diff --git a/gcc/caller-save.c b/gcc/caller-save.c index 160d2e9117d..f32d05ffde4 100644 --- a/gcc/caller-save.c +++ b/gcc/caller-save.c @@ -1312,7 +1312,7 @@ insert_save (struct insn_chain *chain, int before_p, int regno, static int add_used_regs_1 (rtx *loc, void *data) { - int regno, i; + unsigned int regno; regset live; rtx x; @@ -1321,11 +1321,10 @@ add_used_regs_1 (rtx *loc, void *data) if (REG_P (x)) { regno = REGNO (x); - if (!HARD_REGISTER_NUM_P (regno)) + if (HARD_REGISTER_NUM_P (regno)) + bitmap_set_range (live, regno, hard_regno_nregs[regno][GET_MODE (x)]); + else regno = reg_renumber[regno]; - if (regno >= 0) - for (i = hard_regno_nregs[regno][GET_MODE (x)] - 1; i >= 0; i--) - SET_REGNO_REG_SET (live, regno + i); } return 0; } diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index aaa0ea5d232..266fda7f1aa 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -1,6 +1,6 @@ /* Control flow optimization code for GNU compiler. Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -208,13 +208,11 @@ mark_effect (rtx exp, regset nonequal) { dest = XEXP (exp, 0); regno = REGNO (dest); - CLEAR_REGNO_REG_SET (nonequal, regno); - if (regno < FIRST_PSEUDO_REGISTER) - { - int n = hard_regno_nregs[regno][GET_MODE (dest)]; - while (--n > 0) - CLEAR_REGNO_REG_SET (nonequal, regno + n); - } + if (HARD_REGISTER_NUM_P (regno)) + bitmap_clear_range (nonequal, regno, + hard_regno_nregs[regno][GET_MODE (dest)]); + else + bitmap_clear_bit (nonequal, regno); } return false; @@ -227,13 +225,11 @@ mark_effect (rtx exp, regset nonequal) if (!REG_P (dest)) return true; regno = REGNO (dest); - SET_REGNO_REG_SET (nonequal, regno); - if (regno < FIRST_PSEUDO_REGISTER) - { - int n = hard_regno_nregs[regno][GET_MODE (dest)]; - while (--n > 0) - SET_REGNO_REG_SET (nonequal, regno + n); - } + if (HARD_REGISTER_NUM_P (regno)) + bitmap_set_range (nonequal, regno, + hard_regno_nregs[regno][GET_MODE (dest)]); + else + bitmap_set_bit (nonequal, regno); return false; default: diff --git a/gcc/df-problems.c b/gcc/df-problems.c index 729cad5f023..0f398ba3aa4 100644 --- a/gcc/df-problems.c +++ b/gcc/df-problems.c @@ -1,6 +1,6 @@ /* Standard problems for dataflow support routines. Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Originally contributed by Michael P. Hayes (m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com) Major rewrite contributed by Danny Berlin (dberlin@dberlin.org) @@ -3774,12 +3774,9 @@ df_simulate_one_insn_forwards (basic_block bb, rtx insn, bitmap live) { rtx reg = XEXP (link, 0); int regno = REGNO (reg); - if (regno < FIRST_PSEUDO_REGISTER) - { - int n = hard_regno_nregs[regno][GET_MODE (reg)]; - while (--n >= 0) - bitmap_clear_bit (live, regno + n); - } + if (HARD_REGISTER_NUM_P (regno)) + bitmap_clear_range (live, regno, + hard_regno_nregs[regno][GET_MODE (reg)]); else bitmap_clear_bit (live, regno); } diff --git a/gcc/dse.c b/gcc/dse.c index a15b7351fcc..dee4c76d430 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -1728,12 +1728,11 @@ look_for_hardregs (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data) bitmap regs_set = (bitmap) data; if (REG_P (x) - && REGNO (x) < FIRST_PSEUDO_REGISTER) + && HARD_REGISTER_P (x)) { - int regno = REGNO (x); - int n = hard_regno_nregs[regno][GET_MODE (x)]; - while (--n >= 0) - bitmap_set_bit (regs_set, regno + n); + unsigned int regno = REGNO (x); + bitmap_set_range (regs_set, regno, + hard_regno_nregs[regno][GET_MODE (x)]); } } diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index e16561f4cb9..ea69254fc95 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -1,6 +1,6 @@ /* Instruction scheduling pass. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by, and currently maintained by, Jim Wilson (wilson@cygnus.com) @@ -672,11 +672,11 @@ setup_ref_regs (rtx x) if (REG_P (x)) { regno = REGNO (x); - if (regno >= FIRST_PSEUDO_REGISTER) - bitmap_set_bit (region_ref_regs, REGNO (x)); + if (HARD_REGISTER_NUM_P (regno)) + bitmap_set_range (region_ref_regs, regno, + hard_regno_nregs[regno][GET_MODE (x)]); else - for (i = hard_regno_nregs[regno][GET_MODE (x)] - 1; i >= 0; i--) - bitmap_set_bit (region_ref_regs, regno + i); + bitmap_set_bit (region_ref_regs, REGNO (x)); return; } fmt = GET_RTX_FORMAT (code); diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c index 6c4fd46a50f..be2a1e9a211 100644 --- a/gcc/sched-rgn.c +++ b/gcc/sched-rgn.c @@ -1,6 +1,6 @@ /* Instruction scheduling pass. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by, and currently maintained by, Jim Wilson (wilson@cygnus.com) @@ -1762,29 +1762,18 @@ update_live_1 (int src, rtx x) regno = REGNO (reg); - if (regno >= FIRST_PSEUDO_REGISTER || !global_regs[regno]) + if (! HARD_REGISTER_NUM_P (regno) + || !global_regs[regno]) { - if (regno < FIRST_PSEUDO_REGISTER) - { - int j = hard_regno_nregs[regno][GET_MODE (reg)]; - while (--j >= 0) - { - for (i = 0; i < candidate_table[src].update_bbs.nr_members; i++) - { - basic_block b = candidate_table[src].update_bbs.first_member[i]; - - SET_REGNO_REG_SET (df_get_live_in (b), regno + j); - } - } - } - else + for (i = 0; i < candidate_table[src].update_bbs.nr_members; i++) { - for (i = 0; i < candidate_table[src].update_bbs.nr_members; i++) - { - basic_block b = candidate_table[src].update_bbs.first_member[i]; + basic_block b = candidate_table[src].update_bbs.first_member[i]; - SET_REGNO_REG_SET (df_get_live_in (b), regno); - } + if (HARD_REGISTER_NUM_P (regno)) + bitmap_set_range (df_get_live_in (b), regno, + hard_regno_nregs[regno][GET_MODE (reg)]); + else + bitmap_set_bit (df_get_live_in (b), regno); } } }