[llvm-dev] Optimization Remark Emitter API

Sam Elliott via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 21 10:23:53 PDT 2017


Hi llvm-dev!

Recently the old Optimization Remark emitter APIs have been replaced with a new API. 

Whereas before you would have had to emit a remark using a call like 

  `emitOptimizationRemark(Context, PassName, Function, DLoc, Msg)`

(and similar for missed and analysis remarks), there now exists a much more versatile api using 

  `ORE->emit(OptimizationRemark(PassName, OptimizationName, Function) << "inlined " << NV("caller", Caller) << " into " << NV("callee", Callee));`

(where ORE is a per-function `OptimizationRemarkEmitter` object).

The newer API gives developers the ability to emit more complex objects into the optimization remark yaml, in such a way that they will still be printed nicely, and the extra metadata is available to optimization remark tools. 

Migrating function passes is relatively easy, as can be seen here https://reviews.llvm.org/rL309497 <https://reviews.llvm.org/rL309497> in migrating PGOMemOPSizeOpt.cpp pass - there's a function pass that keeps an ORE around. Migrating module passes is slightly harder, as shown here: https://reviews.llvm.org/rL309294 <https://reviews.llvm.org/D35929>

We have now finished migrating the in-tree LLVM passes that use the old API to the new API, and are about to remove the old API. This is a heads up for any out-of-tree passes using the old API that you should also update.

Sam
--
Archibald Sam Elliott
ashe2 at cs.washington.edu
PhD Student, PLSE Group

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170821/61005e75/attachment.html>


More information about the llvm-dev mailing list