Thanks for the comments. Using your suggestions simplifies things quite a bit. Still finding my way around :-)
> Regarding structs with bitfields and unions, we could add an stgdict flag to prevent passing them as arguments in the Unix X86_64 ABI
Is this to deal with issues #16575, #16576 and #26628? Issue #26628 seems to be a duplicate of #16575. I can add the flag and set it here, but the checks should probably be in a separate patch.
> if we forbid passing structs with bitfields in this ABI, then MAX_ELEMENTS can be reduced to 8.
Not sure that's the case. For example, if we have to handle
typedef struct {
unsigned char data[12];
} Test;
that would use up 12 slots for the unrolled array. Perhaps you mean 16 rather than 8?
Updated patch attached.