From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14895 invoked by alias); 21 May 2003 16:17:45 -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 14631 invoked from network); 21 May 2003 16:17:39 -0000 Received: from unknown (HELO localhost.redhat.com) (207.219.125.131) by sources.redhat.com with SMTP; 21 May 2003 16:17:39 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id A838E2B5A; Wed, 21 May 2003 12:17:31 -0400 (EDT) Message-ID: <3ECBA69B.1060108@redhat.com> Date: Wed, 21 May 2003 16:17:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Buettner Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] MIPS: MIPS_LAST_FP_ARG_REGNUM, MIPS_LAST_ARG_REGNUM changes References: <1030519215125.ZM24993@localhost.localdomain> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-05/txt/msg00385.txt.bz2 > This is patch 2 of many more to come. It depends upon > http://sources.redhat.com/ml/gdb-patches/2003-05/msg00268.html. > > Okay? Per my earlier comment, I don't think this one is right. I don't think things like LAST_ARG_REGNUM belong in that cooked/raw reg structure. Instead, they should exist out side it. If the code really wants to differentiate between the raw and cooked register number, why not use the more explicit: rawnum->gp0_regnum + tdep->last_arg_regnum Andrew > mips-tdep.c (struct gdbarch_tdep): Delete fields. > mips_last_arg_regnum and (mips_last_fp_arg_regnum. > (MIPS_LAST_FP_ARG_REGNUM, MIPS_LAST_ARG_REGNUM): Delete. > (mips_init_extra_frame_info, mips_eabi_push_arguments) > (mipsn32n64_push_arguments, mips_o32_push_arguments) > (mips_o64_push_arguments): Replace references to MIPS_LAST_ARG_REGNUM > and MIPS_LAST_FP_ARG_REGNUM with references to fields > ``last_arg_regnum'' and ``last_fp_arg_regnum'', respectively, of > the mips_regnums struct. > (mips_gdbarch_init): Delete initializations for > ``mips_last_arg_regnum'' and ``mips_last_fp_arg_regnum'' of > ``struct gdbarch_tdep''. > (mips_dump_tdep): Don't dump MIPS_LAST_FP_ARG_REGNUM or > MIPS_LAST_ARG_REGNUM. > > diff -upr ../../src1/gdb/mips-tdep.c ./mips-tdep.c > --- ../../src1/gdb/mips-tdep.c Mon May 19 13:41:51 2003 > +++ ./mips-tdep.c Mon May 19 14:21:24 2003 > @@ -124,8 +124,6 @@ struct gdbarch_tdep > enum mips_abi mips_abi; > enum mips_abi found_abi; > enum mips_fpu_type mips_fpu_type; > - int mips_last_arg_regnum; > - int mips_last_fp_arg_regnum; > int mips_default_saved_regsize; > int mips_fp_register_double; > int mips_default_stack_argsize; > @@ -139,10 +137,6 @@ struct gdbarch_tdep > #define MIPS_EABI (gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI32 \ > || gdbarch_tdep (current_gdbarch)->mips_abi == MIPS_ABI_EABI64) > > -#define MIPS_LAST_FP_ARG_REGNUM (gdbarch_tdep (current_gdbarch)->mips_last_fp_arg_regnum) > - > -#define MIPS_LAST_ARG_REGNUM (gdbarch_tdep (current_gdbarch)->mips_last_arg_regnum) > - > #define MIPS_FPU_TYPE (gdbarch_tdep (current_gdbarch)->mips_fpu_type) > > /* Return the currently configured (or set) saved register size. */ > @@ -2547,6 +2541,7 @@ mips_init_extra_frame_info (int fromleaf > { > int regnum; > mips_extra_func_info_t proc_desc; > + const struct mips_regnums *cookednums = mips_cooked_regnums (current_gdbarch); > > if (get_frame_type (fci) == DUMMY_FRAME) > return; > @@ -2618,7 +2613,7 @@ mips_init_extra_frame_info (int fromleaf > /* hack: if argument regs are saved, guess these contain args */ > /* assume we can't tell how many args for now */ > get_frame_extra_info (fci)->num_args = -1; > - for (regnum = MIPS_LAST_ARG_REGNUM; regnum >= A0_REGNUM; regnum--) > + for (regnum = cookednums->last_arg_regnum; regnum >= A0_REGNUM; regnum--) > { > if (PROC_REG_MASK (proc_desc) & (1 << regnum)) > { > @@ -2725,6 +2720,8 @@ mips_eabi_push_arguments (int nargs, > int argnum; > int len = 0; > int stack_offset = 0; > + /* This function needs to be converted to use cooked regnums. */ > + const struct mips_regnums *rawnums = mips_raw_regnums (current_gdbarch); > > /* First ensure that the stack and structure return address (if any) > are properly aligned. The stack has to be at least 64-bit > @@ -2819,7 +2816,7 @@ mips_eabi_push_arguments (int nargs, > point value into an FP register instead of pushing it onto the > stack. */ > if (fp_register_arg_p (typecode, arg_type) > - && float_argreg <= MIPS_LAST_FP_ARG_REGNUM) > + && float_argreg <= rawnums->last_fp_arg_regnum) > { > if (!FP_REGISTER_DOUBLE && len == 8) > { > @@ -2879,7 +2876,7 @@ mips_eabi_push_arguments (int nargs, > partial_len); > > /* Write this portion of the argument to the stack. */ > - if (argreg > MIPS_LAST_ARG_REGNUM > + if (argreg > rawnums->last_arg_regnum > || odd_sized_struct > || fp_register_arg_p (typecode, arg_type)) > { > @@ -2930,7 +2927,7 @@ mips_eabi_push_arguments (int nargs, > arguments will not. */ > /* Write this portion of the argument to a general > purpose register. */ > - if (argreg <= MIPS_LAST_ARG_REGNUM > + if (argreg <= rawnums->last_arg_regnum > && !fp_register_arg_p (typecode, arg_type)) > { > LONGEST regval = extract_unsigned_integer (val, partial_len); > @@ -2978,6 +2975,8 @@ mips_n32n64_push_arguments (int nargs, > int argnum; > int len = 0; > int stack_offset = 0; > + /* This function needs to be converted to use cooked regnums. */ > + const struct mips_regnums *rawnums = mips_raw_regnums (current_gdbarch); > > /* First ensure that the stack and structure return address (if any) > are properly aligned. The stack has to be at least 64-bit > @@ -3033,7 +3032,7 @@ mips_n32n64_push_arguments (int nargs, > val = (char *) VALUE_CONTENTS (arg); > > if (fp_register_arg_p (typecode, arg_type) > - && float_argreg <= MIPS_LAST_FP_ARG_REGNUM) > + && float_argreg <= rawnums->last_fp_arg_regnum) > { > /* This is a floating point value that fits entirely > in a single register. */ > @@ -3076,7 +3075,7 @@ mips_n32n64_push_arguments (int nargs, > partial_len); > > /* Write this portion of the argument to the stack. */ > - if (argreg > MIPS_LAST_ARG_REGNUM > + if (argreg > rawnums->last_arg_regnum > || odd_sized_struct > || fp_register_arg_p (typecode, arg_type)) > { > @@ -3123,7 +3122,7 @@ mips_n32n64_push_arguments (int nargs, > arguments will not. */ > /* Write this portion of the argument to a general > purpose register. */ > - if (argreg <= MIPS_LAST_ARG_REGNUM > + if (argreg <= rawnums->last_arg_regnum > && !fp_register_arg_p (typecode, arg_type)) > { > LONGEST regval = extract_unsigned_integer (val, partial_len); > @@ -3200,6 +3199,8 @@ mips_o32_push_arguments (int nargs, > int argnum; > int len = 0; > int stack_offset = 0; > + /* This function needs to be converted to use cooked regnums. */ > + const struct mips_regnums *rawnums = mips_raw_regnums (current_gdbarch); > > /* First ensure that the stack and structure return address (if any) > are properly aligned. The stack has to be at least 64-bit > @@ -3278,7 +3279,7 @@ mips_o32_push_arguments (int nargs, > because those registers are normally skipped. */ > > if (fp_register_arg_p (typecode, arg_type) > - && float_argreg <= MIPS_LAST_FP_ARG_REGNUM) > + && float_argreg <= rawnums->last_fp_arg_regnum) > { > if (!FP_REGISTER_DOUBLE && len == 8) > { > @@ -3365,7 +3366,7 @@ mips_o32_push_arguments (int nargs, > partial_len); > > /* Write this portion of the argument to the stack. */ > - if (argreg > MIPS_LAST_ARG_REGNUM > + if (argreg > rawnums->last_arg_regnum > || odd_sized_struct > || fp_register_arg_p (typecode, arg_type)) > { > @@ -3412,7 +3413,7 @@ mips_o32_push_arguments (int nargs, > arguments will not. */ > /* Write this portion of the argument to a general > purpose register. */ > - if (argreg <= MIPS_LAST_ARG_REGNUM > + if (argreg <= rawnums->last_arg_regnum > && !fp_register_arg_p (typecode, arg_type)) > { > LONGEST regval = extract_signed_integer (val, partial_len); > @@ -3460,7 +3461,7 @@ mips_o32_push_arguments (int nargs, > > /* Prevent subsequent floating point arguments from > being passed in floating point registers. */ > - float_argreg = MIPS_LAST_FP_ARG_REGNUM + 1; > + float_argreg = rawnums->last_fp_arg_regnum + 1; > } > > len -= partial_len; > @@ -3499,6 +3500,8 @@ mips_o64_push_arguments (int nargs, > int argnum; > int len = 0; > int stack_offset = 0; > + /* This function needs to be converted to use cooked regnums. */ > + const struct mips_regnums *rawnums = mips_raw_regnums (current_gdbarch); > > /* First ensure that the stack and structure return address (if any) > are properly aligned. The stack has to be at least 64-bit > @@ -3577,7 +3580,7 @@ mips_o64_push_arguments (int nargs, > because those registers are normally skipped. */ > > if (fp_register_arg_p (typecode, arg_type) > - && float_argreg <= MIPS_LAST_FP_ARG_REGNUM) > + && float_argreg <= rawnums->last_fp_arg_regnum) > { > if (!FP_REGISTER_DOUBLE && len == 8) > { > @@ -3664,7 +3667,7 @@ mips_o64_push_arguments (int nargs, > partial_len); > > /* Write this portion of the argument to the stack. */ > - if (argreg > MIPS_LAST_ARG_REGNUM > + if (argreg > rawnums->last_arg_regnum > || odd_sized_struct > || fp_register_arg_p (typecode, arg_type)) > { > @@ -3711,7 +3714,7 @@ mips_o64_push_arguments (int nargs, > arguments will not. */ > /* Write this portion of the argument to a general > purpose register. */ > - if (argreg <= MIPS_LAST_ARG_REGNUM > + if (argreg <= rawnums->last_arg_regnum > && !fp_register_arg_p (typecode, arg_type)) > { > LONGEST regval = extract_signed_integer (val, partial_len); > @@ -3759,7 +3762,7 @@ mips_o64_push_arguments (int nargs, > > /* Prevent subsequent floating point arguments from > being passed in floating point registers. */ > - float_argreg = MIPS_LAST_FP_ARG_REGNUM + 1; > + float_argreg = rawnums->last_fp_arg_regnum + 1; > } > > len -= partial_len; > @@ -5797,8 +5800,6 @@ mips_gdbarch_init (struct gdbarch_info i > tdep->mips_default_saved_regsize = 4; > tdep->mips_default_stack_argsize = 4; > tdep->mips_fp_register_double = 0; > - tdep->mips_last_arg_regnum = A0_REGNUM + 4 - 1; /* delete in next patch */ > - tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 4 - 1; /* delete in next patch */ > tdep->raw_regnums.last_arg_regnum = tdep->raw_regnums.a0_regnum + 4 - 1; > tdep->raw_regnums.last_fp_arg_regnum = tdep->raw_regnums.fpa0_regnum + 4 - 1; > tdep->gdb_target_is_mips64 = 0; > @@ -5818,8 +5819,6 @@ mips_gdbarch_init (struct gdbarch_info i > tdep->mips_default_saved_regsize = 8; > tdep->mips_default_stack_argsize = 8; > tdep->mips_fp_register_double = 1; > - tdep->mips_last_arg_regnum = A0_REGNUM + 4 - 1; /* delete in next patch */ > - tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 4 - 1; /* delete in next patch */ > tdep->raw_regnums.last_arg_regnum = tdep->raw_regnums.a0_regnum + 4 - 1; > tdep->raw_regnums.last_fp_arg_regnum = tdep->raw_regnums.fpa0_regnum + 4 - 1; > tdep->gdb_target_is_mips64 = 1; > @@ -5839,8 +5838,6 @@ mips_gdbarch_init (struct gdbarch_info i > tdep->mips_default_saved_regsize = 4; > tdep->mips_default_stack_argsize = 4; > tdep->mips_fp_register_double = 0; > - tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1; /* delete in next patch */ > - tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1; /* delete in next patch */ > tdep->raw_regnums.last_arg_regnum = tdep->raw_regnums.a0_regnum + 8 - 1; > tdep->raw_regnums.last_fp_arg_regnum = tdep->raw_regnums.fpa0_regnum + 8 - 1; > tdep->gdb_target_is_mips64 = 0; > @@ -5860,8 +5857,6 @@ mips_gdbarch_init (struct gdbarch_info i > tdep->mips_default_saved_regsize = 8; > tdep->mips_default_stack_argsize = 8; > tdep->mips_fp_register_double = 1; > - tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1; /* delete in next patch */ > - tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1; /* delete in next patch */ > tdep->raw_regnums.last_arg_regnum = tdep->raw_regnums.a0_regnum + 8 - 1; > tdep->raw_regnums.last_fp_arg_regnum = tdep->raw_regnums.fpa0_regnum + 8 - 1; > tdep->gdb_target_is_mips64 = 1; > @@ -5881,8 +5876,6 @@ mips_gdbarch_init (struct gdbarch_info i > tdep->mips_default_saved_regsize = 8; > tdep->mips_default_stack_argsize = 8; > tdep->mips_fp_register_double = 1; > - tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1; /* delete in next patch */ > - tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1; /* delete in next patch */ > tdep->raw_regnums.last_arg_regnum = tdep->raw_regnums.a0_regnum + 8 - 1; > tdep->raw_regnums.last_fp_arg_regnum = tdep->raw_regnums.fpa0_regnum + 8 - 1; > tdep->gdb_target_is_mips64 = 1; > @@ -5902,8 +5895,6 @@ mips_gdbarch_init (struct gdbarch_info i > tdep->mips_default_saved_regsize = 8; > tdep->mips_default_stack_argsize = 8; > tdep->mips_fp_register_double = 1; > - tdep->mips_last_arg_regnum = A0_REGNUM + 8 - 1; /* delete in next patch */ > - tdep->mips_last_fp_arg_regnum = FPA0_REGNUM + 8 - 1; /* delete in next patch */ > tdep->raw_regnums.last_arg_regnum = tdep->raw_regnums.a0_regnum + 8 - 1; > tdep->raw_regnums.last_fp_arg_regnum = tdep->raw_regnums.fpa0_regnum + 8 - 1; > tdep->gdb_target_is_mips64 = 1; > @@ -6249,10 +6240,6 @@ mips_dump_tdep (struct gdbarch *current_ > "mips_dump_tdep: MIPS_EABI = %d\n", > MIPS_EABI); > fprintf_unfiltered (file, > - "mips_dump_tdep: MIPS_LAST_FP_ARG_REGNUM = %d (%d regs)\n", > - MIPS_LAST_FP_ARG_REGNUM, > - MIPS_LAST_FP_ARG_REGNUM - FPA0_REGNUM + 1); > - fprintf_unfiltered (file, > "mips_dump_tdep: MIPS_FPU_TYPE = %d (%s)\n", > MIPS_FPU_TYPE, > (MIPS_FPU_TYPE == MIPS_FPU_NONE ? "none" > @@ -6361,10 +6348,6 @@ mips_dump_tdep (struct gdbarch *current_ > "mips_dump_tdep: MIPS_INSTLEN = %d\n", > MIPS_INSTLEN); > fprintf_unfiltered (file, > - "mips_dump_tdep: MIPS_LAST_ARG_REGNUM = %d (%d regs)\n", > - MIPS_LAST_ARG_REGNUM, > - MIPS_LAST_ARG_REGNUM - A0_REGNUM + 1); > - fprintf_unfiltered (file, > "mips_dump_tdep: MIPS_NUMREGS = %d\n", > MIPS_NUMREGS); > fprintf_unfiltered (file, > >