/// Register a specific dialect pass allocator function with the system,
/// typically used through the PassRegistration template.
-/// Deprecated: please use the alternate version below.
-void registerPass(StringRef arg, StringRef description,
- const PassAllocatorFunction &function);
-
-/// Register a specific dialect pass allocator function with the system,
-/// typically used through the PassRegistration template.
void registerPass(const PassAllocatorFunction &function);
/// PassRegistration provides a global initializer that registers a Pass
}
PassRegistration()
: PassRegistration([] { return std::make_unique<ConcretePass>(); }) {}
-
- /// Constructor below are deprecated.
-
- PassRegistration(StringRef arg, StringRef description,
- const PassAllocatorFunction &constructor) {
- registerPass(arg, description, constructor);
- }
-
- PassRegistration(StringRef arg, StringRef description)
- : PassRegistration(arg, description,
- [] { return std::make_unique<ConcretePass>(); }) {}
};
/// PassPipelineRegistration provides a global initializer that registers a Pass
optHandler(allocator()->passOptions);
}) {}
-void mlir::registerPass(StringRef arg, StringRef description,
- const PassAllocatorFunction &function) {
+void mlir::registerPass(const PassAllocatorFunction &function) {
+ std::unique_ptr<Pass> pass = function();
+ StringRef arg = pass->getArgument();
+ if (arg.empty())
+ llvm::report_fatal_error(
+ "Trying to register a pass that does not override `getArgument()`");
+ StringRef description = pass->getDescription();
PassInfo passInfo(arg, description, function);
passRegistry->try_emplace(arg, passInfo);
// Verify that the registered pass has the same ID as any registered to this
// arg before it.
- TypeID entryTypeID = function()->getTypeID();
+ TypeID entryTypeID = pass->getTypeID();
auto it = passRegistryTypeIDs->try_emplace(arg, entryTypeID).first;
if (it->second != entryTypeID)
llvm::report_fatal_error(
arg);
}
-void mlir::registerPass(const PassAllocatorFunction &function) {
- std::unique_ptr<Pass> pass = function();
- StringRef arg = pass->getArgument();
- if (arg.empty())
- llvm::report_fatal_error(
- "Trying to register a pass that does not override `getArgument()`: " +
- pass->getName());
- registerPass(arg, pass->getDescription(), function);
-}
-
/// Returns the pass info for the specified pass argument or null if unknown.
const PassInfo *mlir::Pass::lookupPassInfo(StringRef passArg) {
auto it = passRegistry->find(passArg);