SPRUI04F july 2015 – april 2023
You can specify program-level optimization by using the --program_level_compile option with the --opt_level=3 option (aliased as -O3).
With program-level optimization, all of your source files are compiled into one intermediate file called a module. The module moves to the optimization and code generation passes of the compiler. Because the compiler can see the entire program, it performs several optimizations that are rarely applied during file-level optimization:
The --program_level_compile option requires use of --opt_level=3 in order to perform these optimizations.
To see which program-level optimizations the compiler is applying, use the --gen_opt_level=2 option to generate an information file. See Section 4.3.1 for more information.
In Code Composer Studio, when the --program_level_compile option is used, C and C++ files that have the same options are compiled together. However, if any file has a file-specific option that is not selected as a project-wide option, that file is compiled separately. For example, if every C and C++ file in your project has a different set of file-specific options, each is compiled separately, even though program-level optimization has been specified. To compile all C and C++ files together, make sure the files do not have file-specific options. Be aware that compiling C and C++ files together may not be safe if previously you used a file-specific option.
If you compile all files with the --program_level_compile and --keep_asm options, the compiler produces only one .asm file, not one for each corresponding source file.