From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21426 invoked by alias); 2 May 2007 13:07:56 -0000 Received: (qmail 21200 invoked by uid 22791); 2 May 2007 13:07:54 -0000 X-Spam-Check-By: sourceware.org Received: from dmz.mips-uk.com (HELO dmz.mips-uk.com) (194.74.144.194) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 02 May 2007 13:07:49 +0000 Received: from internal-mx1 ([192.168.192.240] helo=ukservices1.mips.com) by dmz.mips-uk.com with esmtp (Exim 3.35 #1 (Debian)) id 1HjEYU-0001MX-00; Wed, 02 May 2007 14:07:38 +0100 Received: from perivale.mips.com ([192.168.192.200]) by ukservices1.mips.com with esmtp (Exim 3.36 #1 (Debian)) id 1HjEY5-0005LY-00; Wed, 02 May 2007 14:07:13 +0100 Received: from macro (helo=localhost) by perivale.mips.com with local-esmtp (Exim 4.63) (envelope-from ) id 1HjEY4-0001Zd-Vu; Wed, 02 May 2007 14:07:12 +0100 Date: Wed, 02 May 2007 13:07:00 -0000 From: "Maciej W. Rozycki" To: Daniel Jacobowitz cc: gdb-patches@sourceware.org, "Maciej W. Rozycki" , Eli Zaretskii Subject: Re: [rfc] Propagate constants into MIPS ABI routines, remove some knobs In-Reply-To: <20070501203647.GB23630@caradoc.them.org> Message-ID: References: <20070501203647.GB23630@caradoc.them.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MIPS-Technologies-UK-MailScanner: Found to be clean X-MIPS-Technologies-UK-MailScanner-From: macro@mips.com Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-05/txt/msg00029.txt.bz2 Daniel, > Maciej, do you know of anyone who needs to use the stack-arg-size / > saved-gpreg-size commands? I couldn't find any uses when I searched > for them. I didn't touch the FP options in this pass. I may have to > later; I'm rearranging the use of "abi-sized" registers so that MIPS > doesn't have to have its pseudo-registers, since they make it > difficult to use the XML register descriptions in the same way ARM > now can. This is the first time I see these commands -- certainly I will not miss them nor have an idea about anyone who would. > Tested mips64-linux, all three ABIs. I'd like to commit this if no > one objects, but I'll definitely wait a bit for comments. Eli, > docs OK? It seems fine for me. I was about to submit the change I promised a while ago -- to remove some pointless calls to mips_abi_regsize() -- but yours actually does all of that already (modulo some cosmetic clean-ups). I'd be happier if the change was done in two steps though as it groups two independent sets. Perhaps indeed it should? Here's my change: 2007-04-18 Maciej W. Rozycki * mips-tdep.c (mips_o32_push_dummy_call): Remove conditions based on mips_abi_regsize() whose result is known in advance. (mips_o64_push_dummy_call): Likewise. Maciej mips_abi_regsize.diff Index: binutils-quilt/src/gdb/mips-tdep.c =================================================================== --- binutils-quilt.orig/src/gdb/mips-tdep.c 2007-04-18 09:45:07.000000000 +0100 +++ binutils-quilt/src/gdb/mips-tdep.c 2007-04-18 09:46:11.000000000 +0100 @@ -3069,8 +3069,7 @@ int arglen = TYPE_LENGTH (arg_type); /* Align to double-word if necessary. */ - if (mips_abi_regsize (gdbarch) < 8 - && mips_type_needs_double_align (arg_type)) + if (mips_type_needs_double_align (arg_type)) len = align_up (len, mips_stack_argsize (gdbarch) * 2); /* Allocate space on the stack. */ len += align_up (arglen, mips_stack_argsize (gdbarch)); @@ -3120,8 +3119,7 @@ up before the check to see if there are any FP registers left. O32/O64 targets also pass the FP in the integer registers so also round up normal registers. */ - if (mips_abi_regsize (gdbarch) < 8 - && fp_register_arg_p (typecode, arg_type)) + if (fp_register_arg_p (typecode, arg_type)) { if ((float_argreg & 1)) float_argreg++; @@ -3187,7 +3185,7 @@ fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s", argreg, phex (regval, len)); write_register (argreg, regval); - argreg += (mips_abi_regsize (gdbarch) == 8) ? 1 : 2; + argreg += 2; } /* Reserve space for the FP register. */ stack_offset += align_up (len, mips_stack_argsize (gdbarch)); @@ -3206,8 +3204,7 @@ && (len % mips_abi_regsize (gdbarch) != 0)); /* Structures should be aligned to eight bytes (even arg registers) on MIPS_ABI_O32, if their first member has double precision. */ - if (mips_abi_regsize (gdbarch) < 8 - && mips_type_needs_double_align (arg_type)) + if (mips_type_needs_double_align (arg_type)) { if ((argreg & 1)) { @@ -3303,8 +3300,7 @@ identified as such and GDB gets tweaked accordingly. */ - if (mips_abi_regsize (gdbarch) < 8 - && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG && partial_len < mips_abi_regsize (gdbarch) && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)) @@ -3529,10 +3525,6 @@ struct type *arg_type = check_typedef (value_type (args[argnum])); int arglen = TYPE_LENGTH (arg_type); - /* Align to double-word if necessary. */ - if (mips_abi_regsize (gdbarch) < 8 - && mips_type_needs_double_align (arg_type)) - len = align_up (len, mips_stack_argsize (gdbarch) * 2); /* Allocate space on the stack. */ len += align_up (arglen, mips_stack_argsize (gdbarch)); } @@ -3576,18 +3568,6 @@ val = value_contents (arg); - /* 32-bit ABIs always start floating point arguments in an - even-numbered floating point register. Round the FP register - up before the check to see if there are any FP registers - left. O32/O64 targets also pass the FP in the integer - registers so also round up normal registers. */ - if (mips_abi_regsize (gdbarch) < 8 - && fp_register_arg_p (typecode, arg_type)) - { - if ((float_argreg & 1)) - float_argreg++; - } - /* Floating point arguments passed in registers have to be treated specially. On 32-bit architectures, doubles are passed in register pairs; the even register gets @@ -3601,55 +3581,16 @@ if (fp_register_arg_p (typecode, arg_type) && float_argreg <= MIPS_LAST_FP_ARG_REGNUM) { - if (mips_abi_regsize (gdbarch) < 8 && len == 8) - { - int low_offset = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? 4 : 0; - unsigned long regval; - - /* Write the low word of the double to the even register(s). */ - regval = extract_unsigned_integer (val + low_offset, 4); - if (mips_debug) - fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s", - float_argreg, phex (regval, 4)); - write_register (float_argreg++, regval); - if (mips_debug) - fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s", - argreg, phex (regval, 4)); - write_register (argreg++, regval); - - /* Write the high word of the double to the odd register(s). */ - regval = extract_unsigned_integer (val + 4 - low_offset, 4); - if (mips_debug) - fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s", - float_argreg, phex (regval, 4)); - write_register (float_argreg++, regval); - - if (mips_debug) - fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s", - argreg, phex (regval, 4)); - write_register (argreg++, regval); - } - else - { - /* This is a floating point value that fits entirely - in a single register. */ - /* On 32 bit ABI's the float_argreg is further adjusted - above to ensure that it is even register aligned. */ - LONGEST regval = extract_unsigned_integer (val, len); - if (mips_debug) - fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s", - float_argreg, phex (regval, len)); - write_register (float_argreg++, regval); - /* CAGNEY: 32 bit MIPS ABI's always reserve two FP - registers for each argument. The below is (my - guess) to ensure that the corresponding integer - register has reserved the same space. */ - if (mips_debug) - fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s", - argreg, phex (regval, len)); - write_register (argreg, regval); - argreg += (mips_abi_regsize (gdbarch) == 8) ? 1 : 2; - } + LONGEST regval = extract_unsigned_integer (val, len); + if (mips_debug) + fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s", + float_argreg, phex (regval, len)); + write_register (float_argreg++, regval); + if (mips_debug) + fprintf_unfiltered (gdb_stdlog, " - reg=%d val=%s", + argreg, phex (regval, len)); + write_register (argreg, regval); + argreg++; /* Reserve space for the FP register. */ stack_offset += align_up (len, mips_stack_argsize (gdbarch)); } @@ -3665,17 +3606,6 @@ both places. */ int odd_sized_struct = ((len > mips_abi_regsize (gdbarch)) && (len % mips_abi_regsize (gdbarch) != 0)); - /* Structures should be aligned to eight bytes (even arg registers) - on MIPS_ABI_O32, if their first member has double precision. */ - if (mips_abi_regsize (gdbarch) < 8 - && mips_type_needs_double_align (arg_type)) - { - if ((argreg & 1)) - { - argreg++; - stack_offset += mips_abi_regsize (gdbarch); - } - } while (len > 0) { /* Remember if the argument was written to the stack. */