2008-01-30 Thiago Jung Bauermann * ppc-tdep.h (struct gdbarch_tdep): Remove ppc_ev31_regnum member. * rs6000-tdep.c (IS_SPE_PSEUDOREG): New macro. (spe_register_p, rs6000_register_name, rs6000_pseudo_register_type, rs6000_pseudo_register_reggroup_p, e500_move_ev_register, e500_pseudo_register_read, e500_pseudo_register_write): Use IS_SPE_PSEUDOREG macro. (rs6000_frame_cache): Remove use of tdep->ppc_ev31_regnum. (rs6000_gdbarch_init): Remove unnecessary num_sprs local variable. Remove initialization of tdep->ppc_ev31_regnum. diff -r efbf5d3c6cd9 -r 168620c4b9da gdb/ppc-tdep.h --- a/gdb/ppc-tdep.h Mon Jan 28 03:15:08 2008 -0800 +++ b/gdb/ppc-tdep.h Wed Jan 30 16:49:16 2008 -0200 @@ -201,7 +201,6 @@ struct gdbarch_tdep /* SPE registers. */ int ppc_ev0_upper_regnum; /* First GPR upper half register */ int ppc_ev0_regnum; /* First ev register */ - int ppc_ev31_regnum; /* Last ev register */ int ppc_acc_regnum; /* SPE 'acc' register */ int ppc_spefscr_regnum; /* SPE 'spefscr' register */ diff -r efbf5d3c6cd9 -r 168620c4b9da gdb/rs6000-tdep.c --- a/gdb/rs6000-tdep.c Mon Jan 28 03:15:08 2008 -0800 +++ b/gdb/rs6000-tdep.c Wed Jan 30 16:49:16 2008 -0200 @@ -77,6 +77,11 @@ #include "features/rs6000/powerpc-860.c" #include "features/rs6000/powerpc-e500.c" #include "features/rs6000/rs6000.c" + +/* Determine if regnum is an SPE pseudo-register. */ +#define IS_SPE_PSEUDOREG(tdep, regnum) ((tdep)->ppc_ev0_regnum >= 0 \ + && (regnum) >= (tdep)->ppc_ev0_regnum \ + && (regnum) < (tdep)->ppc_ev0_regnum + 32) /* The list of available "set powerpc ..." and "show powerpc ..." commands. */ @@ -179,9 +184,7 @@ spe_register_p (struct gdbarch *gdbarch, struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); /* Is it a reference to EV0 -- EV31, and do we have those? */ - if (tdep->ppc_ev0_regnum >= 0 - && tdep->ppc_ev31_regnum >= 0 - && tdep->ppc_ev0_regnum <= regno && regno <= tdep->ppc_ev31_regnum) + if (IS_SPE_PSEUDOREG (tdep, regno)) return 1; /* Is it a reference to one of the raw upper GPR halves? */ @@ -2371,9 +2374,7 @@ rs6000_register_name (struct gdbarch *gd return ""; /* Check if the SPE pseudo registers are available. */ - if (tdep->ppc_ev0_regnum >= 0 - && tdep->ppc_ev0_regnum <= regno - && regno < tdep->ppc_ev0_regnum + ppc_num_gprs) + if (IS_SPE_PSEUDOREG (tdep, regno)) { static const char *const spe_regnames[] = { "ev0", "ev1", "ev2", "ev3", "ev4", "ev5", "ev6", "ev7", @@ -2396,9 +2397,7 @@ rs6000_pseudo_register_type (struct gdba struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); /* These are the only pseudo-registers we support. */ - gdb_assert (tdep->ppc_ev0_regnum >= 0 - && regnum >= tdep->ppc_ev0_regnum - && regnum < tdep->ppc_ev0_regnum + 32); + gdb_assert (IS_SPE_PSEUDOREG (tdep, regnum)); return rs6000_builtin_type_vec64 (gdbarch); } @@ -2411,9 +2410,7 @@ rs6000_pseudo_register_reggroup_p (struc struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); /* These are the only pseudo-registers we support. */ - gdb_assert (tdep->ppc_ev0_regnum >= 0 - && regnum >= tdep->ppc_ev0_regnum - && regnum < tdep->ppc_ev0_regnum + 32); + gdb_assert (IS_SPE_PSEUDOREG (tdep, regnum)); if (group == all_reggroup || group == vector_reggroup) return 1; @@ -2499,8 +2496,7 @@ e500_move_ev_register (void (*move) (str int reg_index; gdb_byte *byte_buffer = buffer; - gdb_assert (tdep->ppc_ev0_regnum <= ev_reg - && ev_reg < tdep->ppc_ev0_regnum + ppc_num_gprs); + gdb_assert (IS_SPE_PSEUDOREG (tdep, ev_reg)); reg_index = ev_reg - tdep->ppc_ev0_regnum; @@ -2525,8 +2521,7 @@ e500_pseudo_register_read (struct gdbarc gdb_assert (regcache_arch == gdbarch); - if (tdep->ppc_ev0_regnum <= reg_nr - && reg_nr < tdep->ppc_ev0_regnum + ppc_num_gprs) + if (IS_SPE_PSEUDOREG (tdep, reg_nr)) e500_move_ev_register (regcache_raw_read, regcache, reg_nr, buffer); else internal_error (__FILE__, __LINE__, @@ -2544,8 +2539,7 @@ e500_pseudo_register_write (struct gdbar gdb_assert (regcache_arch == gdbarch); - if (tdep->ppc_ev0_regnum <= reg_nr - && reg_nr < tdep->ppc_ev0_regnum + ppc_num_gprs) + if (IS_SPE_PSEUDOREG (tdep, reg_nr)) e500_move_ev_register ((void (*) (struct regcache *, int, gdb_byte *)) regcache_raw_write, regcache, reg_nr, (gdb_byte *) buffer); @@ -2986,7 +2980,7 @@ rs6000_frame_cache (struct frame_info *n /* if != -1, fdata.saved_ev is the smallest number of saved_ev. All vr's from saved_ev to ev31 are saved. ????? */ - if (tdep->ppc_ev0_regnum != -1 && tdep->ppc_ev31_regnum != -1) + if (tdep->ppc_ev0_regnum != -1) { if (fdata.saved_ev >= 0) { @@ -3178,7 +3172,6 @@ rs6000_gdbarch_init (struct gdbarch_info int tdesc_wordsize = -1; const struct target_desc *tdesc = info.target_desc; struct tdesc_arch_data *tdesc_data = NULL; - int num_sprs = 0; from_xcoff_exec = info.abfd && info.abfd->format == bfd_object && bfd_get_flavour (info.abfd) == bfd_target_xcoff_flavour; @@ -3609,7 +3602,7 @@ rs6000_gdbarch_init (struct gdbarch_info else set_gdbarch_print_insn (gdbarch, gdb_print_insn_powerpc); - set_gdbarch_num_regs (gdbarch, PPC_NUM_REGS + num_sprs); + set_gdbarch_num_regs (gdbarch, PPC_NUM_REGS); set_gdbarch_num_pseudo_regs (gdbarch, have_spe ? 32 : 0); set_gdbarch_ptr_bit (gdbarch, wordsize * TARGET_CHAR_BIT); @@ -3732,7 +3725,6 @@ rs6000_gdbarch_init (struct gdbarch_info /* Recording the numbering of pseudo registers. */ tdep->ppc_ev0_regnum = have_spe ? gdbarch_num_regs (gdbarch) : -1; - tdep->ppc_ev31_regnum = have_spe ? tdep->ppc_ev0_regnum + 31 : -1; return gdbarch; }