Previous: IR2 Conversion, Up: Calling Convention

2.6 Additional Notes

The low-hanging fruit here is going to be changing every call and return to use CALL and RETURN instructions instead of JMP instructions.

A more involved change would be to reduce the number of argument passing registers from three to two, which may be beneficial in terms of our quest to free up a GPR for use on Win32 boxes for a thread structure.

Another possible win could be to store multiple return-values somewhere other than the stack, such as a dedicated area of the thread structure. The main concern here in terms of clobbering would be to make sure that interrupts (and presumably the internal-error machinery) know to save the area and that the compiler knows that the area cannot be live across a function call. Actually implementing this would involve hacking the IR2 conversion, since as it stands now the same argument conventions are used for both call and return value storage (same TNs).