How to find out which optimizations are actually applied when using gcc?(使用gcc时如何找出实际应用了哪些优化?)
问题描述
使用 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时如何找出实际应用了哪些优化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用gcc时如何找出实际应用了哪些优化?
基础教程推荐
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- CString 到 char* 2021-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
