Intel icc:如何将优化代码转储为 C 文件
Gcc 的 -fdump-tree-optimized
选项将 C 代码的优化版本转储为 C 文件。有没有办法可以使用英特尔的 icc 编译器执行相同的操作?
我有一个矩阵乘法代码,已编译为icc -O3 -ipo mult.c
。我想查看编译器如何执行优化。如果没有任何效果,那么我将生成该程序的汇编代码。
Gcc's -fdump-tree-optimized
option dumps an optimized version of your C code as a C file. Is there a way I can do the same using intel's icc compiler?
I have a matrix multiplication code that I have compiled as icc -O3 -ipo mult.c
. I want to view how the compiler has performed optimizations. If nothing works, then I shall generate the assembly code for the program.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从技术上讲,
-fdump-tree-optimized
不会转储 C 表示,而是转储 GCC 内部使用的 Gimple 代码的文本部分表示(Gimple 是指令的中端内部表示,大多数GCC 目标无关的优化过程运行)。但 icc 是一个专有编译器(黑匣子),因此从其提供商的角度来看,(对于英特尔而言)展示 icc 的工作原理并不有趣。
GCC 有能力显示其内部表示,因为它是一个免费软件。专有编译器不想展示它们是如何工作的。
如果这是一门课程,您也许也可以尝试 LLVM。 (但我不知道如何转储内部表示)。
更重要的是,如果这是一门课程,您可能会建议您的学生使用 GCC 4.6 开发插件或 GCC MELT 扩展探索和实验优化。
MELT 是一种用于扩展 GCC 的高级领域特定语言,它提供了许多功能来简化此类任务。
Technically,
-fdump-tree-optimized
don't dump a C representation, but a textual partial representation of the Gimple code used inside GCC (Gimple is the middle-end internal representation of instructions, on which most GCC target-independent optimization passes operate).But
icc
is a proprietary compiler (a black box), so from the point of view of its provider, it is not interesting (for Intel) to show howicc
works.GCC has the ability to show its internal representations, because it is a free software. Proprietary compilers don't want to show how they work.
If this is a class, you could perhaps try also LLVM. (But I don't know how do dump internal representations inside).
And more importantly, if this is a class, you might suggest your student using GCC 4.6 to develop a plugin or a GCC MELT extension to explore and experiment optimizations.
MELT is a high-level domain specific language to extend GCC and it provides many features to ease such tasks.