Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa:i386] Eliminate register_byte() and register_raw_size()
@ 2002-08-09 19:17 Andrew Cagney
  2002-08-09 19:40 ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2002-08-09 19:17 UTC (permalink / raw)
  To: gdb-patches

Hello,

This patch eliminates the register_byte() and register_raw_size() 
architecture methods from the i386.

(It was either that or modify the code so that it included MMX registers :-)

ok to commit?
Andrew

(My redhat 7.3 i386 system shows no regressions)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa:i386] Eliminate register_byte() and register_raw_size()
  2002-08-09 19:17 [rfa:i386] Eliminate register_byte() and register_raw_size() Andrew Cagney
@ 2002-08-09 19:40 ` Andrew Cagney
  2002-08-12 10:41   ` Mark Kettenis
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2002-08-09 19:40 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

ulgh, with attached patch ....

> Hello,
> 
> This patch eliminates the register_byte() and register_raw_size() architecture methods from the i386.
> 
> (It was either that or modify the code so that it included MMX registers :-)
> 
> ok to commit?
> Andrew
> 
> (My redhat 7.3 i386 system shows no regressions)

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 6708 bytes --]

2002-08-09  Andrew Cagney  <cagney@redhat.com>

	* i386-linux-tdep.c (i386_linux_register_byte): Delete function.
	(i386_linux_register_raw_size): Delete function.
	(i386_linux_init_abi): Update.
	* i386-tdep.c (i386_register_raw_size): Delete function.
	(i386_register_byte): Delete function.
	(i386_gdbarch_init): Update.
	(i386_register_size): Delete array.
	(i386_register_offset): Delete array.

	* config/i386/tm-symmetry.h (REGISTER_BYTE): Delete macro.
	(REGISTER_RAW_SIZE): Delete macro.
	* config/i386/tm-ptx.h (REGISTER_RAW_SIZE): Delete macro.
	(REGISTER_BYTE): Delete macro.

Index: i386-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-tdep.c,v
retrieving revision 1.16
diff -u -r1.16 i386-linux-tdep.c
--- i386-linux-tdep.c	2 Jul 2002 13:48:16 -0000	1.16
+++ i386-linux-tdep.c	10 Aug 2002 02:11:26 -0000
@@ -47,27 +47,6 @@
 
   return i386_register_name (reg);
 }
-
-static int
-i386_linux_register_byte (int reg)
-{
-  /* Deal with the extra "orig_eax" pseudo register.  */
-  if (reg == I386_LINUX_ORIG_EAX_REGNUM)
-    return (i386_register_byte (I386_LINUX_ORIG_EAX_REGNUM - 1)
-	    + i386_register_raw_size (I386_LINUX_ORIG_EAX_REGNUM - 1));
-
-  return i386_register_byte (reg);
-}
-
-static int
-i386_linux_register_raw_size (int reg)
-{
-  /* Deal with the extra "orig_eax" pseudo register.  */
-  if (reg == I386_LINUX_ORIG_EAX_REGNUM)
-    return 4;
-
-  return i386_register_raw_size (reg);
-}
 \f
 /* Recognizing signal handler frames.  */
 
@@ -458,8 +437,6 @@
   set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS + 1);
   set_gdbarch_register_name (gdbarch, i386_linux_register_name);
   set_gdbarch_register_bytes (gdbarch, I386_SSE_SIZEOF_REGS + 4);
-  set_gdbarch_register_byte (gdbarch, i386_linux_register_byte);
-  set_gdbarch_register_raw_size (gdbarch, i386_linux_register_raw_size);
 
   tdep->jb_pc_offset = 20;	/* From <bits/setjmp.h>.  */
 
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.73
diff -u -r1.73 i386-tdep.c
--- i386-tdep.c	24 Jul 2002 14:38:55 -0000	1.73
+++ i386-tdep.c	10 Aug 2002 02:11:26 -0000
@@ -56,27 +56,6 @@
   "mxcsr"
 };
 
