REG_UNUSED notes for CLOBBERs?

Eric Botcazou ebotcazou@adacore.com
Mon Feb 25 22:17:00 GMT 2013


> You mean this piece of nice code:
> 
>           /* Step 4: Close chains for registers that die here, unless
>              the register is mentioned in a REG_UNUSED note.  In that
>              case we keep the chain open until step #7 below to ensure
>              it conflicts with other output operands of this insn.
>              See PR 52573.  Arguably the insn should not have both
>              notes; it has proven difficult to fix that without
>              other undesirable side effects.  */
>           for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
>             if (REG_NOTE_KIND (note) == REG_DEAD
>                 && !find_regno_note (insn, REG_UNUSED, REGNO (XEXP (note,
> 0)))) {
>                 remove_from_hard_reg_set (&live_hard_regs,
>                                           GET_MODE (XEXP (note, 0)),
>                                           REGNO (XEXP (note, 0)));
>                 scan_rtx (insn, &XEXP (note, 0), NO_REGS, terminate_dead,
>                           OP_IN);
>               }
> 
> ?

That one is fairly recent, but I was rather referring to:

	  /* Process the insn, determining its effect on the def-use
	     chains and live hard registers.  We perform the following
	     steps with the register references in the insn, simulating
	     its effect:
	     (1) Deal with earlyclobber operands and CLOBBERs of non-operands
	         by creating chains and marking hard regs live.
[...]
	     (7) For any REG_UNUSED, close any chains we just opened.

(7) does actually more than advertised above:

	  /* Step 7: Close chains for registers that were never
	     really used here.  */
	  for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
	    if (REG_NOTE_KIND (note) == REG_UNUSED)
	      {
		remove_from_hard_reg_set (&live_hard_regs,
					  GET_MODE (XEXP (note, 0)),
					  REGNO (XEXP (note, 0)));

So (7) also closes the live ranges of hard regs opened in (1).

-- 
Eric Botcazou



More information about the Gcc mailing list