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: Add register number members for SPE acc and spefscr registers


2004-05-18  Jim Blandy  <jimb@redhat.com>

	* ppc-tdep.h (spe_register_p): New declaration.
	(struct gdbarch_tdep): New members: ppc_acc_regnum and
	ppc_spefscr_regnum.
	* rs6000-tdep.c (spe_register_p): New function.
	(rs6000_dwarf2_stab_reg_to_regnum): Recognize numbers for acc and
	spefscr.
	(rs6000_gdbarch_init): Initialize the new members of the tdep
	structure.

Index: gdb/ppc-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/ppc-tdep.h,v
retrieving revision 1.34
diff -c -p -r1.34 ppc-tdep.h
*** gdb/ppc-tdep.h	11 May 2004 04:55:31 -0000	1.34
--- gdb/ppc-tdep.h	19 May 2004 05:00:25 -0000
*************** enum return_value_convention ppc64_sysv_
*** 73,78 ****
--- 73,79 ----
  
  /* From rs6000-tdep.c... */
  int altivec_register_p (int regno);
+ int spe_register_p (int regno);
  
  /* Return non-zero if the architecture described by GDBARCH has
     floating-point registers (f0 --- f31 and fpscr).  */
*************** struct gdbarch_tdep
*** 162,167 ****
--- 163,170 ----
      int ppc_vrsave_regnum;	/* Last AltiVec 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 */
      int lr_frame_offset;	/* Offset to ABI specific location where
                                     link register is saved.  */
  };
Index: gdb/rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.206
diff -c -p -r1.206 rs6000-tdep.c
*** gdb/rs6000-tdep.c	19 May 2004 04:18:42 -0000	1.206
--- gdb/rs6000-tdep.c	19 May 2004 05:00:27 -0000
*************** altivec_register_p (int regno)
*** 141,146 ****
--- 141,173 ----
  }
  
  
+ /* Return true if REGNO is an SPE register, false otherwise.  */
+ int
+ spe_register_p (int regno)
+ {
+   struct gdbarch_tdep *tdep = gdbarch_tdep (current_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)
+     return 1;
+ 
+   /* Is it a reference to the 64-bit accumulator, and do we have that?  */
+   if (tdep->ppc_acc_regnum >= 0
+       && tdep->ppc_acc_regnum == regno)
+     return 1;
+ 
+   /* Is it a reference to the SPE floating-point status and control register,
+      and do we have that?  */
+   if (tdep->ppc_spefscr_regnum >= 0
+       && tdep->ppc_spefscr_regnum == regno)
+     return 1;
+ 
+   return 0;
+ }
+ 
+ 
  /* Return non-zero if the architecture described by GDBARCH has
     floating-point registers (f0 --- f31 and fpscr).  */
  int
*************** rs6000_dwarf2_stab_reg_to_regnum (int nu
*** 1829,1834 ****
--- 1856,1865 ----
          return tdep->ppc_xer_regnum;
        case 109:
          return tdep->ppc_vrsave_regnum;
+       case 111:
+         return gdbarch_tdep (current_gdbarch)->ppc_acc_regnum;
+       case 112:
+         return gdbarch_tdep (current_gdbarch)->ppc_spefscr_regnum;
        default: 
          return num;
        }
*************** rs6000_gdbarch_init (struct gdbarch_info
*** 2825,2830 ****
--- 2856,2863 ----
    tdep->ppc_vrsave_regnum = -1;
    tdep->ppc_ev0_regnum = -1;
    tdep->ppc_ev31_regnum = -1;
+   tdep->ppc_acc_regnum = -1;
+   tdep->ppc_spefscr_regnum = -1;
  
    set_gdbarch_pc_regnum (gdbarch, 64);
    set_gdbarch_sp_regnum (gdbarch, 1);
*************** rs6000_gdbarch_init (struct gdbarch_info
*** 2878,2883 ****
--- 2911,2918 ----
  	tdep->ppc_ev31_regnum = 38;
          tdep->ppc_fp0_regnum = -1;
          tdep->ppc_fpscr_regnum = -1;
+         tdep->ppc_acc_regnum = 39;
+         tdep->ppc_spefscr_regnum = 40;
          set_gdbarch_pc_regnum (gdbarch, 0);
          set_gdbarch_sp_regnum (gdbarch, tdep->ppc_gp0_regnum + 1);
          set_gdbarch_deprecated_fp_regnum (gdbarch, tdep->ppc_gp0_regnum + 1);


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