From d7c467ded1e824c0764417c8b9e732219adc3440 Mon Sep 17 00:00:00 2001 From: River Riddle Date: Sat, 11 May 2019 19:51:16 -0700 Subject: [PATCH] Remove the explicit "friend Operation" statement from each of the derived operations now that op casting is no longer inside of Operation. -- PiperOrigin-RevId: 247791672 --- .../Linalg/Linalg1/include/linalg1/RangeOp.h | 1 - .../Linalg/Linalg1/include/linalg1/SliceOp.h | 1 - .../Linalg/Linalg1/include/linalg1/ViewOp.h | 1 - .../Linalg/Linalg2/include/linalg2/TensorOps.h | 3 --- .../Linalg/Linalg3/include/linalg3/LoadStoreOps.h | 2 -- mlir/examples/toy/Ch3/include/toy/Dialect.h | 8 -------- mlir/examples/toy/Ch4/include/toy/Dialect.h | 8 -------- mlir/examples/toy/Ch5/include/toy/Dialect.h | 10 ---------- mlir/g3doc/Tutorials/Toy/Ch-3.md | 1 - mlir/include/mlir/AffineOps/AffineOps.h | 7 ------- mlir/include/mlir/GPU/GPUDialect.h | 1 - mlir/include/mlir/IR/OpDefinition.h | 1 - mlir/include/mlir/Linalg/IR/LinalgOps.h | 7 ------- mlir/include/mlir/StandardOps/Ops.h | 13 ------------- mlir/include/mlir/VectorOps/VectorOps.h | 3 --- mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp | 1 - 16 files changed, 68 deletions(-) diff --git a/mlir/examples/Linalg/Linalg1/include/linalg1/RangeOp.h b/mlir/examples/Linalg/Linalg1/include/linalg1/RangeOp.h index 09e725212f41..7024a6486aae 100644 --- a/mlir/examples/Linalg/Linalg1/include/linalg1/RangeOp.h +++ b/mlir/examples/Linalg/Linalg1/include/linalg1/RangeOp.h @@ -31,7 +31,6 @@ class RangeOp : public mlir::Op::Impl, mlir::OpTrait::OneResult, mlir::OpTrait::HasNoSideEffect> { public: - friend mlir::Operation; using Op::Op; ////////////////////////////////////////////////////////////////////////////// diff --git a/mlir/examples/Linalg/Linalg1/include/linalg1/SliceOp.h b/mlir/examples/Linalg/Linalg1/include/linalg1/SliceOp.h index e9b5a8858493..7360c6bb44f2 100644 --- a/mlir/examples/Linalg/Linalg1/include/linalg1/SliceOp.h +++ b/mlir/examples/Linalg/Linalg1/include/linalg1/SliceOp.h @@ -30,7 +30,6 @@ class SliceOp : public mlir::Op::Impl, mlir::OpTrait::OneResult, mlir::OpTrait::HasNoSideEffect> { public: - friend mlir::Operation; using Op::Op; ////////////////////////////////////////////////////////////////////////////// diff --git a/mlir/examples/Linalg/Linalg1/include/linalg1/ViewOp.h b/mlir/examples/Linalg/Linalg1/include/linalg1/ViewOp.h index d24b709db55d..f5a6d5783126 100644 --- a/mlir/examples/Linalg/Linalg1/include/linalg1/ViewOp.h +++ b/mlir/examples/Linalg/Linalg1/include/linalg1/ViewOp.h @@ -32,7 +32,6 @@ class ViewOp : public mlir::Op { public: - friend mlir::Operation; using Op::Op; ////////////////////////////////////////////////////////////////////////////// diff --git a/mlir/examples/Linalg/Linalg2/include/linalg2/TensorOps.h b/mlir/examples/Linalg/Linalg2/include/linalg2/TensorOps.h index a4a341fac6d0..1dd4c6b9c020 100644 --- a/mlir/examples/Linalg/Linalg2/include/linalg2/TensorOps.h +++ b/mlir/examples/Linalg/Linalg2/include/linalg2/TensorOps.h @@ -103,7 +103,6 @@ class DotOp : public TensorContractionBase, public mlir::Op { public: - friend mlir::Operation; using Op::Op; using TensorContractionBaseType = TensorContractionBase::TensorContractionBaseType; @@ -165,7 +164,6 @@ class MatvecOp : public TensorContractionBase, public mlir::Op { public: - friend mlir::Operation; using Op::Op; using TensorContractionBaseType = TensorContractionBase::TensorContractionBaseType; @@ -227,7 +225,6 @@ class MatmulOp : public TensorContractionBase, public mlir::Op { public: - friend mlir::Operation; using Op::Op; using TensorContractionBaseType = TensorContractionBase::TensorContractionBaseType; diff --git a/mlir/examples/Linalg/Linalg3/include/linalg3/LoadStoreOps.h b/mlir/examples/Linalg/Linalg3/include/linalg3/LoadStoreOps.h index eb0e1ac360ed..04d39ae66b13 100644 --- a/mlir/examples/Linalg/Linalg3/include/linalg3/LoadStoreOps.h +++ b/mlir/examples/Linalg/Linalg3/include/linalg3/LoadStoreOps.h @@ -30,7 +30,6 @@ class ViewType; class LoadOp : public mlir::Op { public: - friend mlir::Operation; using Op::Op; ////////////////////////////////////////////////////////////////////////////// @@ -61,7 +60,6 @@ public: class StoreOp : public mlir::Op { public: - friend mlir::Operation; using Op::Op; ////////////////////////////////////////////////////////////////////////////// diff --git a/mlir/examples/toy/Ch3/include/toy/Dialect.h b/mlir/examples/toy/Ch3/include/toy/Dialect.h index 0ad95d4c3afe..84bd98e94558 100644 --- a/mlir/examples/toy/Ch3/include/toy/Dialect.h +++ b/mlir/examples/toy/Ch3/include/toy/Dialect.h @@ -145,7 +145,6 @@ public: mlir::FloatAttr value); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -182,7 +181,6 @@ public: llvm::StringRef getCalleeName(); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -212,7 +210,6 @@ public: mlir::Value *getOperand() { return getOperation()->getOperand(0); } /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -233,7 +230,6 @@ public: mlir::Value *value); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -253,7 +249,6 @@ public: mlir::Value *value); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -278,7 +273,6 @@ public: mlir::Value *value, ToyArrayType reshapedType); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -307,7 +301,6 @@ public: mlir::Value *getRHS() { return getOperand(1); } /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -334,7 +327,6 @@ public: mlir::Value *getRHS() { return getOperand(1); } /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; diff --git a/mlir/examples/toy/Ch4/include/toy/Dialect.h b/mlir/examples/toy/Ch4/include/toy/Dialect.h index b0a57d91ad7d..96e05dc47130 100644 --- a/mlir/examples/toy/Ch4/include/toy/Dialect.h +++ b/mlir/examples/toy/Ch4/include/toy/Dialect.h @@ -145,7 +145,6 @@ public: mlir::FloatAttr value); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -182,7 +181,6 @@ public: llvm::StringRef getCalleeName(); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -212,7 +210,6 @@ public: mlir::Value *getOperand() { return getOperation()->getOperand(0); } /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -233,7 +230,6 @@ public: mlir::Value *value); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -259,7 +255,6 @@ public: mlir::MLIRContext *context); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -290,7 +285,6 @@ public: mlir::MLIRContext *context); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -320,7 +314,6 @@ public: mlir::Value *getRHS() { return getOperand(1); } /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -348,7 +341,6 @@ public: mlir::Value *getRHS() { return getOperand(1); } /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; diff --git a/mlir/examples/toy/Ch5/include/toy/Dialect.h b/mlir/examples/toy/Ch5/include/toy/Dialect.h index 6b6fe79ad9b8..9d7f82d41159 100644 --- a/mlir/examples/toy/Ch5/include/toy/Dialect.h +++ b/mlir/examples/toy/Ch5/include/toy/Dialect.h @@ -153,7 +153,6 @@ public: } /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -190,7 +189,6 @@ public: llvm::StringRef getCalleeName(); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -220,7 +218,6 @@ public: mlir::Value *getOperand() { return getOperation()->getOperand(0); } /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -241,7 +238,6 @@ public: mlir::Value *value); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -267,7 +263,6 @@ public: mlir::MLIRContext *context); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -298,7 +293,6 @@ public: mlir::MLIRContext *context); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -328,7 +322,6 @@ public: mlir::Value *getRHS() { return getOperand(1); } /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -356,7 +349,6 @@ public: mlir::Value *getRHS() { return getOperand(1); } /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -374,7 +366,6 @@ public: mlir::Type retType); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; @@ -394,7 +385,6 @@ public: mlir::MLIRContext *context); /// Inherit constructor. - friend mlir::Operation; using Op::Op; }; diff --git a/mlir/g3doc/Tutorials/Toy/Ch-3.md b/mlir/g3doc/Tutorials/Toy/Ch-3.md index 5ddcbd9ba0b7..498438ad03cf 100644 --- a/mlir/g3doc/Tutorials/Toy/Ch-3.md +++ b/mlir/g3doc/Tutorials/Toy/Ch-3.md @@ -214,7 +214,6 @@ class GenericCallOp llvm::StringRef getCalleeName(); private: - friend class mlir::Operation; using Op::Op; }; ``` diff --git a/mlir/include/mlir/AffineOps/AffineOps.h b/mlir/include/mlir/AffineOps/AffineOps.h index 0e08ad2fc680..a16480745c2e 100644 --- a/mlir/include/mlir/AffineOps/AffineOps.h +++ b/mlir/include/mlir/AffineOps/AffineOps.h @@ -60,7 +60,6 @@ public: class AffineApplyOp : public Op { public: - friend Operation; using Op::Op; /// Builds an affine apply op with the specified map and operands. @@ -120,7 +119,6 @@ public: class AffineForOp : public Op { public: - friend Operation; using Op::Op; // Hooks to customize behavior of this op. @@ -307,7 +305,6 @@ private: class AffineIfOp : public Op { public: - friend Operation; using Op::Op; // Hooks to customize behavior of this op. @@ -341,15 +338,11 @@ class AffineTerminatorOp : public Op { public: - friend Operation; using Op::Op; static void build(Builder *, OperationState *) {} static StringRef getOperationName() { return "affine.terminator"; } - -private: - friend Operation; }; /// Returns true if the given Value can be used as a dimension id. diff --git a/mlir/include/mlir/GPU/GPUDialect.h b/mlir/include/mlir/GPU/GPUDialect.h index 708aec484e52..ccd4e7d6b361 100644 --- a/mlir/include/mlir/GPU/GPUDialect.h +++ b/mlir/include/mlir/GPU/GPUDialect.h @@ -59,7 +59,6 @@ class LaunchOp : public Op::Impl, OpTrait::ZeroResult, OpTrait::NthRegionIsIsolatedAbove<0>::Impl> { public: - friend Operation; using Op::Op; static void build(Builder *builder, OperationState *result, Value *gridSizeX, diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h index 250fb942fb13..a50d4a362290 100644 --- a/mlir/include/mlir/IR/OpDefinition.h +++ b/mlir/include/mlir/IR/OpDefinition.h @@ -832,7 +832,6 @@ public: explicit Op(Operation *state) : OpState(state) { assert(!state || isa(state)); } - friend class Operation; private: template struct BaseVerifier; diff --git a/mlir/include/mlir/Linalg/IR/LinalgOps.h b/mlir/include/mlir/Linalg/IR/LinalgOps.h index f468b961bb24..6a6c953c3e0c 100644 --- a/mlir/include/mlir/Linalg/IR/LinalgOps.h +++ b/mlir/include/mlir/Linalg/IR/LinalgOps.h @@ -37,7 +37,6 @@ namespace linalg { class BufferAllocOp : public Op { public: - friend Operation; using Op::Op; // Hooks to customize the behavior of this op. @@ -61,7 +60,6 @@ public: class BufferDeallocOp : public Op { public: - friend Operation; using Op::Op; // Hooks to customize the behavior of this op. @@ -87,7 +85,6 @@ public: class LoadOp : public Op { public: - friend Operation; using Op::Op; // Hooks to customize the behavior of this op. @@ -116,7 +113,6 @@ public: class RangeOp : public Op::Impl, OpTrait::OneResult, OpTrait::HasNoSideEffect> { public: - friend Operation; using Op::Op; // Hooks to customize the behavior of this op. @@ -177,7 +173,6 @@ class SliceOp : public Op { public: - friend Operation; using Op::Op; // Hooks to customize the behavior of this op. @@ -254,7 +248,6 @@ class ViewOp : public Op { public: - friend Operation; using Op::Op; CmpIPredicate getPredicate() { @@ -208,7 +207,6 @@ class CondBranchOp : public Op::Impl, /// follows: /// { condition, [true_operands], [false_operands] } public: - friend Operation; using Op::Op; static StringRef getOperationName() { return "std.cond_br"; } @@ -300,7 +298,6 @@ private: /// class ConstantFloatOp : public ConstantOp { public: - friend Operation; using ConstantOp::ConstantOp; /// Builds a constant float op producing a float of the specified type. @@ -319,7 +316,6 @@ public: /// class ConstantIntOp : public ConstantOp { public: - friend Operation; using ConstantOp::ConstantOp; /// Build a constant int op producing an integer of the specified width. static void build(Builder *builder, OperationState *result, int64_t value, @@ -342,7 +338,6 @@ public: /// class ConstantIndexOp : public ConstantOp { public: - friend Operation; using ConstantOp::ConstantOp; /// Build a constant int op producing an index. @@ -393,7 +388,6 @@ public: class DmaStartOp : public Op { public: - friend Operation; using Op::Op; static void build(Builder *builder, OperationState *result, Value *srcMemRef, @@ -519,7 +513,6 @@ public: class DmaWaitOp : public Op { public: - friend Operation; using Op::Op; static void build(Builder *builder, OperationState *result, Value *tagMemRef, @@ -561,7 +554,6 @@ public: class LoadOp : public Op { public: - friend Operation; using Op::Op; // Hooks to customize behavior of this op. @@ -604,7 +596,6 @@ public: /// class MemRefCastOp : public CastOp { public: - friend Operation; using CastOp::CastOp; static StringRef getOperationName() { return "std.memref_cast"; } @@ -632,7 +623,6 @@ public: class ReturnOp : public Op { public: - friend Operation; using Op::Op; static StringRef getOperationName() { return "std.return"; } @@ -660,7 +650,6 @@ public: class SelectOp : public Op::Impl, OpTrait::OneResult, OpTrait::HasNoSideEffect> { public: - friend Operation; using Op::Op; static StringRef getOperationName() { return "std.select"; } @@ -690,7 +679,6 @@ public: class StoreOp : public Op { public: - friend Operation; using Op::Op; // Hooks to customize behavior of this op. @@ -731,7 +719,6 @@ public: /// class TensorCastOp : public CastOp { public: - friend Operation; using CastOp::CastOp; static StringRef getOperationName() { return "std.tensor_cast"; } diff --git a/mlir/include/mlir/VectorOps/VectorOps.h b/mlir/include/mlir/VectorOps/VectorOps.h index f529f98c29dd..e9c7551ad89e 100644 --- a/mlir/include/mlir/VectorOps/VectorOps.h +++ b/mlir/include/mlir/VectorOps/VectorOps.h @@ -93,7 +93,6 @@ class VectorTransferReadOp enum Offsets : unsigned { MemRefOffset = 0, FirstIndexOffset = 1 }; public: - friend Operation; using Op::Op; static StringRef getOperationName() { return "vector.transfer_read"; } @@ -158,7 +157,6 @@ class VectorTransferWriteOp }; public: - friend Operation; using Op::Op; static StringRef getOperationName() { return "vector.transfer_write"; } @@ -194,7 +192,6 @@ public: class VectorTypeCastOp : public Op { public: - friend Operation; using Op::Op; static StringRef getOperationName() { return "vector.type_cast"; } diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp index e72a704db8d1..673e20b16daa 100644 --- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp @@ -304,7 +304,6 @@ void OpClass::writeDeclTo(raw_ostream &os) const { for (const auto &trait : traits) os << ", " << trait; os << "> {\npublic:\n"; - os << " friend Operation;\n"; os << " using Op::Op;\n"; for (const auto &method : methods) { method.writeDeclTo(os);