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]

[patch/rfc] Simplify target_map_name_to_register() - NUM_REGS + NUM_PSEUDO_REGS


Michael's e-mail about regcache.c prompted me to look around GDB a bit 
to see what core code still iterates over just NUM_REGS.  Looks like 
only dwarf2cfi.c.

Anyway, I'll check this cleanup in, in a few days.

enjoy,
Andrew
2002-01-29  Andrew Cagney  <ac131313@redhat.com>

	* parse.c (target_map_name_to_register): Simplify, search regs and
	pseudo-regs using a single loop.

Index: parse.c
===================================================================
RCS file: /cvs/src/src/gdb/parse.c,v
retrieving revision 1.18
diff -p -r1.18 parse.c
*** parse.c	2002/01/30 00:18:17	1.18
--- parse.c	2002/01/30 00:34:57
*************** target_map_name_to_register (char *str, 
*** 117,132 ****
  {
    int i;
  
!   /* Search architectural register name space. */
!   for (i = 0; i < NUM_REGS; i++)
!     if (REGISTER_NAME (i) && len == strlen (REGISTER_NAME (i))
! 	&& STREQN (str, REGISTER_NAME (i), len))
!       {
! 	return i;
!       }
! 
!   /* Try pseudo-registers, if any. */
!   for (i = NUM_REGS; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
      if (REGISTER_NAME (i) && len == strlen (REGISTER_NAME (i))
  	&& STREQN (str, REGISTER_NAME (i), len))
        {
--- 117,124 ----
  {
    int i;
  
!   /* Search register name space. */
!   for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
      if (REGISTER_NAME (i) && len == strlen (REGISTER_NAME (i))
  	&& STREQN (str, REGISTER_NAME (i), len))
        {

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