[all-commits] [llvm/llvm-project] ff554a: Let PassBuilder Expose PassInstrumentationCallbacks

Juneyoung Lee via All-commits all-commits at lists.llvm.org
Mon Jan 6 21:10:43 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ff554a9179032167953595ca885a8fd12ac61036
      https://github.com/llvm/llvm-project/commit/ff554a9179032167953595ca885a8fd12ac61036
  Author: Juneyoung Lee <aqjune at gmail.com>
  Date:   2020-01-07 (Tue, 07 Jan 2020)

  Changed paths:
    M llvm/include/llvm/Passes/PassBuilder.h
    M llvm/unittests/IR/PassBuilderCallbacksTest.cpp

  Log Message:
  -----------
  Let PassBuilder Expose PassInstrumentationCallbacks

Summary:
This is an effort to allowing external libraries register their own pass instrumentation during their llvmGetPassPluginInfo() calls.

By exposing this through the added getPIC(), now a pass writer can do something like this:

```
extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK
llvmGetPassPluginInfo() {
  return {
    ..,
    [](llvm::PassBuilder &PB) {
      PB.getPIC()->registerAfterPassCallback(move(f));
    }
  };
}
```

Reviewers: chandlerc, philip.pfaffe, fedor.sergeev

Reviewed By: fedor.sergeev

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71086




More information about the All-commits mailing list