SPRUI04F july 2015 – april 2023
You can use compiler generated Performance Advice to optimize your code. To get Performance Advice, compile with the following options:
--advice:performance | Instructs the compiler to emit advice to stdout (default). | |
--advice:performance_file | Instructs the compiler to emit advice into a file. | |
--advice:performance_dir | Instructs the compiler to emit advice into a file in a specific directory. |
"filename.c": advice #27004: No Performance Advice is generated.
Example 1: The following example sends output advice sent to stdout (the default):
cl6x -mv6400+ -o2 -k --advice:performance func.c
"func.c", line 10: advice #30006: Loop at line 8 cannot be scheduled efficiently
as it contains a function call ("_init"). Try making "_init" an inline
function.
"func.c", line 12: advice #30000: Loop at line 8 cannot be scheduled efficiently
as it contains a function call ("_calculate"). Try to inline call or
consider rewriting loop.
Note that Advice to prevent Software Pipeline Disqualification (such as that presented above) will also be printed in the .asm file. So, func.asm will contain :
;*----------------------------------------------------------------------------*
;* SOFTWARE PIPELINE INFORMATION
;* Disqualified loop: Loop contains a call
;* Loop at line 8 cannot be scheduled efficiently as it contains a
;* function call ("_init"). Try making "_init" an inline function.
;* Disqualified loop: Loop contains non-pipelinable instructions
;* Disqualified loop: Loop contains a call
;* Loop at line 8 cannot be scheduled efficiently as it contains a
;* function call ("_calculate"). Try to inline call or consider
;* rewriting loop.
;* Disqualified loop: Loop contains non-pipelinable instructions
;*----------------------------------------------------------------------------*
Example
2: The following example sends output advice to a file named
filename.advice
:
cl6x -mv6400+ --advice:performance --advice:performance_file=filename.advice func.c
;******************************************************************************
;* TMS320C6x C/C++ Codegen Unix v7.5.0P12047 (a0322878 - Feb 16 2012) *
;* Date/Time created: Thu Feb 16 10:26:02 2012 *
;* *
;* Warning: This file is auto generated by the compiler and can be *
;* overwritten during the next compile. *
;* *
;******************************************************************************
;* User Options: --silicon_version=6400+
"func.c": advice #27000: Detecting compilation without optimization. Use
optimization option -o2 or higher.
Example 3: The following examples send output advice to a file named
myfile.adv
in the mydir
directory using
various options.
Using the --advice:performance_file and --advice:performance_dir options:
cl6x -mv6400+ -o2 -k --advice:performance_file=myfile.adv --advice:performance_dir=mydir basicloop.c
Using only the
--advice:performance_file option to specify the full path name:
cl6x -mv6400+ -o2 -k --advice:performance_file=mydir/myfile.adv basicloop.c
If --advice_dir option and full pathname are specified together, the --advice:performance_dir option is ignored, and the advice is generated in the full pathname advice file. Also, note that directory "mydir" must already exist for an advice file to be created there.