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]

INITIAL_ELIMINATION_OFFSET() breakage in gcc 3.3 + ColdFire patches


Hello Peter,

I finally found out why the m68k_initial_elimination_offset() function was
not working as I did expect. I reworked the function to look like this:

 HOST_WIDE_INT
 m68k_initial_elimination_offset (int from, int to)
 {
   struct m68k_frame frame;
 
   m68k_compute_frame_layout (&frame);
 
   if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
     return 0 + 21000;
   else if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
     return frame.offset + frame.size + (frame_pointer_needed ? -UNITS_PER_WORD * 2 : -UNITS_PER_WORD) + 22000;
   else if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
     return frame.offset + frame.size + 23000;
   else if (from == FRAME_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
     return 0 + 24000;
 
   abort();
 }

This code should behave exactly like the old version I got from you, but it's
easier to understand for me. The fixed offsets (+21000, +22000, ...) are there
to help me see which path GCC got in.

I think I've found out why GCC does not behave correctly: on i386, from which
this code came from, ARG_POINTER_REGNUM and FRAME_POINTER_REGNUM are distinct
registers, while on the m68k they're both defined to 14 (a6).

With -fomit-frame-pointer the third and fourth eliminations are never being
used because of this.

I've redefined ARG_POINTER_REGNUM to 24, incremented FIRST_PSEUDO_REGISTER to 25
and appended the new entry to REGISTER_NAMES.

However, now GCC crashes :-/
I think making the two registers distinct is the correct solution, but I must
be doing something stupid.

-- 
  // 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]