diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h --- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h +++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h @@ -93,6 +93,16 @@ 0, (allowDialectInFilterImpl(), 0)...}; } + /// Deny the given dialects in the filter. + /// + /// This function adds one or multiple DENY filters. + template + void denyDialectInFilter() { + // FIXME: In c++17 this can be simplified by using 'fold expressions'. + (void)std::initializer_list{ + 0, (denyDialectInFilterImpl(), 0)...}; + } + /// Allow the given dialect in the filter. /// /// This function adds an ALLOW filter. @@ -114,6 +124,16 @@ 0, (allowOperationInFilterImpl(), 0)...}; } + /// Deny the given ops in the filter. + /// + /// This function adds one or multiple DENY filters. + template + void denyOperationInFilter() { + // FIXME: In c++17 this can be simplified by using 'fold expressions'. + (void)std::initializer_list{ + 0, (denyOperationInFilterImpl(), 0)...}; + } + /// Allow the given op in the filter. /// /// This function adds an ALLOW filter. @@ -236,11 +256,23 @@ allowDialectInFilter(DialectT::getDialectNamespace()); } + /// Deny a dialect. + template + void denyDialectInFilterImpl() { + denyDialectInFilter(DialectT::getDialectNamespace()); + } + /// Allow an op. template void allowOperationInFilterImpl() { allowOperationInFilter(OpTy::getOperationName()); } + + /// Deny an op. + template + void denyOperationInFilterImpl() { + denyOperationInFilter(OpTy::getOperationName()); + } }; /// Specify fine-grain relationship between buffers to enable more analysis.