+ if (code == CALL_INSN && ! find_reg_note (insn, REG_NORETURN, NULL))
+ {
+ int regno;
+ HARD_REG_SET hard_regs_to_save;
+
+ /* Use the register life information in CHAIN to compute which
+ regs are live during the call. */
+ REG_SET_TO_HARD_REG_SET (hard_regs_to_save,
+ &chain->live_throughout);
+ /* Save hard registers always in the widest mode available. */
+ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+ if (TEST_HARD_REG_BIT (hard_regs_to_save, regno))
+ save_mode [regno] = regno_save_mode [regno][1];
+ else
+ save_mode [regno] = VOIDmode;
+
+ /* Look through all live pseudos, mark their hard registers
+ and choose proper mode for saving. */
+ EXECUTE_IF_SET_IN_REG_SET
+ (&chain->live_throughout, FIRST_PSEUDO_REGISTER, regno,
+ {
+ int r = reg_renumber[regno];
+ int nregs;
+ enum machine_mode mode;
+
+ gcc_assert (r >= 0);
+ nregs = hard_regno_nregs[r][PSEUDO_REGNO_MODE (regno)];
+ mode = HARD_REGNO_CALLER_SAVE_MODE
+ (r, nregs, PSEUDO_REGNO_MODE (regno));
+ if (GET_MODE_BITSIZE (mode)
+ > GET_MODE_BITSIZE (save_mode[r]))
+ save_mode[r] = mode;
+ while (nregs-- > 0)
+ SET_HARD_REG_BIT (hard_regs_to_save, r + nregs);
+ });
+
+ /* Record all registers set in this call insn. These don't need
+ to be saved. N.B. the call insn might set a subreg of a
+ multi-hard-reg pseudo; then the pseudo is considered live
+ during the call, but the subreg that is set isn't. */
+ CLEAR_HARD_REG_SET (this_insn_sets);
+ note_stores (PATTERN (insn), mark_set_regs, NULL);
+
+ /* Compute which hard regs must be saved before this call. */
+ AND_COMPL_HARD_REG_SET (hard_regs_to_save, call_fixed_reg_set);
+ AND_COMPL_HARD_REG_SET (hard_regs_to_save, this_insn_sets);
+ AND_COMPL_HARD_REG_SET (hard_regs_to_save, hard_regs_saved);
+ AND_HARD_REG_SET (hard_regs_to_save, call_used_reg_set);
+
+ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+ if (TEST_HARD_REG_BIT (hard_regs_to_save, regno))
+ regno += insert_save (chain, 1, regno, &hard_regs_to_save, save_mode);
+
+ /* Must recompute n_regs_saved. */
+ n_regs_saved = 0;
+ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+ if (TEST_HARD_REG_BIT (hard_regs_saved, regno))
+ n_regs_saved++;
+ }