* [RFA] sh-tdep.c: Define only the minimal register set in sh_generic_register_name
@ 2004-02-12 17:29 Corinna Vinschen
2004-02-16 15:43 ` Elena Zannoni
0 siblings, 1 reply; 3+ messages in thread
From: Corinna Vinschen @ 2004-02-12 17:29 UTC (permalink / raw)
To: gdb-patches
Hi,
while looking into the sh_generic_register_name function, I began to wonder
why that function defines a register set, which is not exactly generic,
but instead gives a name to all 59 register entries. Many of them are
only correct on CPUs with FPU and/or register banks.
IMHO, the generic_name function should only define the maximum common
register set, which is the same as the one for the basic sh CPU variant.
Therefore I'd like to propose the following patch, which does exactly
that. An alternative approach would be, to remove the
sh_generic_register_name entirely and use sh_sh_register_name instead.
Thanks for considering,
Corinna
ChangeLog:
* sh-tdep.c (sh_generic_register_name): Only define the maximum
common register set.
Index: sh-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh-tdep.c,v
retrieving revision 1.158
diff -u -p -r1.158 sh-tdep.c
--- sh-tdep.c 11 Feb 2004 15:40:28 -0000 1.158
+++ sh-tdep.c 12 Feb 2004 17:28:22 -0000
@@ -81,12 +81,12 @@ sh_generic_register_name (int reg_nr)
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
- "fpul", "fpscr",
- "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
- "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
- "ssr", "spc",
- "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
- "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
+ "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
+ "", "",
+ "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "",
};
if (reg_nr < 0)
return NULL;
--
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [RFA] sh-tdep.c: Define only the minimal register set in sh_generic_register_name
2004-02-12 17:29 [RFA] sh-tdep.c: Define only the minimal register set in sh_generic_register_name Corinna Vinschen
@ 2004-02-16 15:43 ` Elena Zannoni
2004-02-16 16:04 ` Corinna Vinschen
0 siblings, 1 reply; 3+ messages in thread
From: Elena Zannoni @ 2004-02-16 15:43 UTC (permalink / raw)
To: gdb-patches
Corinna Vinschen writes:
> Hi,
>
> while looking into the sh_generic_register_name function, I began to wonder
> why that function defines a register set, which is not exactly generic,
> but instead gives a name to all 59 register entries. Many of them are
> only correct on CPUs with FPU and/or register banks.
>
> IMHO, the generic_name function should only define the maximum common
> register set, which is the same as the one for the basic sh CPU variant.
>
> Therefore I'd like to propose the following patch, which does exactly
> that. An alternative approach would be, to remove the
> sh_generic_register_name entirely and use sh_sh_register_name instead.
>
Your are right. I would prefer to just get rid of the function
entirely. It is already the same as the sh3e_register_name. And after
the change it would duplicate the sh_register_name. No point in
keeping it around.
elena
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] sh-tdep.c: Define only the minimal register set in sh_generic_register_name
2004-02-16 15:43 ` Elena Zannoni
@ 2004-02-16 16:04 ` Corinna Vinschen
0 siblings, 0 replies; 3+ messages in thread
From: Corinna Vinschen @ 2004-02-16 16:04 UTC (permalink / raw)
To: gdb-patches
On Feb 16 10:39, Elena Zannoni wrote:
> Your are right. I would prefer to just get rid of the function
> entirely. It is already the same as the sh3e_register_name. And after
> the change it would duplicate the sh_register_name. No point in
> keeping it around.
Thanks, I've applied the below patch then.
Corinna
Index: sh-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh-tdep.c,v
retrieving revision 1.159
diff -u -p -r1.159 sh-tdep.c
--- sh-tdep.c 14 Feb 2004 15:46:33 -0000 1.159
+++ sh-tdep.c 16 Feb 2004 16:03:00 -0000
@@ -74,27 +74,6 @@ struct sh_frame_cache
};
static const char *
-sh_generic_register_name (int reg_nr)
-{
- static char *register_names[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
- "fpul", "fpscr",
- "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
- "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
- "ssr", "spc",
- "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
- "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
- };
- if (reg_nr < 0)
- return NULL;
- if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
- return NULL;
- return register_names[reg_nr];
-}
-
-static const char *
sh_sh_register_name (int reg_nr)
{
static char *register_names[] = {
@@ -2332,7 +2311,7 @@ sh_gdbarch_init (struct gdbarch_info inf
break;
default:
- set_gdbarch_register_name (gdbarch, sh_generic_register_name);
+ set_gdbarch_register_name (gdbarch, sh_sh_register_name);
break;
}
--
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-02-16 16:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-12 17:29 [RFA] sh-tdep.c: Define only the minimal register set in sh_generic_register_name Corinna Vinschen
2004-02-16 15:43 ` Elena Zannoni
2004-02-16 16:04 ` Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox