3

我想了解和修改 LLVM 中opt用于不同硬件架构的通行证。

4

2 回答 2

3

opt可以告诉您它在给定的 LLVM IR 上运行了哪些通道:

$ opt -O2 -debug-pass=Arguments example_file.ll -disable-output
Pass Arguments:  -tti -no-aa -tbaa -scoped-noalias -assumption-cache-tracker -targetlibinfo -basicaa -verify -simplifycfg -domtree -sroa -early-cse -lower-expect
Pass Arguments:  -targetlibinfo -tti -no-aa -tbaa -scoped-noalias -assumption-cache-tracker -basicaa -ipsccp -globalopt -deadargelim -domtree -instcombine -simplifycfg -basiccg -prune-eh -inline-cost -inline -functionattrs -domtree -sroa -early-cse -lazy-value-info -jump-threading -correlated-propagation -simplifycfg -domtree -instcombine -tailcallelim -simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -indvars -loop-idiom -loop-deletion -loop-unroll -mldst-motion -domtree -memdep -gvn -memdep -memcpyopt -sccp -domtree -bdce -instcombine -lazy-value-info -jump-threading -correlated-propagation -domtree -memdep -dse -loops -loop-simplify -lcssa -licm -adce -simplifycfg -domtree -instcombine -barrier -float2int -domtree -loops -loop-simplify -lcssa -loop-rotate -branch-prob -block-freq -scalar-evolution -loop-accesses -loop-vectorize -instcombine -scalar-evolution -slp-vectorizer -simplifycfg -domtree -instcombine -loops -loop-simplify -lcssa -scalar-evolution -loop-unroll -instcombine -loop-simplify -lcssa -licm -scalar-evolution -alignment-from-assumptions -strip-dead-prototypes -elim-avail-extern -globaldce -constmerge -verify

查看源代码,这通常是以下问题:

实例化 aPassManagerBuilder并调用SetOptLevel. 然后,构建器将通道添加为 populateModulePassManager 的一部分

请注意,默认的传递顺序已针对 C/C++ 进行了调整,对于其他语言可能不是最佳的。

于 2015-12-20T16:37:20.650 回答
0

假设您使用的是 clang,请使用 -debug-pass=Arguments 选项查看在每个优化级别运行的通道

于 2013-02-12T11:48:56.240 回答