From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10250 invoked by alias); 10 Aug 2002 00:37:14 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 10243 invoked from network); 10 Aug 2002 00:37:14 -0000 Received: from unknown (HELO cygnus.com) (205.180.83.203) by sources.redhat.com with SMTP; 10 Aug 2002 00:37:14 -0000 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id RAA25537; Fri, 9 Aug 2002 17:34:36 -0700 (PDT) Message-ID: <3D545BC7.B41142D4@redhat.com> Date: Fri, 09 Aug 2002 17:37:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Accept-Language: en MIME-Version: 1.0 To: Andrew Cagney CC: gdb-patches@sources.redhat.com Subject: Re: [RFA] Mips, return_value_location, small structs References: <3D5438A9.5F0FA8A8@redhat.com> <3D545AB2.4030803@ges.redhat.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-08/txt/msg00228.txt.bz2 Andrew Cagney wrote: > > > Re-submitted as a separate patch. > > > > The problem: small structs returned in one (or two) registers > > are aligned left in N32/N64 and aligned right in the others > > (or vice versa, depending on how you cross your eyes). > > I _think_ you also need to add o32. Can you check that out? Just post > the results, not the patch. I know o32 needs work too, but the two can be treated separately. I do guarantee that this patch does not make o32 any worse. In fact, I have been testing to make sure that none of my patches have made o32 any worse. Can I check this one in for n32, if I promise to work on o32 next? > > Andrew > > > There are two code paths here, one for structs of length < MIPS_REGSIZE, > > and one for MIPS_REGSIZE < struct len < 2 * MIPS_REGSIZE. > > > > The first case I've split into two paths: one for N32 && > > TYPE_CODE_STRUCT, > > and a second for everything else (the later being identical to what was > > there before). > > > > In the second case, I've simply let the N32/N64 path fall thru. > > The next "if" catches it and handles it correctly. > > > > > > > > 2002-08-08 Michael Snyder > > > > * mips-tdep.c (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 > > *************** 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)) > > {