This patch has two parts:
- It adds support for "elfiamcu" triple to support the x86 Intel MCU psABI. This is something already supported by GCC trunk.
- It introduces elfiamcu-specific code, which is a workaround for PR3997. The IAMCU psABI requires everything, including library functions to pass the first 3 parameters in-reg (note that the ABI is slightly different from -mregparm 3). Unfortunately, inreg marking for x86-32 is done by the frontend. Optimistically speaking, RTLIB function signatures ought to be simple enough for this to work. If not, we'll have to reconsider solving PR3997 more thoroughly.
Any suggestions on how to make this work better are welcome.
Is there an easy way to assert this, i.e. that there are no fancy types? Also, you probably want to explicitly handle varargs functions here, either by asserting that you cannot get here for varargs functions or by excluding them from the inreg marking.