forked from OSchip/llvm-project
[mlir][bufferize] Add helpers for templatized DENY filters
We already have templatized ALLOW filters but the DENY filters were missing. Differential Revision: https://reviews.llvm.org/D125358
This commit is contained in:
parent
698fda0e3e
commit
011f1b1c1f
|
@ -93,6 +93,15 @@ struct BufferizationOptions {
|
|||
0, (allowDialectInFilterImpl<DialectTs>(), 0)...};
|
||||
}
|
||||
|
||||
/// Deny the given dialects in the filter.
|
||||
///
|
||||
/// This function adds one or multiple DENY filters.
|
||||
template <typename... DialectTs> void denyDialectInFilter() {
|
||||
// FIXME: In c++17 this can be simplified by using 'fold expressions'.
|
||||
(void)std::initializer_list<int>{
|
||||
0, (denyDialectInFilterImpl<DialectTs>(), 0)...};
|
||||
}
|
||||
|
||||
/// Allow the given dialect in the filter.
|
||||
///
|
||||
/// This function adds an ALLOW filter.
|
||||
|
@ -114,6 +123,15 @@ struct BufferizationOptions {
|
|||
0, (allowOperationInFilterImpl<OpTys>(), 0)...};
|
||||
}
|
||||
|
||||
/// Deny the given ops in the filter.
|
||||
///
|
||||
/// This function adds one or multiple DENY filters.
|
||||
template <typename... OpTys> void denyOperationInFilter() {
|
||||
// FIXME: In c++17 this can be simplified by using 'fold expressions'.
|
||||
(void)std::initializer_list<int>{
|
||||
0, (denyOperationInFilterImpl<OpTys>(), 0)...};
|
||||
}
|
||||
|
||||
/// Allow the given op in the filter.
|
||||
///
|
||||
/// This function adds an ALLOW filter.
|
||||
|
@ -249,11 +267,21 @@ private:
|
|||
allowDialectInFilter(DialectT::getDialectNamespace());
|
||||
}
|
||||
|
||||
/// Deny a dialect.
|
||||
template <typename DialectT> void denyDialectInFilterImpl() {
|
||||
denyDialectInFilter(DialectT::getDialectNamespace());
|
||||
}
|
||||
|
||||
/// Allow an op.
|
||||
template <typename OpTy>
|
||||
void allowOperationInFilterImpl() {
|
||||
allowOperationInFilter(OpTy::getOperationName());
|
||||
}
|
||||
|
||||
/// Deny an op.
|
||||
template <typename OpTy> void denyOperationInFilterImpl() {
|
||||
denyOperationInFilter(OpTy::getOperationName());
|
||||
}
|
||||
};
|
||||
|
||||
/// Specify fine-grain relationship between buffers to enable more analysis.
|
||||
|
|
Loading…
Reference in New Issue