[llvm-branch-commits] [mlir] 8827e07 - Remove deprecated methods from OpState.

Christian Sigg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 21 12:33:28 PST 2021


Author: Christian Sigg
Date: 2021-01-21T21:29:08+01:00
New Revision: 8827e07aaf2114b7f09e229e22481cd58137ea6a

URL: https://github.com/llvm/llvm-project/commit/8827e07aaf2114b7f09e229e22481cd58137ea6a
DIFF: https://github.com/llvm/llvm-project/commit/8827e07aaf2114b7f09e229e22481cd58137ea6a.diff

LOG: Remove deprecated methods from OpState.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D95123

Added: 
    

Modified: 
    mlir/include/mlir/IR/OpDefinition.h
    mlir/lib/IR/Operation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h
index c021bdc8ee9d..1180938e858b 100644
--- a/mlir/include/mlir/IR/OpDefinition.h
+++ b/mlir/include/mlir/IR/OpDefinition.h
@@ -104,34 +104,6 @@ class OpState {
   /// Return the operation that this refers to.
   Operation *getOperation() { return state; }
 
-  /// Return the dialect that this refers to.
-  LLVM_ATTRIBUTE_DEPRECATED(
-      Dialect *getDialect(),
-      "Use Operation::getDialect() instead (replace '.' with '->').");
-
-  /// Return the parent Region of this operation.
-  LLVM_ATTRIBUTE_DEPRECATED(
-      Region *getParentRegion(),
-      "Use Operation::getParentRegion() instead (replace '.' with '->').");
-
-  /// Returns the closest surrounding operation that contains this operation
-  /// or nullptr if this is a top-level operation.
-  LLVM_ATTRIBUTE_DEPRECATED(
-      Operation *getParentOp(),
-      "Use Operation::getParentOp() instead (replace '.' with '->').");
-
-  /// Return the closest surrounding parent operation that is of type 'OpTy'.
-  template <typename OpTy>
-  LLVM_ATTRIBUTE_DEPRECATED(
-      OpTy getParentOfType(),
-      "Use Operation::getParentOfType() instead (replace '.' with '->').");
-
-  /// Returns the closest surrounding parent operation with trait `Trait`.
-  template <template <typename T> class Trait>
-  LLVM_ATTRIBUTE_DEPRECATED(
-      Operation *getParentWithTrait(),
-      "Use Operation::getParentWithTrait() instead (replace '.' with '->').");
-
   /// Return the context this operation belongs to.
   MLIRContext *getContext() { return getOperation()->getContext(); }
 
@@ -158,45 +130,6 @@ class OpState {
   using dialect_attr_iterator = Operation::dialect_attr_iterator;
   using dialect_attr_range = Operation::dialect_attr_range;
 
-  /// Return a range corresponding to the dialect attributes for this operation.
-  LLVM_ATTRIBUTE_DEPRECATED(
-      dialect_attr_range getDialectAttrs(),
-      "Use Operation::getDialectAttrs() instead (replace '.' with '->').");
-  LLVM_ATTRIBUTE_DEPRECATED(
-      dialect_attr_iterator dialect_attr_begin(),
-      "Use Operation::dialect_attr_begin() instead (replace '.' with '->').");
-  LLVM_ATTRIBUTE_DEPRECATED(
-      dialect_attr_iterator dialect_attr_end(),
-      "Use Operation::dialect_attr_end() instead (replace '.' with '->').");
-
-  /// Return an attribute with the specified name.
-  LLVM_ATTRIBUTE_DEPRECATED(
-      Attribute getAttr(StringRef name),
-      "Use Operation::getAttr() instead (replace '.' with '->').");
-
-  /// If the operation has an attribute of the specified type, return it.
-  template <typename AttrClass>
-  LLVM_ATTRIBUTE_DEPRECATED(
-      AttrClass getAttrOfType(StringRef name),
-      "Use Operation::getAttrOfType() instead (replace '.' with '->').");
-
-  /// If the an attribute exists with the specified name, change it to the new
-  /// value.  Otherwise, add a new attribute with the specified name/value.
-  LLVM_ATTRIBUTE_DEPRECATED(
-      void setAttr(Identifier name, Attribute value),
-      "Use Operation::setAttr() instead (replace '.' with '->').");
-  LLVM_ATTRIBUTE_DEPRECATED(
-      void setAttr(StringRef name, Attribute value),
-      "Use Operation::setAttr() instead (replace '.' with '->').");
-
-  /// Set the attributes held by this operation.
-  LLVM_ATTRIBUTE_DEPRECATED(
-      void setAttrs(ArrayRef<NamedAttribute> attributes),
-      "Use Operation::setAttrs() instead (replace '.' with '->').");
-  LLVM_ATTRIBUTE_DEPRECATED(
-      void setAttrs(DictionaryAttr newAttrs),
-      "Use Operation::setAttrs() instead (replace '.' with '->').");
-
   /// Set the dialect attributes for this operation, and preserve all dependent.
   template <typename DialectAttrs>
   void setDialectAttrs(DialectAttrs &&attrs) {
@@ -272,19 +205,6 @@ class OpState {
   friend AbstractOperation;
 };
 
-template <typename OpTy>
-OpTy OpState::getParentOfType() {
-  return getOperation()->getParentOfType<OpTy>();
-}
-template <template <typename T> class Trait>
-Operation *OpState::getParentWithTrait() {
-  return getOperation()->getParentWithTrait<Trait>();
-}
-template <typename AttrClass>
-AttrClass OpState::getAttrOfType(StringRef name) {
-  return getAttr(name).dyn_cast_or_null<AttrClass>();
-}
-
 // Allow comparing operators.
 inline bool operator==(OpState lhs, OpState rhs) {
   return lhs.getOperation() == rhs.getOperation();

diff  --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp
index ba1d1e5109cc..b4fe9f854dda 100644
--- a/mlir/lib/IR/Operation.cpp
+++ b/mlir/lib/IR/Operation.cpp
@@ -692,30 +692,6 @@ InFlightDiagnostic OpState::emitRemark(const Twine &message) {
   return getOperation()->emitRemark(message);
 }
 
-Dialect *OpState::getDialect() { return getOperation()->getDialect(); }
-Region *OpState::getParentRegion() { return getOperation()->getParentRegion(); }
-Operation *OpState::getParentOp() { return getOperation()->getParentOp(); }
-OpState::dialect_attr_range OpState::getDialectAttrs() {
-  return state->getDialectAttrs();
-}
-OpState::dialect_attr_iterator OpState::dialect_attr_begin() {
-  return state->dialect_attr_begin();
-}
-OpState::dialect_attr_iterator OpState::dialect_attr_end() {
-  return state->dialect_attr_end();
-}
-Attribute OpState::getAttr(StringRef name) { return state->getAttr(name); }
-void OpState::setAttr(Identifier name, Attribute value) {
-  state->setAttr(name, value);
-}
-void OpState::setAttr(StringRef name, Attribute value) {
-  setAttr(Identifier::get(name, getContext()), value);
-}
-void OpState::setAttrs(ArrayRef<NamedAttribute> attributes) {
-  state->setAttrs(DictionaryAttr::get(attributes, getContext()));
-}
-void OpState::setAttrs(DictionaryAttr newAttrs) { state->setAttrs(newAttrs); }
-
 //===----------------------------------------------------------------------===//
 // Op Trait implementations
 //===----------------------------------------------------------------------===//


        


More information about the llvm-branch-commits mailing list