+2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * 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 <rdsandiford@googlemail.com>
* bt-load.c: Include rtl-iter.h.
#include "addresses.h"
#include "ggc.h"
#include "dumpfile.h"
+#include "rtl-iter.h"
#define MOVE_MAX_WORDS (MOVE_MAX / UNITS_PER_WORD)
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. */