14.2 Function Size Limits

For all devices, the code generated for a function may become arbitrarily large, limited only by the available program memory. The efficiency of call sequences is determined by the code memory model. By default, the "small code" model is selected, which results in the most efficient call sequence. The linker will determine if source and destination are close enough to permit use of the small code model. If not, a helpful message will suggest that the "large code" model should be specified in MPLAB X IDE Project Properties or by using the -mlarge-code command option.

When the large code model is specified, call sequences will be automatically converted to the most efficient form whenever possible by the assembler. This typically occurs when both source and destination are defined in the same compilation unit, and are within range of the more efficient instruction sequence.

Note: It is theoretically possible to compose an extremely large conditional statement that would fail to assemble due to architectural restrictions with the conditional branch statement. However, this extreme case would not be due to an actual limitation of function size, but rather the complexity of the statement.