On Tue, Sep 29, 2015 at 2:23 PM, Mike Stump <mikest...@comcast.net> wrote:
> On Sep 29, 2015, at 1:59 PM, H.J. Lu <hjl.to...@gmail.com> wrote:
>> commit f3a6675a8d69d810d2cad0c090a762094a0a8622
>> Author: H.J. Lu <hjl.to...@gmail.com>
>> Date:   Tue Sep 29 13:47:18 2015 -0700
>>
>>    Define EPILOGUE_USES in i386 so that all preserved registers are used
>>    by the epilogue of interrupt handler.  Don't explicitly mark BP and SP
>>    registers as used since they are always used in epilogue.
>>
>> Please take a look.
>
> Oh, too bad you didn’t copy it here.  The easiest thing to blow is the 
> addition of reload_completed && on the condition:
>
>   /* An interrupt handler must preserve some registers that are
>      ordinarily call-clobbered.  */
>   if (reload_completed
>       && myarch_interrupt_func (current_function_decl)
>       && save_reg_p (regno))
>     return true;
>
> without it, the optimizer will blow chunks all over the place and code-gen 
> will not be very good, if it doesn’t.  I’d love this to be shared across all 
> ports, it it is cryptic and usually test cases are not elaborate enough to 
> find the problem.  When we ported a large library to our system that made 
> extensive uses of complex interrupt routines, the compiler blew chunks.  With 
> lessor code, we never even noticed a problem.

We have

static bool
ix86_save_reg (unsigned int regno, bool maybe_eh_return)
{
  /* In interrupt handler, we don't preserve MMX and x87 registers
     which aren't supported when saving and restoring registers.  No
     need to preserve callee-saved registers unless they are modified.
     We also preserve all caller-saved registers if a function call
     is made in interrupt handler since the called function may change
     them.  Don't explicitly save BP and SP registers since they are
     always preserved.  */
  if (cfun->machine->is_interrupt)
    return ((df_regs_ever_live_p (regno)
             || (call_used_regs[regno] && cfun->machine->make_calls))
            && !fixed_regs[regno]
            && !STACK_REGNO_P (regno)
            && !MMX_REGNO_P (regno)
            && regno != BP_REG
            && regno != SP_REG
            && (regno <= ST7_REG || regno >= XMM0_REG));

Is this sufficient?



-- 
H.J.

Reply via email to