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

Daniel Jacobowitz
2006-11-22T22:48:26Z

On Wed, Nov 22, 2006 at 11:13:09PM +0100, Ulrich Weigand wrote:
> For some reason I seem unable to convince GCC to place such
> a struct into a register.

Must be a mode thing... shame; it ought to be able to do this.

> For registers without special conversion function, value_assign
> performs a read-modify-write cycle: it reads the old contents
> of the register(s), modify the bits denoted by value_offset,
> value_bitsize and value_bitpos, and writes the full register
> contents back.
>
> Maybe we need to do a similar cycle of REGISTER_TO_VALUE,
> modify selected bits, VALUE_TO_REGISTER for the registers with
> special conversion function?

I think that's precisely it. I'm worried that this will break some
other uses of VALUE_TO_REGISTER, though - how do we keep track at
this point in the code of "the whole struct is in the register"
or "this field is in the register"? Right now, there's limited
flexibility on that, but Jim's been working on improved DW_OP_piece
support which would let us write to structure pieces.

> As an aside, what is this code in value_assign supposed to do:
>
> /* Locate the first register that falls in the value that
> needs to be transfered. Compute the offset of the
> value in that register. */
> {
> int offset;
> for (reg_offset = value_reg, offset = 0;
> offset + register_size (current_gdbarch, reg_offset) <= value_offset (toval);
> reg_offset++);
> byte_offset = value_offset (toval) - offset;
> }
>
> It seems clearly broken (offset remains constant 0), but I'm not
> quite sure what the intent was.

Um, yeah, that's definitely not sensible. Perhaps it is supposed to
match the loop further down, in which offset would go up by
register_size?

--
Daniel Jacobowitz
CodeSourcery