Compiler optimization level
Control application of compiler optimizations
Model Configuration Pane: Code Generation
Description
The Compiler optimization level parameter controls whether the build process applies compiler optimizations.
Note
This parameter appears when the model is configured with a system target file that specifies toolchain-based code generation, as described in Configure Toolchain (ToolchainInfo) or Template Makefile Build Process.
Dependencies
This parameter enables Custom compiler optimization flags.
Settings
Optimizations off (faster builds)
(default) | Optimizations on (faster runs)
| Custom
Optimizations off (faster builds)
Customizes compilation during the build process to minimize compilation time.
Optimizations on (faster runs)
Customizes compilation during the makefile build process to minimize run time.
Custom
Allows you to specify custom compiler optimization flags to be applied during the makefile build process. Select this setting for generating code for these types of simulations:
Accelerator
Rapid accelerator
Model reference simulation target
Normal mode for Stateflow and the MATLAB Function block
MATLAB System block
Tips
Target-independent values
Optimizations on (faster runs)
andOptimizations off (faster builds)
allow you to easily toggle compiler optimizations on and off during code development.Custom
allows you to enter custom compiler optimization flags at Simulink® GUI level, rather than editing compiler flags into template makefiles (TMFs) or supplying compiler flags to make commands.If you specify compiler options for your makefile build using
OPT_OPTS
,MEX_OPTS
(exceptMEX_OPTS="-v"
), orMEX_OPT_FILE
, the value of Compiler optimization level is ignored and a warning is issued about the ignored parameter.
Recommended Settings
Application | Setting |
---|---|
Debugging | Optimizations off (faster builds) |
Traceability | Optimizations off (faster builds) |
Efficiency | Optimizations on (faster runs) (execution), No impact (ROM, RAM) |
Safety precaution | No impact |
Programmatic Use
Parameter: RTWCompilerOptimization |
Type: character vector |
Value: 'off' | 'on' | 'custom' |
Default: 'off' |
Version History
Introduced in R2007b