- /* See a register other than being set
- => mark it as needed. */
-
- regno = REGNO (x);
- {
- int some_needed = REGNO_REG_SET_P (needed, regno);
- int some_not_needed = ! some_needed;
-
- SET_REGNO_REG_SET (live, regno);
-
- /* A hard reg in a wide mode may really be multiple registers.
- If so, mark all of them just like the first. */
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- int n;
-
- /* For stack ptr or fixed arg pointer,
- nothing below can be necessary, so waste no more time. */
- if (regno == STACK_POINTER_REGNUM
-#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- || (regno == HARD_FRAME_POINTER_REGNUM
- && (! reload_completed || frame_pointer_needed))
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- || (regno == ARG_POINTER_REGNUM && fixed_regs[regno])
-#endif
- || (regno == FRAME_POINTER_REGNUM
- && (! reload_completed || frame_pointer_needed)))
- {
- /* If this is a register we are going to try to eliminate,
- don't mark it live here. If we are successful in
- eliminating it, it need not be live unless it is used for
- pseudos, in which case it will have been set live when
- it was allocated to the pseudos. If the register will not
- be eliminated, reload will set it live at that point. */
-
- if ((flags & PROP_REG_INFO)
- && ! TEST_HARD_REG_BIT (elim_reg_set, regno))
- regs_ever_live[regno] = 1;
- return;
- }
- /* No death notes for global register variables;
- their values are live after this function exits. */
- if (global_regs[regno])
- {
- if (flags & (PROP_LOG_LINKS | PROP_AUTOINC))
- reg_next_use[regno] = insn;
- return;
- }
-
- n = HARD_REGNO_NREGS (regno, GET_MODE (x));
- while (--n > 0)
- {
- int regno_n = regno + n;
- int needed_regno = REGNO_REG_SET_P (needed, regno_n);
-
- SET_REGNO_REG_SET (live, regno_n);
- some_needed |= needed_regno;
- some_not_needed |= ! needed_regno;
- }
- }
-
- if (flags & (PROP_LOG_LINKS | PROP_AUTOINC))
- {
- /* Record where each reg is used, so when the reg
- is set we know the next insn that uses it. */
-
- reg_next_use[regno] = insn;
- }
- if (flags & PROP_REG_INFO)
- {
- if (regno < FIRST_PSEUDO_REGISTER)
- {
- /* If a hard reg is being used,
- record that this function does use it. */
-
- i = HARD_REGNO_NREGS (regno, GET_MODE (x));
- if (i == 0)
- i = 1;
- do
- regs_ever_live[regno + --i] = 1;
- while (i > 0);
- }
- else
- {
- /* Keep track of which basic block each reg appears in. */
-
- register int blocknum = BLOCK_NUM (insn);
-
- if (REG_BASIC_BLOCK (regno) == REG_BLOCK_UNKNOWN)
- REG_BASIC_BLOCK (regno) = blocknum;
- else if (REG_BASIC_BLOCK (regno) != blocknum)
- REG_BASIC_BLOCK (regno) = REG_BLOCK_GLOBAL;
-
- /* Count (weighted) number of uses of each reg. */
-
- REG_N_REFS (regno) += loop_depth + 1;
- }
- }
-
- /* Record and count the insns in which a reg dies.
- If it is used in this insn and was dead below the insn
- then it dies in this insn. If it was set in this insn,
- we do not make a REG_DEAD note; likewise if we already
- made such a note. */
-
- if (flags & PROP_DEATH_NOTES)
- {
- if (some_not_needed
- && ! dead_or_set_p (insn, x)
-#if 0
- && (regno >= FIRST_PSEUDO_REGISTER || ! fixed_regs[regno])
-#endif
- )
- {
- /* Check for the case where the register dying partially
- overlaps the register set by this insn. */
- if (regno < FIRST_PSEUDO_REGISTER
- && HARD_REGNO_NREGS (regno, GET_MODE (x)) > 1)
- {
- int n = HARD_REGNO_NREGS (regno, GET_MODE (x));
- while (--n >= 0)
- some_needed |= dead_or_set_regno_p (insn, regno + n);
- }
-
- /* If none of the words in X is needed, make a REG_DEAD
- note. Otherwise, we must make partial REG_DEAD notes. */
- if (! some_needed)
- {
- REG_NOTES (insn)
- = alloc_EXPR_LIST (REG_DEAD, x, REG_NOTES (insn));
- REG_N_DEATHS (regno)++;
- }
- else
- {
- int i;
-
- /* Don't make a REG_DEAD note for a part of a register
- that is set in the insn. */
-
- for (i = HARD_REGNO_NREGS (regno, GET_MODE (x)) - 1;
- i >= 0; i--)
- if (!REGNO_REG_SET_P (needed, regno + i)
- && ! dead_or_set_regno_p (insn, regno + i))
- REG_NOTES (insn)
- = (alloc_EXPR_LIST
- (REG_DEAD, gen_rtx_REG (reg_raw_mode[regno + i],
- regno + i),
- REG_NOTES (insn)));
- }
- }
- }
- }