Get Assembly code after every optimization GCC makes?

前端 未结 7 2067
不知归路
不知归路 2020-12-19 00:19

From Optimization Compiler on Wikipedia,

Compiler optimization is generally implemented using a sequence of optimizing transformations

7条回答
  •  别那么骄傲
    2020-12-19 01:06

    gcc/clang performs optimizations on the intermediate representations (IR), which can be printed after each optimization pass.

    for gcc it is (-fdump-tree-all) 'http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html' with clang it is (-llvm -print-after-all).

    Clang/gcc offers many more options to analyze the optimizations. It is easy to turn on/off an optimization from the command line (http://gcc.gnu.org/onlinedocs/gcc-3.4.4/gcc/Optimize-Options.html, http://llvm.org/docs/Passes.html)

    with clang-llvm you can also list the optimization passes which were performed using the command line option (-mllvm -debug-pass=Structure)

提交回复
热议问题