4.6.6.9 Interrupt-context-loops Option

The -finterrupt-context-loops option ensures the compiler considers using loops to reduce the size of interrupt context switch code when the register-optimized reentrant stack is active and when it is feasible to do so. When there are a large number of working registers that need to be preserved across an interrupt, this feature will identify registers that are contiguous in memory, and where efficient to do so, will generate code to save and restore the registers indirectly using loop. Although this does not assist with interrupt latency, it can reduce code size. This feature is automatically enabled when using level -Os optimizations, but this option allows it to be utilized at different optimization levels. Even when it is enabled, however, loops will only be generated if they will reduce the size of the context switch code.

The -fno-interrupt-context-loops form of this option prevents loops from being used in context switches in all situations.