This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB 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]

[RFA] revised mips use_struct_convention


Redone using gdbarch method.
2002-08-06  Michael Snyder  <msnyder@redhat.com>

	* config/mips/tm-mips.h: Remove #define USE_STRUCT_CONVENTION.
	* mips-tdep.c (mips_EABI_use_struct_convention, 
	mips_OABI_use_struct_convention, mips_NABI_use_struct_convention):
	New functions.  (mips_use_struct_convention): Delete.
	(mips_gdbarch_init): set use_gdbarch_convention.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.89
diff -p -r1.89 mips-tdep.c
*** mips-tdep.c	6 Aug 2002 19:03:40 -0000	1.89
--- mips-tdep.c	6 Aug 2002 22:14:51 -0000
*************** show_mask_address (char *cmd, int from_t
*** 564,576 ****
  }
  
  /* Should call_function allocate stack space for a struct return?  */
  int
! mips_use_struct_convention (int gcc_p, struct type *type)
  {
!   if (MIPS_EABI)
!     return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
!   else
!     return 1;			/* Structures are returned by ref in extra arg0 */
  }
  
  /* Tell if the program counter value in MEMADDR is in a MIPS16 function.  */
--- 564,586 ----
  }
  
  /* Should call_function allocate stack space for a struct return?  */
+ 
  int
! mips_EABI_use_struct_convention (int gcc_p, struct type *type)
  {
!   return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
! }
! 
! int
! mips_NABI_use_struct_convention (int gcc_p, struct type *type)
! {
!   return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
! }
! 
! int
! mips_OABI_use_struct_convention (int gcc_p, struct type *type)
! {
!   return 1;	/* Structures are returned by ref in extra arg0.  */
  }
  
  /* Tell if the program counter value in MEMADDR is in a MIPS16 function.  */
*************** mips_gdbarch_init (struct gdbarch_info i
*** 4478,4483 ****
--- 4488,4495 ----
        set_gdbarch_long_bit (gdbarch, 32);
        set_gdbarch_ptr_bit (gdbarch, 32);
        set_gdbarch_long_long_bit (gdbarch, 64);
+       set_gdbarch_use_struct_convention (gdbarch, 
+ 					 mips_OABI_use_struct_convention);
        break;
      case MIPS_ABI_O64:
        tdep->mips_default_saved_regsize = 8;
*************** mips_gdbarch_init (struct gdbarch_info i
*** 4491,4496 ****
--- 4503,4510 ----
        set_gdbarch_long_bit (gdbarch, 32);
        set_gdbarch_ptr_bit (gdbarch, 32);
        set_gdbarch_long_long_bit (gdbarch, 64);
+       set_gdbarch_use_struct_convention (gdbarch, 
+ 					 mips_OABI_use_struct_convention);
        break;
      case MIPS_ABI_EABI32:
        tdep->mips_default_saved_regsize = 4;
*************** mips_gdbarch_init (struct gdbarch_info i
*** 4504,4509 ****
--- 4518,4525 ----
        set_gdbarch_long_bit (gdbarch, 32);
        set_gdbarch_ptr_bit (gdbarch, 32);
        set_gdbarch_long_long_bit (gdbarch, 64);
+       set_gdbarch_use_struct_convention (gdbarch, 
+ 					 mips_EABI_use_struct_convention);
        break;
      case MIPS_ABI_EABI64:
        tdep->mips_default_saved_regsize = 8;
*************** mips_gdbarch_init (struct gdbarch_info i
*** 4517,4522 ****
--- 4533,4540 ----
        set_gdbarch_long_bit (gdbarch, 64);
        set_gdbarch_ptr_bit (gdbarch, 64);
        set_gdbarch_long_long_bit (gdbarch, 64);
+       set_gdbarch_use_struct_convention (gdbarch, 
+ 					 mips_EABI_use_struct_convention);
        break;
      case MIPS_ABI_N32:
        tdep->mips_default_saved_regsize = 8;
*************** mips_gdbarch_init (struct gdbarch_info i
*** 4530,4535 ****
--- 4548,4555 ----
        set_gdbarch_long_bit (gdbarch, 32);
        set_gdbarch_ptr_bit (gdbarch, 32);
        set_gdbarch_long_long_bit (gdbarch, 64);
+       set_gdbarch_use_struct_convention (gdbarch, 
+ 					 mips_NABI_use_struct_convention);
  
        /* Set up the disassembler info, so that we get the right
  	 register names from libopcodes.  */
*************** mips_gdbarch_init (struct gdbarch_info i
*** 4554,4559 ****
--- 4574,4581 ----
        set_gdbarch_long_bit (gdbarch, 64);
        set_gdbarch_ptr_bit (gdbarch, 64);
        set_gdbarch_long_long_bit (gdbarch, 64);
+       set_gdbarch_use_struct_convention (gdbarch, 
+ 					 mips_NABI_use_struct_convention);
  
        /* Set up the disassembler info, so that we get the right
  	 register names from libopcodes.  */
Index: config/mips/tm-mips.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v
retrieving revision 1.28
diff -p -r1.28 tm-mips.h
*** config/mips/tm-mips.h	17 Jun 2002 23:32:36 -0000	1.28
--- config/mips/tm-mips.h	6 Aug 2002 22:14:51 -0000
*************** extern void mips_store_return_value (str
*** 265,272 ****
    (extract_address (REGBUF + REGISTER_BYTE (V0_REGNUM), \
  		    REGISTER_RAW_SIZE (V0_REGNUM)))
  
- extern use_struct_convention_fn mips_use_struct_convention;
- #define USE_STRUCT_CONVENTION(gcc_p, type) mips_use_struct_convention (gcc_p, type)
  
  /* Describe the pointer in each stack frame to the previous stack frame
     (its caller).  */
--- 265,270 ----
*************** extern void mips_find_saved_regs (struct
*** 328,336 ****
     handle it. */
  
  extern CORE_ADDR mips_push_arguments (int, struct value **, CORE_ADDR, int,
! 				      CORE_ADDR);
  #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
!   (mips_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)))
  
  extern CORE_ADDR mips_push_return_address (CORE_ADDR pc, CORE_ADDR sp);
  #define PUSH_RETURN_ADDRESS(PC, SP) (mips_push_return_address ((PC), (SP)))
--- 326,334 ----
     handle it. */
  
  extern CORE_ADDR mips_push_arguments (int, struct value **, CORE_ADDR, int,
! 				      CORE_ADDR, int);
  #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
!   (mips_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr), using_gcc))
  
  extern CORE_ADDR mips_push_return_address (CORE_ADDR pc, CORE_ADDR sp);
  #define PUSH_RETURN_ADDRESS(PC, SP) (mips_push_return_address ((PC), (SP)))

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