Sets the maximum number of code factoring passes to n, or sets unlimited code factoring if n is omitted.

Each pass of the code factoring optimization may increase the maximum subroutine depth required by the linked application by one call. If stack space is at a premium, you can limit the additional subroutine depth introduced by the code factoring optimization to n. For instance, specifying -Oxcp=1 will cause the application to use only a single depth of subroutines, with no other calls, when performing code factoring; specifying -Oxcp=2 will introduce up to two additional subroutines (mainline code calls a subroutine which then calls another subroutine) and will require up to two additional return addresses on the call stack.

Setting n higher leads to higher code compression but introduces more subroutines and makes the code slower to execute—you may wish to limit the number of subroutines, their size, and the subroutine depth to strike a balance between speed, code space, and stack requirements.

For processors with a small hardware stack, it may be appropriate to limit the code factoring optimization to only a few levels of subroutines so that the hardware stack does not overflow, or even to disable code factoring completely if stack space is at a premium.

Project property

Code Generation Options > Code Factoring Passes