This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] MIPS: Introduce struct mips_regnums and accessors
On May 22, 3:40pm, Andrew Cagney wrote:
> + /* Raw register number initializations. They are initialized in the
> + same order that they appear in the struct to make it easier to
> + verify that they're all initialized. */
> + tdep->raw_regnums.zero_regnum = 0;
> + tdep->raw_regnums.v0_regnum = 2;
> + tdep->raw_regnums.a0_regnum = 4;
> + tdep->raw_regnums.t9_regnum = 25;
> + tdep->raw_regnums.sp_regnum = 29;
> + tdep->raw_regnums.ra_regnum = 31;
>
> and, at least for v0_regnum, it doesn't change. V0 is an offset in the
> selected block of registers. It could be either:
>
> enum { V0_OFFSET = 2 };
>
> cookednum->gp0 + V0_OFFSET
> or
> rawnum->gp0 + V0_OFFSET
>
> however, either way, it doesn't change. The only thing that changes is
> things like where the general purpose, for floating point, registers start.
I have the following objections to the use of offsets:
1) They don't work for floating point registers. (That's assuming
that I can convince you that it's desirable to have 16 cooked
registers for o32...) The reason that it won't work is that,
e.g, an FPA0_OFFSET will need to have different values for the
raw and cooked cases.
2) The conversion from *_REGNUM is much less transparent.
3) The use of offsets is more error prone. There's nothing to
prevent you from adding an offset to the wrong boundary start.
4) The notation is more cumbersome.
Furthermore, I really don't understand the problem that you had with
my proposed layout. Could you please explain the underlying reasons
for proposing the offset idea? E.g, are you concerned about the
initialization and the maintenance thereof? Or do you just want to
present a minimal view of the raw register numbers to clients outside
of mips-tdep.c? Or something else altogether?
Kevin