SSA usage question

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Sun Jun 6 22:30:00 GMT 2004


      C.f. gimplify_modify_expr, which emits a structure copy of a
      dynamicaly sized type as a call to __builtin_memcpy.  Which has
      the effect of exposing TYPE_SIZE_UNIT as a variable that's used.

      I notice, for instance, that we don't at present properly handle 
      fields with variable DECL_FIELD_OFFSET.  This must be implemented as

	foo.field
      =>
	*((typeof field *)&foo + unshare_expr(DECL_FIELD_OFFSET(foo)))

      which of course must itself be further gimplified.

No, that's actually wrong.  It assumes that the field is not a bitfield.
You may have to do three things:

(1) Do a shift corresponding to DECL_FIELD_BITPOS.
(2) Do a zero- or sign- extend corresponding to the size of the field.
(3) Allocate a temporary of the proper size and copy into it if the field
is a multiple of bytes on a byte-boundary, but not properly aligned.

These are things that get_inner_reference and the code in expand_expr
know how to do, but they are quite complex and I think it's too much
to expect to have another copy in gimplification.



More information about the Gcc mailing list