ZHCUAQ1F july 2015 – april 2023
您可以使用由编译器生成的性能建议来优化您的代码。为了获得性能建议,请使用以下选项进行编译:
--advice:performance | 指示编译器发送建议到 stdout 中(默认)。 | |
--advice:performance_file | 指示编译器发送建议到文件中。 | |
--advice:performance_dir | 指示编译器发送建议到特定目录中的文件中。 |
"filename.c": advice #27004: 未生成性能建议
示例 1:下述示例发送输出建议到 stdout 中(默认):
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.
请注意,防止“软件流水线不合格”的建议(如上文所示)也会打印在 .asm 文件中。因此,func.asm 将包含:
;*----------------------------------------------------------------------------*
;* 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
;*----------------------------------------------------------------------------*
示例 2:下述示例发送输出建议到名为 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.
示例 3:下述示例使用不同的选项发送输出建议到 mydir
目录中名为 myfile.adv
的文件中。
使用 --advice:performance_file 和 --advice:performance_dir 选项:
cl6x -mv6400+ -o2 -k --advice:performance_file=myfile.adv --advice:performance_dir=mydir basicloop.c
仅使用 --advice:performance_file 选项来指定完整的路径名称:
cl6x -mv6400+ -o2 -k --advice:performance_file=mydir/myfile.adv basicloop.c
如果同时指定 --advice_dir 选项和完整的路径名称,则忽略 --advice:performance_dir 选项,并在完整的路径名称建议文件中生成建议。另外,请注意目录“mydir”必须已经存在,才能在其中创建建议文件。