For my target, I handle incoming memory arguments by creating a store to memory (in LowerCall, ), then creating a fixed object on the stack and loading from it (in LowerFormalArguments). This approach was based on MSP430.
I now have the problem that the resulting loads in my output assembly are done assuming that the call stack looks something like:
As a small update, I switched out my ‘special’ store instruction for a store and then a sub (both of which are fully described), and yet the resulting assembly still doesn’t seem to realize that the SP/FP has moved:
I considered handling this in LowerFormalArguments, by working out the offset there, but that depends on knowing if the function makes calls or not, and I’m not sure if that information is around then. Plus it also feels very hacky!