diff options
| author | Juneyoung Lee <aqjune@gmail.com> | 2020-01-07 14:04:32 +0900 |
|---|---|---|
| committer | Juneyoung Lee <aqjune@gmail.com> | 2020-01-07 14:10:37 +0900 |
| commit | ff554a9179032167953595ca885a8fd12ac61036 (patch) | |
| tree | bc6523edd53c15e74bc3c41e338683199fd3be7b /llvm/unittests/IR | |
| parent | 3d87d0b925713effb108a387924562211ecbf2be (diff) | |
| download | bcm5719-llvm-ff554a9179032167953595ca885a8fd12ac61036.tar.gz bcm5719-llvm-ff554a9179032167953595ca885a8fd12ac61036.zip | |
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
Diffstat (limited to 'llvm/unittests/IR')
| -rw-r--r-- | llvm/unittests/IR/PassBuilderCallbacksTest.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/unittests/IR/PassBuilderCallbacksTest.cpp b/llvm/unittests/IR/PassBuilderCallbacksTest.cpp index 7306257851a..3f800b308e2 100644 --- a/llvm/unittests/IR/PassBuilderCallbacksTest.cpp +++ b/llvm/unittests/IR/PassBuilderCallbacksTest.cpp @@ -418,6 +418,9 @@ protected: PB(nullptr, PipelineTuningOptions(), None, &CallbacksHandle.Callbacks), PM(true), LAM(true), FAM(true), CGAM(true), AM(true) { + EXPECT_TRUE(&CallbacksHandle.Callbacks == + PB.getPassInstrumentationCallbacks()); + /// Register a callback for analysis registration. /// /// The callback is a function taking a reference to an AnalyisManager |

