[PATCH] D11032: [PM] Enable registration of out-of-tree or plugin passes

Philip Pfaffe philip.pfaffe at gmail.com
Wed Jul 8 02:38:15 PDT 2015


philip.pfaffe added a reviewer: chandlerc.
philip.pfaffe added a subscriber: llvm-commits.

The PassBuilder used for creating pass pipelines for the new pass manager currently doesn't support out-of-tree passes or passes in plugins. This patch adds a mechanism for registering such passes, enabling them inside the PassBuilder.

Registration is done by installing Hooks, managed in a name -> hook map. Such a hook is a callable which, when invoked, gets passed an AnalysisManager or PassManager instance which the external pass can insert itself into. When parsing a pass pipeline, PassBuilder will first consult the list of installed hooks before it looks at the builtin passes. This way, external passes are able to steal the name of a builtin pass.

The HookManager, which manages the name->hook mapping, offers interfaces for registering, querying and invoking installed hooks. I maintain three global instances of it (one for each IRUnit type), accessible through a getGlobalHookManager() function. Moreover, the patch contains convenience types which abbreviate the default way to register passes a bit.

Unittest attached.

Repository:
  rL LLVM

http://reviews.llvm.org/D11032

Files:
  include/llvm/Passes/PassBuilder.h
  lib/Passes/PassBuilder.cpp
  unittests/IR/CMakeLists.txt
  unittests/IR/HookManagerTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11032.29250.patch
Type: text/x-patch
Size: 12825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150708/52ea4eff/attachment.bin>


More information about the llvm-commits mailing list