Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual

Product codes
SW006021-1
Page of 518
MPLAB
®
 XC8 C Compiler User’s Guide
DS52053B-page 108
 2012 Microchip Technology Inc.
4.8.42
--OPT: Invoke Compiler Optimizations
The --OPT option allows control of all the compiler optimizers. If this option is not spec-
ified, or it is specified as --OPT=all, the space and asm optimizations are enabled 
(see below). Optimizations may be disabled by using --OPT=none, or individual opti-
mizers may be controlled, for example: --OPT=asm will only enable some assembler 
optimizations.
Table 4-13 lists the available optimization types.
Note that different suboptions control assembler optimizations of assembly source files 
and intermediate assembly files produced from C source code.
The speed and space suboptions are contradictory. Space optimizations are the 
default. If speed and space suboptions are both specified, then speed optimizations 
takes precedence. If all optimizations are requested, the space optimization is 
enabled. These optimizations affect procedural abstraction, which is performed by the 
assembler, and other optimizations at the code generation stage.
The asmfile selection optimizes assembly source files, which are otherwise not opti-
mized by the compiler. By contrast, the asm control allows for optimization of assembly 
code that was derived from C code, an optimization that is enabled by default.
Some compiler optimizations may affect the ability to debug code. Enabling the debug 
suboption may restrict some optimizations that would otherwise normally take place 
and which would affect debugging.
4.8.43
--OUTDIR: Specify a Directory For Output Files
This option allows a directory to be nominated for xc8 to locate its output files. If this 
option is omitted, output files will be created in the current working directory. See also 
Section 4.8.41 “--OBJDIR: Specify a Directory For Intermediate Files” and 
Section 4.8.10 “-O: Specify Output File” for more information.
TABLE 4-13:
OPTIMIZATION OPTIONS
Option name
 Function
asm
Select optimizations of assembly code derived from C source (default)
asmfile
Select optimizations of assembly source files
debug
Favor accurate debugging over optimization
speed
Favor optimizations that result in faster code
space
Favor optimizations that result in smaller code (default)
all
Enable all compiler optimizations
none
Do not use any compiler optimizations