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][updated] Force SDmode function args into FP registers per the ABI


Peter Bergner wrote:
On Tue, 2007-06-19 at 09:04 +0200, Paolo Bonzini wrote:
This can be simplified to be just

enum machine_mode mode = PSEUDO_REGNO_MODE (i);
unsigned int inherent_size = targetm.min_stack_slot_size_for_mode (mode);
unsigned int total_size = MAX (inherent_size, reg_max_ref_width[i]);
[snip]
Sorry for the further nitpicking... I can take care of this, but I wouldn't mind preapproval since this was what Mark mentioned here:

The
default would be PSEUDO_REGNO_BYTES (REGNO (reg)).  Then, in alter reg,
use the max of reg_max_ref_width and the value of the hook?

I debated about setting inherent_size with the target hook like you did above, but decided against it given all of the other uses of inherent_size in alter_reg and the fact that by changing its value like this (ie, inherent_size will be less than total_size), we will cause it to go down different paths in this routine and pass different function args to assign_stack_local. Maybe it would be ok, but errored on the side of caution.

You're right. From reading the code more carefully, however, I think that my proposed change would be the right thing to do, and not just a cleanup. The reason is this code:


  /* Reuse a stack slot if possible.  */
  else if (spill_stack_slot[from_reg] != 0
           && spill_stack_slot_width[from_reg] >= total_size
	   && (GET_MODE_SIZE (GET_MODE (spill_stack_slot[from_reg]))
               >= inherent_size)

If the register has already been spilled as a SFmode register, and now it is requested to spill as a SDmode register, your patch will reuse the 1-word spill slot for the SDmode register. I don't know what kind of failure this would lead to, because of course I have no testcase, but it seems wrong.

Paolo


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