config/mips/mips.c (mips_debugger_offset): When TARGET_MIPS16 &&

Jim Wilson wilson@cygnus.com
Mon Feb 22 19:42:00 GMT 1999


I have checked in this patch.

This fixes a problem with the mips16 debug info for the frame address.
In mips16, the frame pointer is adjusted for efficiency, which means it
doesn't point to the actual frame starting address, and some of the debug info
needed to be adjusted so that gdb could find the real frame start address.

Mon Feb 22 19:36:33 1999  Andrew Cagney  <cagney@b1.cygnus.com>

	* config/mips/mips.c (mips_debugger_offset): When TARGET_MIPS16 &&
 	frame_pointer_needed adjust frame size.
	(function_prologue): Don't MIPS16 .mask GPOFFSET. Already adjusted
 	in .frame pseudo-op.
	Frm Jim Wilson  <wilson@cygnus.com>:
	* mips.c (function_prologue): Adjust frame size in .frame pseudo-op
	when TARGET_MIPS16 && frame_pointer_needed.

Index: mips.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/mips/mips.c,v
retrieving revision 1.50
diff -p -r1.50 mips.c
*** mips.c	1999/02/11 23:55:21	1.50
--- mips.c	1999/02/23 03:37:55
*************** mips_debugger_offset (addr, offset)
*** 4545,4550 ****
--- 4545,4554 ----
  				  ? compute_frame_size (get_frame_size ())
  				  : current_frame_info.total_size;
  
+       /* MIPS16 frame is smaller */
+       if (frame_pointer_needed && TARGET_MIPS16)
+ 	frame_size -= current_function_outgoing_args_size;
+ 
        offset = offset - frame_size;
      }
  
*************** function_prologue (file, size)
*** 6115,6139 ****
  
    if (!flag_inhibit_size_directive)
      {
        fprintf (file,
  	       "\t.frame\t%s,%ld,%s\t\t# vars= %ld, regs= %d/%d, args= %d, extra= %ld\n",
  	       (reg_names[(frame_pointer_needed)
  			  ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM]),
! 	       tsize, reg_names[31 + GP_REG_FIRST],
  	       current_frame_info.var_size,
  	       current_frame_info.num_gp,
  	       current_frame_info.num_fp,
  	       current_function_outgoing_args_size,
  	       current_frame_info.extra_size);
  
        fprintf (file, "\t.mask\t0x%08lx,%ld\n\t.fmask\t0x%08lx,%ld\n",
  	       current_frame_info.mask,
! 	       ((frame_pointer_needed && TARGET_MIPS16)
! 		? (current_frame_info.gp_save_offset
! 		   - current_function_outgoing_args_size)
! 		: current_frame_info.gp_save_offset),
  	       current_frame_info.fmask,
  	       current_frame_info.fp_save_offset);
      }
  
    if (mips_entry && ! mips_can_use_return_insn ())
--- 6119,6149 ----
  
    if (!flag_inhibit_size_directive)
      {
+       /* .frame FRAMEREG, FRAMESIZE, RETREG */
        fprintf (file,
  	       "\t.frame\t%s,%ld,%s\t\t# vars= %ld, regs= %d/%d, args= %d, extra= %ld\n",
  	       (reg_names[(frame_pointer_needed)
  			  ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM]),
! 	       ((frame_pointer_needed && TARGET_MIPS16)
! 		? (tsize - current_function_outgoing_args_size)
! 		: tsize),
! 	       reg_names[31 + GP_REG_FIRST],
  	       current_frame_info.var_size,
  	       current_frame_info.num_gp,
  	       current_frame_info.num_fp,
  	       current_function_outgoing_args_size,
  	       current_frame_info.extra_size);
  
+       /* .mask MASK, GPOFFSET; .fmask FPOFFSET */
        fprintf (file, "\t.mask\t0x%08lx,%ld\n\t.fmask\t0x%08lx,%ld\n",
  	       current_frame_info.mask,
! 	       current_frame_info.gp_save_offset,
  	       current_frame_info.fmask,
  	       current_frame_info.fp_save_offset);
+ 
+       /* Require:
+ 	 OLD_SP == *FRAMEREG + FRAMESIZE => can find old_sp from nominated FP reg.
+ 	 HIGHEST_GP_SAVED == *FRAMEREG + FRAMESIZE + GPOFFSET => can find saved regs. */
      }
  
    if (mips_entry && ! mips_can_use_return_insn ())



More information about the Gcc-patches mailing list