-/* i386_register_offset[i] is the offset into the register file of the
-   start of register number i.  We initialize this from
-   i386_register_size.  */
-static int i386_register_offset[I386_SSE_NUM_REGS];
-
-/* i386_register_size[i] is the number of bytes of storage in GDB's
-   register array occupied by register i.  */
-static int i386_register_size[I386_SSE_NUM_REGS] = {
-   4,  4,  4,  4,
-   4,  4,  4,  4,
-   4,  4,  4,  4,
-   4,  4,  4,  4,
-  10, 10, 10, 10,
-  10, 10, 10, 10,
-   4,  4,  4,  4,
-   4,  4,  4,  4,
-  16, 16, 16, 16,
-  16, 16, 16, 16,
-   4
-};
-
 /* Return the name of register REG.  */
 
 const char *
@@ -90,23 +69,6 @@
   return i386_register_names[reg];
 }
 
-/* Return the offset into the register array of the start of register
-   number REG.  */
-int
-i386_register_byte (int reg)
-{
-  return i386_register_offset[reg];
-}
-
-/* Return the number of bytes of storage in GDB's register array
-   occupied by register REG.  */
-
-int
-i386_register_raw_size (int reg)
-{
-  return i386_register_size[reg];
-}
-
 /* Convert stabs register number REG to the appropriate register
    number used by GDB.  */
 
@@ -1439,8 +1401,6 @@
   set_gdbarch_register_name (gdbarch, i386_register_name);
   set_gdbarch_register_size (gdbarch, 4);
   set_gdbarch_register_bytes (gdbarch, I386_SIZEOF_GREGS + I386_SIZEOF_FREGS);
-  set_gdbarch_register_byte (gdbarch, i386_register_byte);
-  set_gdbarch_register_raw_size (gdbarch, i386_register_raw_size);
   set_gdbarch_max_register_raw_size (gdbarch, I386_MAX_REGISTER_SIZE);
   set_gdbarch_max_register_virtual_size (gdbarch, I386_MAX_REGISTER_SIZE);
   set_gdbarch_register_virtual_type (gdbarch, i386_register_virtual_type);
