- Save/restore only registers that are used. This includes Callee saved registers and Caller saved registers (arguments and temporaries) for integer and FP registers.
- If there is a call in the interrupt handler, save/restore all Caller saved registers and all FP registers.
- Emit special return instructions depending on "interrupt" attribute type.
Based on initial patch by Zhaoshi Zheng.