获得大会code每GCC优化后做? [英] Get Assembly code after every optimization GCC makes?
问题描述
编译器优化使用优化转换,它以项目和改造它产生使用较少的资源语义上等价的输出程序算法的序列普遍实行。
Compiler optimization is generally implemented using a sequence of optimizing transformations, algorithms which take a program and transform it to produce a semantically equivalent output program that uses fewer resources.
和GCC有优化选项的很多。
and GCC has a lot of optimization options.
我想学习生成的程序集(一个 -S
给出),每个优化标志不同的像编译时GCC执行后 - O1
, -O2
, -O3
等
I'd like to study the generated assembly (the one -S
gives) after each optimization GCC performs when compiling with different flags like -O1
, -O2
, -O3
, etc.
我怎样才能做到这一点?
How can I do this?
编辑:我的投入将是C code
My input will be C code.
推荐答案
中级重新presentation 可以使用保存到文件的 -fdump树,所有
开关。
Intermediate representation can be saved to files using -fdump-tree-all
switch.
有更细粒度 -fdump
切换awailable。
There are more fine-grained -fdump
switches awailable.
请参阅GCC手册。
要能够读取这些再presentations,看看到GCC内幕手册一>
To be able to read these representations, take a look into GCC internals manual.
这篇关于获得大会code每GCC优化后做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!