find_free_registers improvement for new_ia32_branch

Richard Henderson rth@cygnus.com
Mon Jul 19 22:59:00 GMT 1999


On Mon, Jul 12, 1999 at 03:29:14AM +0200, Jan Hubicka wrote:
> ! 	  rtx forward = NEXT_INSN (current_insn), backward = PREV_INSN (current_insn);
> ! 	  int currdist=0;
> ! 	  while (forward && backward && currdist < MAXDIST)
>   	    {
> ! 	      if (refers_to_regno_p (regno, regno + 1, forward, NULL)
> ! 	          || refers_to_regno_p (regno, regno + 1, backward, NULL))
> ! 		goto found;
> ! 	      currdist++;
> ! 	      forward = NEXT_INSN (forward);
> ! 	      backward = PREV_INSN (backward);
> ! 	    }
> ! 	  while (backward && currdist < MAXDIST)
> ! 	    {
> ! 	      if (refers_to_regno_p (regno, regno + 1, backward, NULL))
> ! 		goto found;
> ! 	      currdist++;
> ! 	      backward = PREV_INSN (backward);
> ! 	    }
> ! 	  while (forward && currdist < MAXDIST)
> ! 	    {
> ! 	      if (refers_to_regno_p (regno, regno + 1, forward, NULL))
> ! 		goto found;
> ! 	      currdist++;
> ! 	      forward = NEXT_INSN (forward);
> ! 	    }

This seems like an awfully expensive test.

Could you perhaps find a way to collect lru info during the
mark_target_live_regs scan, to be saved in struct resource?
That would at least cover the backward scan.


r~


More information about the Gcc-patches mailing list