LLVM执行哪种优化? [英] Which optimization does LLVM perform?

查看:533
本文介绍了LLVM执行哪种优化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想具体了解LLVM的各种优化级别对应什么.

I would like concretely to know what does the various optimizations levels of LLVM correspond to.

这就是说,我想知道在使用llvm(或clang或opt)的"-0x"选项时,确切地执行了哪些优化过程(在前端之外)以及按照什么顺序进行. 相应工具的人"没有提供太多有关此问题的信息(与gcc的相反).

That is to say, I would like to know which optimization passes are EXACTLY executed (outside the frontend) and in which order when I use the "-0x" options of llvm (or clang or opt). The "man" of the corresponding tools do not provide much information on this matter (to the oposite of gcc's one).

我知道这个有用的页面: http://llvm.org/docs/Passes.html ,但是它不提供有关"-Ox"选项的任何信息. 我正在寻找一些调试或详细选项(尤其是使用"opt --help"中的信息),但找不到任何有用的选项.

I am aware of this useful page: http://llvm.org/docs/Passes.html, but it does not provide any information regarding the "-Ox" options. I was looking for some debugging or verbose options (esp. using informations from "opt --help") but I couldn't find any useful option.

作为补充,我注意到通过解析代码,所有各种LLVM工具以及clang都使用不同的驱动程序,它们以自己的方式解析选项.所有这些驱动程序在"-Ox"选项方面是否都相似?

As a complement, I noticed by parsing the code that all various LLVM tools as well as clang use distinct drivers which parse options their own way. Are all those drivers similar with respect to the "-Ox" options ?

编辑:我为"opt"工具找到了选项"-debug-pass = Arguments",该选项为选项"O1"提供了以下输出:

Edit: I found the option "-debug-pass=Arguments" for the "opt" tool, which gives the following output for option "O1":

Pass Arguments:  -targetdata -no-aa -tbaa -targetlibinfo -basicaa -simplifycfg -domtree -scalarrepl -early-cse -lower-expect
Pass Arguments:  -targetlibinfo -targetdata -no-aa -tbaa -basicaa -globalopt -ipsccp -deadargelim -instcombine -simplifycfg -basiccg -prune-eh -always-inline -functionattrs -scalarrepl-ssa -domtree -early-cse -simplify-libcalls -lazy-value-info -jump-threading -correlated-propagation -simplifycfg -instcombine -tailcallelim -simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -iv-users -indvars -loop-idiom -loop-deletion -loop-unroll -memdep -memcpyopt -sccp -instcombine -lazy-value-info -jump-threading -correlated-propagation -domtree -memdep -dse -adce -simplifycfg -instcombine -strip-dead-prototypes -preverify -domtree -verify

这与我想要的内容很接近,但仍然有两个问题:

This is close from what I wanted but remains two questions:

  • 为什么有两个列表?

  • why are there two lists ?

其他工具(尤其是"clang")是否有任何类似的选择? (根据我的测试,-debug-pass = Arguments"不适用于clang)

is there any similar option for other tools, especially "clang" ? (according to my tests, "-debug-pass=Arguments" does not work with clang)

编辑:工具"opt"的选项"-debug-pass = Structure"提供了更加用户友好的数据(来自http://llvm.org/docs/WritingAnLLVMPass.html )

Edit: the option "-debug-pass=Structure" for the tool "opt" gives even more user friendly data (from http://llvm.org/docs/WritingAnLLVMPass.html)

推荐答案

为什么有两个列表?

why are there two lists?

Function和Module传递具有自己的传递管理器,因此分别打印出来.

Function and Module passes have their own pass managers and so print out separately.

其他工具是否有类似的选择,尤其是铛"

is there any similar option for other tools, especially "clang"

使用clang可以使用-mllvm -debug-pass =参数.

With clang you can use -mllvm -debug-pass=Arguments.

这篇关于LLVM执行哪种优化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