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: unwind info for epilogues


On Mon, Jun 01, 2009 at 11:20:12AM -0700, Richard Henderson wrote:
>> +  /* Calculate start of saved registers relative to esp on entry of the
>> +     function.  When realigning stack, this needs to be smallest possible
>> +     value at runtime.  */
>> +  red_offset = offset;
>> +  if (using_drap)
>> +    red_offset -= crtl->stack_alignment_needed / BITS_PER_UNIT
>> +		  + UNITS_PER_WORD;
>> +  if (frame_pointer_needed)
>> +    red_offset -= UNITS_PER_WORD;
>> +  if (stack_realign_fp)
>> +    red_offset -= crtl->stack_alignment_needed / BITS_PER_UNIT
>> +		  - UNITS_PER_WORD;
>
> Only one of USING_DRAP or STACK_REALIGN_FP, surely?  Also, I think

There are assertions earlier on that ensure that stack_realign_fp is
not true when using_drap:

  /* DRAP should not coexist with stack_realign_fp */
  gcc_assert (!(crtl->drap_reg && stack_realign_fp));

When using_drap we need to account for the padding from and insn
(0 to crtl->stack_alignment_needed / BITS_PER_UNIT - UNITS_PER_WORD
bytes) and one or two word pushes before that (so + UNITS_PER_WORD),
while for stack_realign_fp only for the and insn created padding.
In the above I've tried to mirror what ix86_expand_prologue does
(also 3 ifs, no else/else if), but if you want, I can surely
swap stack_realign_fp and frame_pointer_needed case and add else
before if (stack_realign_fp).

> "smallest" is misleading, since it implies (to me) smallest absolute
> value, whereas what I think you mean is "most negative" or "largest".

Will change to most negative.  Ok with that change?

	Jakub


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