From 1cb22a678b82b615b83780e683b4f002435a1349 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 28 Aug 2014 06:21:54 +0000 Subject: [PATCH] caller-save.c: Include rtl-iter.h. gcc/ * caller-save.c: Include rtl-iter.h. (add_used_regs_1): Delete. (add_used_regs): Use FOR_EACH_SUBRTX rather than for_each_rtx to iterate over subrtxes. Assert that any remaining pseudos have been spilled. From-SVN: r214621 --- gcc/ChangeLog | 8 ++++++++ gcc/caller-save.c | 39 +++++++++++++++------------------------ 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f174c76feec..c9b89e41ff5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2014-08-28 Richard Sandiford + + * caller-save.c: Include rtl-iter.h. + (add_used_regs_1): Delete. + (add_used_regs): Use FOR_EACH_SUBRTX rather than for_each_rtx + to iterate over subrtxes. Assert that any remaining pseudos + have been spilled. + 2014-08-28 Richard Sandiford * bt-load.c: Include rtl-iter.h. diff --git a/gcc/caller-save.c b/gcc/caller-save.c index 8bdca517e0b..d94343edfe9 100644 --- a/gcc/caller-save.c +++ b/gcc/caller-save.c @@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see #include "addresses.h" #include "ggc.h" #include "dumpfile.h" +#include "rtl-iter.h" #define MOVE_MAX_WORDS (MOVE_MAX / UNITS_PER_WORD) @@ -1336,36 +1337,26 @@ insert_save (struct insn_chain *chain, int before_p, int regno, return numregs - 1; } -/* A for_each_rtx callback used by add_used_regs. Add the hard-register - equivalent of each REG to regset DATA. */ - -static int -add_used_regs_1 (rtx *loc, void *data) -{ - unsigned int regno; - regset live; - rtx x; - - x = *loc; - live = (regset) data; - if (REG_P (x)) - { - regno = REGNO (x); - if (HARD_REGISTER_NUM_P (regno)) - bitmap_set_range (live, regno, hard_regno_nregs[regno][GET_MODE (x)]); - else - regno = reg_renumber[regno]; - } - return 0; -} - /* A note_uses callback used by insert_one_insn. Add the hard-register equivalent of each REG to regset DATA. */ static void add_used_regs (rtx *loc, void *data) { - for_each_rtx (loc, add_used_regs_1, data); + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, *loc, NONCONST) + { + const_rtx x = *iter; + if (REG_P (x)) + { + unsigned int regno = REGNO (x); + if (HARD_REGISTER_NUM_P (regno)) + bitmap_set_range ((regset) data, regno, + hard_regno_nregs[regno][GET_MODE (x)]); + else + gcc_checking_assert (reg_renumber[regno] < 0); + } + } } /* Emit a new caller-save insn and set the code. */ -- 2.30.2