c - 在 GCC 进行的每次优化后获取汇编代码?

标签 c optimization gcc assembly compiler-construction

来自 Optimization Compiler在维基百科上,

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 有一个 lot优化选项。

我想研究生成的程序集(-S 给出的)在使用不同的标志编译时 GCC 执行每次优化后,如 -O1 -O2, -O3

我该怎么做?

编辑:我的输入将是 C 代码。

最佳答案

中间表示 可以使用 -fdump-tree-all 开关保存到文件中。

有更多可用的细粒度 -fdump 开关。

有关详细信息,请参阅 gcc 手册。

为了能够阅读这些表示,take a look into GCC internals manual .

关于c - 在 GCC 进行的每次优化后获取汇编代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15226668/

相关文章:

c - 为什么我在使用 read() 时一次只能得到一个字符?

c - c中的字符串指针

C99条件返回值

c++ - If(), else if() c++中的替代方案(这是AI吗?)

c - 使用 __attribute__ ((section "STACK")) 将变量准确地放在 ("STACK"部分中可能有什么意义?

c - 为什么函数会根据容量返回不同的值

optimization - postgres中的Seq Scan和Bitmap堆扫描有什么区别?

c++ - 函数名 __func__ 的预定义宏

c++ - C++ 构造函数中体系结构 x86_64 的 GCC undefined symbol

c - 第 98 次调用 pthread_create() 失败