This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Account for prologue spills in reg_pressure scheduling


Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> writes:
> +      for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
> +	if (call_used_regs[i])
> +	  for (c = 0; c < ira_pressure_classes_num; ++c)
> +	    {
> +	      int j;
> +	      enum reg_class cl = ira_pressure_classes[c];
> +
> +	      for (j = 0; j < ira_class_hard_regs_num[cl]; ++j)
> +		if (ira_class_hard_regs[cl][j] == i)
> +		  {
> +		    /* Register I belongs to pressure class CL.  Pressure
> +		       classes do not intersect, so don't look further.  */
> +		    ++call_used_regs_num[cl];
> +		    break;
> +		  }
> +	    }

It'd be easier to iterate over the classes as the outer loop:

    for (int c = 0; c < ira_pressure_classes_num; ++c)
      {
        enum reg_class cl = ira_pressure_classes[c];
        for (int i = 0; i < ira_class_hard_regs_num[cl]; ++i)
          if (call_used_regs[ira_class_hard_regs[cl][i]])
            ...

Thanks,
Richard



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]