#include "mlir/Rewrite/FrozenRewritePatternSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/StringMap.h"
+#include <type_traits>
namespace mlir {
/// different callback forms, that all compose into a single version.
/// With callback of form: `Optional<Type>(T)`
template <typename T, typename FnT>
- std::enable_if_t<llvm::is_invocable<FnT, T>::value, ConversionCallbackFn>
+ std::enable_if_t<std::is_invocable_v<FnT, T>, ConversionCallbackFn>
wrapCallback(FnT &&callback) {
return wrapCallback<T>(
[callback = std::forward<FnT>(callback)](
/// With callback of form: `Optional<LogicalResult>(T, SmallVectorImpl<Type>
/// &)`
template <typename T, typename FnT>
- std::enable_if_t<llvm::is_invocable<FnT, T, SmallVectorImpl<Type> &>::value,
+ std::enable_if_t<std::is_invocable_v<FnT, T, SmallVectorImpl<Type> &>,
ConversionCallbackFn>
wrapCallback(FnT &&callback) {
return wrapCallback<T>(
/// With callback of form: `Optional<LogicalResult>(T, SmallVectorImpl<Type>
/// &, ArrayRef<Type>)`.
template <typename T, typename FnT>
- std::enable_if_t<llvm::is_invocable<FnT, T, SmallVectorImpl<Type> &,
- ArrayRef<Type>>::value,
- ConversionCallbackFn>
+ std::enable_if_t<
+ std::is_invocable_v<FnT, T, SmallVectorImpl<Type> &, ArrayRef<Type>>,
+ ConversionCallbackFn>
wrapCallback(FnT &&callback) {
return [callback = std::forward<FnT>(callback)](
Type type, SmallVectorImpl<Type> &results,
addDynamicallyLegalOp<OpT2, OpTs...>(callback);
}
template <typename OpT, class Callable>
- typename std::enable_if<
- !llvm::is_invocable<Callable, Operation *>::value>::type
+ typename std::enable_if<!std::is_invocable_v<Callable, Operation *>>::type
addDynamicallyLegalOp(Callable &&callback) {
addDynamicallyLegalOp<OpT>(
[=](Operation *op) { return callback(cast<OpT>(op)); });
markOpRecursivelyLegal<OpT2, OpTs...>(callback);
}
template <typename OpT, class Callable>
- typename std::enable_if<
- !llvm::is_invocable<Callable, Operation *>::value>::type
+ typename std::enable_if<!std::is_invocable_v<Callable, Operation *>>::type
markOpRecursivelyLegal(Callable &&callback) {
markOpRecursivelyLegal<OpT>(
[=](Operation *op) { return callback(cast<OpT>(op)); });