diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h --- a/mlir/include/mlir/IR/OpDefinition.h +++ b/mlir/include/mlir/IR/OpDefinition.h @@ -671,10 +671,6 @@ template class IsTerminator : public TraitBase { public: - static AbstractOperation::OperationProperties getTraitProperties() { - return static_cast( - OperationProperty::Terminator); - } static LogicalResult verifyTrait(Operation *op) { return impl::verifyIsTerminator(op); } @@ -1001,13 +997,7 @@ /// This class adds property that the operation is commutative. template -class IsCommutative : public TraitBase { -public: - static AbstractOperation::OperationProperties getTraitProperties() { - return static_cast( - OperationProperty::Commutative); - } -}; +class IsCommutative : public TraitBase {}; /// This class adds property that the operation is an involution. /// This means a unary to unary operation "f" that satisfies f(f(x)) = x @@ -1110,10 +1100,6 @@ class IsIsolatedFromAbove : public TraitBase { public: - static AbstractOperation::OperationProperties getTraitProperties() { - return static_cast( - OperationProperty::IsolatedFromAbove); - } static LogicalResult verifyTrait(Operation *op) { for (auto ®ion : op->getRegions()) if (!region.isIsolatedFromAbove(op->getLoc())) @@ -1425,34 +1411,6 @@ return failure(); } -//===----------------------------------------------------------------------===// -// Trait Properties - -/// Trait to check if T provides a `getTraitProperties` method. -template -using has_get_trait_properties = decltype(T::getTraitProperties()); -template -using detect_has_get_trait_properties = - llvm::is_detected; - -/// The internal implementation of `getTraitProperties` below that returns the -/// OR of invoking `getTraitProperties` on all of the provided trait types `Ts`. -template -static AbstractOperation::OperationProperties -getTraitPropertiesImpl(std::tuple *) { - AbstractOperation::OperationProperties result = 0; - (void)std::initializer_list{(result |= Ts::getTraitProperties(), 0)...}; - return result; -} - -/// Given a tuple type containing a set of traits that contain a -/// `getTraitProperties` method, return the OR of all of the results of invoking -/// those methods. -template -static AbstractOperation::OperationProperties getTraitProperties() { - return getTraitPropertiesImpl((TraitTupleT *)nullptr); -} - //===----------------------------------------------------------------------===// // Trait Verification @@ -1574,14 +1532,6 @@ typename detail::FilterTypes...>::type; - /// Returns the properties of this operation by combining the properties - /// defined by the traits. - static AbstractOperation::OperationProperties getOperationProperties() { - return op_definition_impl::getTraitProperties...>::type>(); - } - /// Returns an interface map containing the interfaces registered to this /// operation. static detail::InterfaceMap getInterfaceMap() { diff --git a/mlir/include/mlir/IR/Operation.h b/mlir/include/mlir/IR/Operation.h --- a/mlir/include/mlir/IR/Operation.h +++ b/mlir/include/mlir/IR/Operation.h @@ -455,47 +455,6 @@ // Accessors for various properties of operations //===--------------------------------------------------------------------===// - /// Returns whether the operation is commutative. - bool isCommutative() { - if (auto *absOp = getAbstractOperation()) - return absOp->hasProperty(OperationProperty::Commutative); - return false; - } - - /// Represents the status of whether an operation is a terminator. We - /// represent an 'unknown' status because we want to support unregistered - /// terminators. - enum class TerminatorStatus { Terminator, NonTerminator, Unknown }; - - /// Returns the status of whether this operation is a terminator or not. - TerminatorStatus getTerminatorStatus() { - if (auto *absOp = getAbstractOperation()) { - return absOp->hasProperty(OperationProperty::Terminator) - ? TerminatorStatus::Terminator - : TerminatorStatus::NonTerminator; - } - return TerminatorStatus::Unknown; - } - - /// Returns true if the operation is known to be a terminator. - bool isKnownTerminator() { - return getTerminatorStatus() == TerminatorStatus::Terminator; - } - - /// Returns true if the operation is known to *not* be a terminator. - bool isKnownNonTerminator() { - return getTerminatorStatus() == TerminatorStatus::NonTerminator; - } - - /// Returns true if the operation is known to be completely isolated from - /// enclosing regions, i.e., no internal regions reference values defined - /// above this operation. - bool isKnownIsolatedFromAbove() { - if (auto *absOp = getAbstractOperation()) - return absOp->hasProperty(OperationProperty::IsolatedFromAbove); - return false; - } - /// Attempt to fold this operation with the specified constant operand values /// - the elements in "operands" will correspond directly to the operands of /// the operation, but may be null if non-constant. If folding is successful, @@ -506,8 +465,17 @@ /// Returns true if the operation was registered with a particular trait, e.g. /// hasTrait(). template