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] mips, n32 use_struct_convention (again)


OK, this patch is based on the Irix native compiler, not gcc.
It fixes about 16 testsuite fails in structs, call-ar-st, etc.
It fills in the n32n64_use_struct_convention function, and 
tweaks the alignment of small structs in the return registers.




2002-08-08  Michael Snyder  <msnyder@redhat.com>

        * mips-tdep.c (mips_n32n64_use_struct_convention): N32 only 
        returns structs by ref if they're too big to fit in two
registers.
        (return_value_location): Structs returned in registers are
        aligned differently (n32/64 vs. o32/64).

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.92
diff -c -3 -p -r1.92 mips-tdep.c
*** mips-tdep.c 8 Aug 2002 00:26:51 -0000       1.92
--- mips-tdep.c 8 Aug 2002 21:48:09 -0000
*************** mips_eabi_use_struct_convention (int gcc
*** 574,580 ****
  int
  mips_n32n64_use_struct_convention (int gcc_p, struct type *type)
  {
!   return 1;   /* Structures are returned by ref in extra arg0.  */
  }
  
  int
--- 574,580 ----
  int
  mips_n32n64_use_struct_convention (int gcc_p, struct type *type)
  {
!   return (TYPE_LENGTH (type) > 2 * MIPS_SAVED_REGSIZE);
  }
  
  int
*************** return_value_location (struct type *valt
*** 3608,3622 ****
        if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
          && len < MIPS_SAVED_REGSIZE)
        {
!         /* "un-left-justify" the value in the low register */
!         lo->reg_offset = MIPS_SAVED_REGSIZE - len;
!         lo->len = len;
          hi->reg_offset = 0;
          hi->len = 0;
        }
        else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
               && len > MIPS_SAVED_REGSIZE      /* odd-size structs */
               && len < MIPS_SAVED_REGSIZE * 2
               && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
                   TYPE_CODE (valtype) == TYPE_CODE_UNION))
        {
--- 3608,3635 ----
        if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
          && len < MIPS_SAVED_REGSIZE)
        {
!         if ((gdbarch_tdep (current_gdbarch) -> mips_abi ==
MIPS_ABI_N32 
!              || gdbarch_tdep (current_gdbarch) -> mips_abi ==
MIPS_ABI_N64)
!             && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT 
!                 || TYPE_CODE (valtype) == TYPE_CODE_UNION))
!           {
!             /* Values are already aligned in the low register.  */
!             lo->reg_offset = 0;
!           }
!         else
!           {
!             /* "un-left-justify" the value in the low register */
!             lo->reg_offset = MIPS_SAVED_REGSIZE - len;
!           }
          hi->reg_offset = 0;
+         lo->len = len;
          hi->len = 0;
        }
        else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
               && len > MIPS_SAVED_REGSIZE      /* odd-size structs */
               && len < MIPS_SAVED_REGSIZE * 2
+              && gdbarch_tdep (current_gdbarch) -> mips_abi !=
MIPS_ABI_N32 
+              && gdbarch_tdep (current_gdbarch) -> mips_abi !=
MIPS_ABI_N64
               && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT ||
                   TYPE_CODE (valtype) == TYPE_CODE_UNION))
        {


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