This is the mail archive of the gcc@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: function arguments offset computation with -fomit-frame-pointer


On Wednesday 09 July 2003 10:18, Jim Wilson wrote:

 > I wouldn't recommend using a kernel as a compiler test.  Too hard to
 > debug miscompilation problems, but maybe if you know the kernel well
 > enough it is possible.  The gcc testsuite is a better test, lots of
 > small easy to debug testcases.

 I can't debug userland applications. gdbserver does too many strange
things on my target to be useful. I often get "breakpoints not supported"
or "bus error" messages that shouldn't be there.


 > Your initial_frame_pointer_offset function looks reasonable.  There is
 > probably something subtly wrong here.  There are various other things
 > that may need to be added into the frame size in some cases, for
 > instance current_function_pretend_args_size, and
 > current_function_outgoing_args_size.  I think these are more
 > applicable to RISC machines than the m68k though.  You will just have
 > to figure out what is missing.


 > Isn't the current_function_uses_pic_offset_table check redundant if
 > you are calling m68k_save_reg, because that function already handles
 > the pic register.

 You got me! How did you know? The check wasn't in the original gcc sources.
I've added it by combining previous patches from Peter Barada and the
uClinux people.

 So I was adding the PIC register twice! It would have bitten by this in
userland code since uClinux uses something similar to -fPIC to make execution
from ROM possible.

 Here's my version of m68k_save_reg(). Perhaps you can spot some bugs
here too ;-)

 /* Return 1 if we need to save REGNO.  */
 static int
 m68k_save_reg (regno, interrupt_handler)
      unsigned int regno;
      int interrupt_handler;
 {
   if (flag_pic && current_function_uses_pic_offset_table
       && regno == PIC_OFFSET_TABLE_REGNUM)
     return 1;

   if (current_function_calls_eh_return)
     {
       unsigned int i;
       for (i = 0; ; i++)
         {
           unsigned int test = EH_RETURN_DATA_REGNO (i);
           if (test == INVALID_REGNUM)
             break;
           if (test == regno)
             return 1;
         }
     }
 
   return (
           ((regs_ever_live[regno] && !call_used_regs[regno])
             || (interrupt_handler
               && (regs_ever_live[regno]
                 || (call_used_regs[regno] && !current_function_is_leaf)
               )
             )
           )
           && !fixed_regs[regno]
           && !(regno == FRAME_POINTER_REGNUM && frame_pointer_needed));
 }


-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/

Please don't send Word attachments - http://www.gnu.org/philosophy/no-word-attachments.html



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