[PATCH] D71086: Let PassBuilder Expose PassInstrumentationCallbacks

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 12:18:46 PST 2019


aqjune created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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));
      }
    };
  }


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71086

Files:
  llvm/include/llvm/Passes/PassBuilder.h


Index: llvm/include/llvm/Passes/PassBuilder.h
===================================================================
--- llvm/include/llvm/Passes/PassBuilder.h
+++ llvm/include/llvm/Passes/PassBuilder.h
@@ -631,6 +631,9 @@
                               std::string ProfileFile,
                               std::string ProfileRemappingFile);
 
+
+  /// Returns PIC. External libraries can use this to add pass instrumentation
+  PassInstrumentationCallbacks *getPIC() const { return PIC; }
 private:
   static Optional<std::vector<PipelineElement>>
   parsePipelineText(StringRef Text);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71086.232429.patch
Type: text/x-patch
Size: 587 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191205/c8f056b6/attachment.bin>


More information about the llvm-commits mailing list