Optimizes the stack usage -- eliminates push/pop instruction pairs determined to be unnecessary. The following optimizations are performed:
push/popinstruction elimination for function variables that are not used anywhere apart from the push/pop instructions. This happens when variables are eliminated by other optimizations. The optimization is done globally, in a single pass across the entire program.push/popinstruction elimination for function variables that are read neither by any instruction between the call instruction and the end of the function nor by any instruction that is part of the same loop as the call instruction. Implicit reads by recursive calls to the same function with the value of the parameter unchanged are also detected.push/popinstruction elimination for function parameters/variables that are never modified within the function.
« Previous: Single Step Elimination | Up: Code optimization | Next: Temp Variables Elimination »