Re: [RFA][2/5] New port: Cell BE SPU (valops.c fix)

Jim Blandy
2006-11-27T22:31:18Z

"Ulrich Weigand" <uweigand@de.ibm.com> writes:
>> It seems to me this is the problem to fix. When value_from_register
>> retrieves a char from an SPU register, and that char is occupying byte
>> three of the register, then if that value doesn't have its
>> value_offset set, that seems wrong. You're using CONVERTIBLE_P and
>> VALUE_TO_REGISTER / REGISTER_TO_VALUE to make up for that loss of
>> information; why not actually provide it?
>
> So just to make sure I understood correctly, you'd suggesting that
> I should *not* be using CONVERT_REGISTER_P for those registers?
>
> Instead, value_from_register should run into its default path,
> and at the place where it computes the offset
>
> if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG
> && len < register_size (current_gdbarch, regnum))
> /* Big-endian, and we want less than full size. */
> set_value_offset (v, register_size (current_gdbarch, regnum) - len);
> else
> set_value_offset (v, 0);
>
> we add some architecture-specific way to set a different offset?

I had to think it through a bit, but yes, I think that's the way to do
it. Then, won't the non-convertible register code in value_assign do
the right read-modify-write thing without changes?

My motivation is that it seems to me that 'struct value' already has
stuff meant to handle these kinds of subregister references, but we're
not using it. If we do use it, then value_struct_elt and
value_subscript will do the right thing for us.