@@ -1545,19 +1505,6 @@
 _initialize_i386_tdep (void)
 {
   register_gdbarch_init (bfd_arch_i386, i386_gdbarch_init);
-
-  /* Initialize the table saying where each register starts in the
-     register file.  */
-  {
-    int i, offset;
-
-    offset = 0;
-    for (i = 0; i < I386_SSE_NUM_REGS; i++)
-      {
-	i386_register_offset[i] = offset;
-	offset += i386_register_size[i];
-      }
-  }
 
   tm_print_insn = gdb_print_insn_i386;
   tm_print_insn_info.mach = bfd_lookup_arch (bfd_arch_i386, 0)->mach;
Index: config/i386/tm-ptx.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-ptx.h,v
retrieving revision 1.5
diff -u -r1.5 tm-ptx.h
--- config/i386/tm-ptx.h	14 Jun 2002 22:55:45 -0000	1.5
+++ config/i386/tm-ptx.h	10 Aug 2002 02:11:27 -0000
@@ -149,24 +149,6 @@
 #undef  REGISTER_BYTES
 #define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4))
 
-/* Index within `registers' of the first byte of the space for register N. */
-
-#undef  REGISTER_BYTE
-#define REGISTER_BYTE(N) 		\
-(((N) < ST0_REGNUM) ? ((N) * 4) : \
- ((N) < FP1_REGNUM) ? (40 + (((N) - ST0_REGNUM) * 10)) : \
- (40 + 80 + (((N) - FP1_REGNUM) * 4)))
-
-/* Number of bytes of storage in the actual machine representation for
-   register N.  All registers are 4 bytes, except 387 st(0) - st(7),
-   which are 80 bits each. */
-
-#undef  REGISTER_RAW_SIZE
-#define REGISTER_RAW_SIZE(N) \
-(((N) < ST0_REGNUM) ? 4 : \
- ((N) < FP1_REGNUM) ? 10 : \
- 4)
-
 /* Largest value REGISTER_RAW_SIZE can have.  */
 
 #undef  MAX_REGISTER_RAW_SIZE
Index: config/i386/tm-symmetry.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-symmetry.h,v
retrieving revision 1.8
diff -u -r1.8 tm-symmetry.h
--- config/i386/tm-symmetry.h	14 Jun 2002 22:55:45 -0000	1.8
+++ config/i386/tm-symmetry.h	10 Aug 2002 02:11:27 -0000
@@ -225,30 +225,6 @@
 #undef  REGISTER_BYTES
 #define REGISTER_BYTES ((10 * 4) + (8 * 10) + (31 * 4))
 
-/* Index within `registers' of the first byte of the space for
-   register N.  */
-
-#undef  REGISTER_BYTE
-#define REGISTER_BYTE(N) 		\
-(((N) < 3) ? ((N) * 4) :		\
-((N) < 5) ? ((((N) - 2) * 10) + 2) :	\
-((N) < 8) ? ((((N) - 5) * 4) + 32) :	\
-((N) < 14) ? ((((N) - 8) * 10) + 44) :	\
-    ((((N) - 14) * 4) + 104))
-
-/* Number of bytes of storage in the actual machine representation
- * for register N.  All registers are 4 bytes, except 387 st(0) - st(7),
- * which are 80 bits each. 
- */
-
-#undef  REGISTER_RAW_SIZE
-#define REGISTER_RAW_SIZE(N) \
-(((N) < 3) ? 4 :	\
-((N) < 5) ? 10 :	\
-((N) < 8) ? 4 :		\
-((N) < 14) ? 10 :	\
-    4)
-
 /* Nonzero if register N requires conversion
    from raw format to virtual format.  */
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa:i386] Eliminate register_byte() and register_raw_size()
  2002-08-09 19:40 ` Andrew Cagney
@ 2002-08-12 10:41   ` Mark Kettenis
  2002-08-12 11:23     ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Kettenis @ 2002-08-12 10:41 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney <ac131313@ges.redhat.com> writes:

> > This patch eliminates the register_byte() and register_raw_size()
> > architecture methods from the i386.
> >
> > (It was either that or modify the code so that it included MMX
> >  registers :-)

Well, the generic code is probably a wee bit slower...

...but we can always add back a more generic version of the "offset caching" code that your patch removes if that turns out to be a problem...

> > ok to commit?

...so it's fine with me.  Please go ahead.

Mark


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa:i386] Eliminate register_byte() and register_raw_size()
  2002-08-12 10:41   ` Mark Kettenis
@ 2002-08-12 11:23     ` Andrew Cagney
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2002-08-12 11:23 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

> Andrew Cagney <ac131313@ges.redhat.com> writes:
> 
> 
>> > This patch eliminates the register_byte() and register_raw_size()
>> > architecture methods from the i386.
>> >
>> > (It was either that or modify the code so that it included MMX
>> >  registers :-)
> 
> 
> Well, the generic code is probably a wee bit slower...
> 
> ...but we can always add back a more generic version of the "offset caching" code that your patch removes if that turns out to be a problem...

Or remove all calls to REGISTER_BYTE() :-)  Oh, and the regcache already 
does ``offset caching'' :-)

>> > ok to commit?
> 
> 
> ...so it's fine with me.  Please go ahead.

Thanks!

Andrew



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-08-12 18:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-09 19:17 [rfa:i386] Eliminate register_byte() and register_raw_size() Andrew Cagney
2002-08-09 19:40 ` Andrew Cagney
2002-08-12 10:41   ` Mark Kettenis
2002-08-12 11:23     ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox