]> git.lizzy.rs Git - rust.git/commit
Rewrite pass management with LLVM
authorAlex Crichton <alex@alexcrichton.com>
Fri, 23 Aug 2013 03:58:42 +0000 (20:58 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 27 Aug 2013 03:11:51 +0000 (20:11 -0700)
commit73540551e5051c524b5533a5ab3eb991dda4eaac
treed623ac8cc5a5a400e5dba821e59928fad876a079
parent6a649e6b8b3e42bb8fa8fa806d783ecd9b543784
Rewrite pass management with LLVM

Beforehand, it was unclear whether rust was performing the "recommended set" of
optimizations provided by LLVM for code. This commit changes the way we run
passes to closely mirror that of clang, which in theory does it correctly. The
notable changes include:

* Passes are no longer explicitly added one by one. This would be difficult to
  keep up with as LLVM changes and we don't guaranteed always know the best
  order in which to run passes
* Passes are now managed by LLVM's PassManagerBuilder object. This is then used
  to populate the various pass managers run.
* We now run both a FunctionPassManager and a module-wide PassManager. This is
  what clang does, and I presume that we *may* see a speed boost from the
  module-wide passes just having to do less work. I have no measured this.
* The codegen pass manager has been extracted to its own separate pass manager
  to not get mixed up with the other passes
* All pass managers now include passes for target-specific data layout and
  analysis passes

Some new features include:

* You can now print all passes being run with `-Z print-llvm-passes`
* When specifying passes via `--passes`, the passes are now appended to the
  default list of passes instead of overwriting them.
* The output of `--passes list` is now generated by LLVM instead of maintaining
  a list of passes ourselves
* Loop vectorization is turned on by default as an optimization pass and can be
  disabled with `-Z no-vectorize-loops`
12 files changed:
src/librustc/back/link.rs
src/librustc/back/passes.rs [deleted file]
src/librustc/driver/driver.rs
src/librustc/driver/session.rs
src/librustc/lib/llvm.rs
src/librustc/middle/trans/context.rs
src/librustc/rustc.rs
src/libstd/unstable/raw.rs
src/rustllvm/PassWrapper.cpp
src/rustllvm/RustWrapper.cpp
src/rustllvm/rustllvm.def.in
src/rustllvm/rustllvm.h