This is the mail archive of the gdb-patches@sourceware.org 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]

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


>  Daniel Jacobowitz wrote:
>
> > I suppose there's times we want to destroy the rest of the register,
> > so knowing where it is in the register isn't enough?
>
>  The problem is, we don't *know* where it is in the register.
>
>  For example, on the SPU "char" values are placed in byte 3 of
>  the 16 bytes of a general purpose register, "short" values are
>  placed in bytes 2 and 3, and "int" values are placed in bytes
>  0 .. 3.  ("long long" is placed in 0 .. 7.)
>
>  However, structs are placed into registers starting from
>  byte 0 always.

Which is the same way as structs are stored in memory isn't it?

>  So if we have
>
>    struct { char x; char y; char z; char w; } s;
>    char t;
>
>  and both s and t reside in registers, then a value to access
>  t would look exactly the same as a value to access s.x (i.e.
>  type "char", lval_regnum, value_offset == 0), but to access
>  them requires using different bytes of the register.

I actually think the problem is that you're thinking that s.x lives in
a register where it is actually s itself that lives in that register.
So VALUE_TO_REGISTER should be called for the struct itself, not its
char member.

Mark


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