使用 IBM 的 XL 编译器系列,可以提供两个选项(-qreport
和 -qlist
)来为每个源文件生成报告,其中包括有关哪些优化的信息应用,或者代码的哪些部分无法优化(以及为什么).
With IBM's XL compiler family it is possible to supply two options (-qreport
and -qlist
) to generate reports for each source file that include information on which optimizations were applied, or which parts of the code could not be optimized (and why).
是否有可能为 GNU 的 g++ 获得类似的报告 - 如果是,如何做?
Is it possible to get a similar reporting for GNU's g++ - and if yes, how to do it?
看看 -fdump-tree-[switch]
标志.您可以使用 -fdump-tree-all
获取大量信息.
Have a look at the -fdump-tree-[switch]
flags. You can use -fdump-tree-all
to get loads of information.
也在主干 gcc 中 -fopt-info-[options]
会给你访问更高级别的优化信息,例如当应用特定优化时,错过等,例如
Also in trunk gcc -fopt-info-[options]
will give you access higher level optimization information e.g. when particular optimizations were applied, missed etc e.g.
-fopt-info-inline-optimized-missed
打印所有成功和错过的内联优化(在本例中为 stderr
).这显然是相当新的功能,所以我不确定它的支持情况如何.
Prints all successful and missed inlining optimizations (to stderr
in this case). This is obviously pretty new functionality so I'm not sure how well supported it is yet.
在早期版本中,他们有 -ftree-vectorizer-verbose=n
现在已被弃用,取而代之的是 opt-info.
In earlier releases they had -ftree-vectorizer-verbose=n
which is now being deprecated in favor of opt-info.
此处列出了所有这些选项https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html 虽然挑选有用的可能有点棘手.
All these options are listed here https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html though it can be a bit tricky to pick out the useful ones.
这篇关于使用gcc时如何找出实际应用了哪些优化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!