+ long alignment;
+ int i;
+ /* The d10v only passes a struct in a register when that structure
+ has an alignment that matches the size of a register. */
+ /* If the structure doesn't fit in 4 registers, put it on the
+ stack. */
+ if (TYPE_LENGTH (type) > 8)
+ return 1;
+ /* If the struct contains only one field, don't put it on the stack
+ - gcc can fit it in one or more registers. */
+ if (TYPE_NFIELDS (type) == 1)
+ return 0;
+ alignment = TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0));
+ for (i = 1; i < TYPE_NFIELDS (type); i++)
+ {
+ /* If the alignment changes, just assume it goes on the
+ stack. */
+ if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, i)) != alignment)
+ return 1;
+ }
+ /* If the alignment is suitable for the d10v's 16 bit registers,
+ don't put it on the stack. */
+ if (alignment == 2 || alignment == 4)
+ return 0;
+ return 1;