- /* If we are making an object of this type, or if this is a DECL, we know
- that it is a scalar if the type is not an aggregate. */
- if ((objectp || DECL_P (t))
- && ! AGGREGATE_TYPE_P (type)
- && TREE_CODE (type) != COMPLEX_TYPE)
- MEM_SCALAR_P (ref) = 1;
+ /* Default values from pre-existing memory attributes if present. */
+ refattrs = MEM_ATTRS (ref);
+ if (refattrs)
+ {
+ /* ??? Can this ever happen? Calling this routine on a MEM that
+ already carries memory attributes should probably be invalid. */
+ attrs.expr = refattrs->expr;
+ attrs.offset_known_p = refattrs->offset_known_p;
+ attrs.offset = refattrs->offset;
+ attrs.size_known_p = refattrs->size_known_p;
+ attrs.size = refattrs->size;
+ attrs.align = refattrs->align;
+ }
+
+ /* Otherwise, default values from the mode of the MEM reference. */
+ else
+ {
+ defattrs = mode_mem_attrs[(int) GET_MODE (ref)];
+ gcc_assert (!defattrs->expr);
+ gcc_assert (!defattrs->offset_known_p);
+
+ /* Respect mode size. */
+ attrs.size_known_p = defattrs->size_known_p;
+ attrs.size = defattrs->size;
+ /* ??? Is this really necessary? We probably should always get
+ the size from the type below. */
+
+ /* Respect mode alignment for STRICT_ALIGNMENT targets if T is a type;
+ if T is an object, always compute the object alignment below. */
+ if (TYPE_P (t))
+ attrs.align = defattrs->align;
+ else
+ attrs.align = BITS_PER_UNIT;
+ /* ??? If T is a type, respecting mode alignment may *also* be wrong
+ e.g. if the type carries an alignment attribute. Should we be
+ able to simply always use TYPE_ALIGN? */
+ }