Remove the explicit "friend Operation" statement from each of the derived operati...
authorRiver Riddle <riverriddle@google.com>
Sun, 12 May 2019 02:51:16 +0000 (19:51 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Mon, 20 May 2019 20:38:02 +0000 (13:38 -0700)
--

PiperOrigin-RevId: 247791672

16 files changed:
mlir/examples/Linalg/Linalg1/include/linalg1/RangeOp.h
mlir/examples/Linalg/Linalg1/include/linalg1/SliceOp.h
mlir/examples/Linalg/Linalg1/include/linalg1/ViewOp.h
mlir/examples/Linalg/Linalg2/include/linalg2/TensorOps.h
mlir/examples/Linalg/Linalg3/include/linalg3/LoadStoreOps.h
mlir/examples/toy/Ch3/include/toy/Dialect.h
mlir/examples/toy/Ch4/include/toy/Dialect.h
mlir/examples/toy/Ch5/include/toy/Dialect.h
mlir/g3doc/Tutorials/Toy/Ch-3.md
mlir/include/mlir/AffineOps/AffineOps.h
mlir/include/mlir/GPU/GPUDialect.h
mlir/include/mlir/IR/OpDefinition.h
mlir/include/mlir/Linalg/IR/LinalgOps.h
mlir/include/mlir/StandardOps/Ops.h
mlir/include/mlir/VectorOps/VectorOps.h
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

index 09e7252..7024a64 100644 (file)
@@ -31,7 +31,6 @@ class RangeOp : public mlir::Op<RangeOp, mlir::OpTrait::NOperands<3>::Impl,
                                 mlir::OpTrait::OneResult,
                                 mlir::OpTrait::HasNoSideEffect> {
 public:
-  friend mlir::Operation;
   using Op::Op;
 
   //////////////////////////////////////////////////////////////////////////////
index e9b5a88..7360c6b 100644 (file)
@@ -30,7 +30,6 @@ class SliceOp : public mlir::Op<SliceOp, mlir::OpTrait::NOperands<2>::Impl,
                                 mlir::OpTrait::OneResult,
                                 mlir::OpTrait::HasNoSideEffect> {
 public:
-  friend mlir::Operation;
   using Op::Op;
 
   //////////////////////////////////////////////////////////////////////////////
index d24b709..f5a6d57 100644 (file)
@@ -32,7 +32,6 @@ class ViewOp : public mlir::Op<ViewOp, mlir::OpTrait::VariadicOperands,
                                mlir::OpTrait::OneResult,
                                mlir::OpTrait::HasNoSideEffect> {
 public:
-  friend mlir::Operation;
   using Op::Op;
 
   //////////////////////////////////////////////////////////////////////////////
index a4a341f..1dd4c6b 100644 (file)
@@ -103,7 +103,6 @@ class DotOp : public TensorContractionBase<DotOp>,
               public mlir::Op<DotOp, mlir::OpTrait::VariadicOperands,
                               mlir::OpTrait::ZeroResult> {
 public:
-  friend mlir::Operation;
   using Op::Op;
   using TensorContractionBaseType =
       TensorContractionBase::TensorContractionBaseType;
@@ -165,7 +164,6 @@ class MatvecOp : public TensorContractionBase<MatvecOp>,
                  public mlir::Op<MatvecOp, mlir::OpTrait::VariadicOperands,
                                  mlir::OpTrait::ZeroResult> {
 public:
-  friend mlir::Operation;
   using Op::Op;
   using TensorContractionBaseType =
       TensorContractionBase::TensorContractionBaseType;
@@ -227,7 +225,6 @@ class MatmulOp : public TensorContractionBase<MatmulOp>,
                  public mlir::Op<MatmulOp, mlir::OpTrait::VariadicOperands,
                                  mlir::OpTrait::ZeroResult> {
 public:
-  friend mlir::Operation;
   using Op::Op;
   using TensorContractionBaseType =
       TensorContractionBase::TensorContractionBaseType;
index eb0e1ac..04d39ae 100644 (file)
@@ -30,7 +30,6 @@ class ViewType;
 class LoadOp : public mlir::Op<LoadOp, mlir::OpTrait::VariadicOperands,
                                mlir::OpTrait::OneResult> {
 public:
-  friend mlir::Operation;
   using Op::Op;
 
   //////////////////////////////////////////////////////////////////////////////
@@ -61,7 +60,6 @@ public:
 class StoreOp : public mlir::Op<StoreOp, mlir::OpTrait::VariadicOperands,
                                 mlir::OpTrait::ZeroResult> {
 public:
-  friend mlir::Operation;
   using Op::Op;
 
   //////////////////////////////////////////////////////////////////////////////
index 0ad95d4..84bd98e 100644 (file)
@@ -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;
 };
 
index b0a57d9..96e05dc 100644 (file)
@@ -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;
 };
 
index 6b6fe79..9d7f82d 100644 (file)
@@ -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;
 };
 
index 5ddcbd9..498438a 100644 (file)
@@ -214,7 +214,6 @@ class GenericCallOp
   llvm::StringRef getCalleeName();
 
  private:
-  friend class mlir::Operation;
   using Op::Op;
 };
 ```
index 0e08ad2..a164807 100644 (file)
@@ -60,7 +60,6 @@ public:
 class AffineApplyOp : public Op<AffineApplyOp, OpTrait::VariadicOperands,
                                 OpTrait::OneResult, OpTrait::HasNoSideEffect> {
 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<AffineForOp, OpTrait::VariadicOperands, OpTrait::ZeroResult> {
 public:
-  friend Operation;
   using Op::Op;
 
   // Hooks to customize behavior of this op.
@@ -307,7 +305,6 @@ private:
 class AffineIfOp
     : public Op<AffineIfOp, OpTrait::VariadicOperands, OpTrait::ZeroResult> {
 public:
-  friend Operation;
   using Op::Op;
 
   // Hooks to customize behavior of this op.
@@ -341,15 +338,11 @@ class AffineTerminatorOp
     : public Op<AffineTerminatorOp, OpTrait::ZeroOperands, OpTrait::ZeroResult,
                 OpTrait::IsTerminator> {
 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.
index 708aec4..ccd4e7d 100644 (file)
@@ -59,7 +59,6 @@ class LaunchOp : public Op<LaunchOp, OpTrait::AtLeastNOperands<6>::Impl,
                            OpTrait::ZeroResult,
                            OpTrait::NthRegionIsIsolatedAbove<0>::Impl> {
 public:
-  friend Operation;
   using Op::Op;
 
   static void build(Builder *builder, OperationState *result, Value *gridSizeX,
index 250fb94..a50d4a3 100644 (file)
@@ -832,7 +832,6 @@ public:
   explicit Op(Operation *state) : OpState(state) {
     assert(!state || isa<ConcreteOpType>(state));
   }
-  friend class Operation;
 
 private:
   template <typename... Types> struct BaseVerifier;
index f468b96..6a6c953 100644 (file)
@@ -37,7 +37,6 @@ namespace linalg {
 class BufferAllocOp
     : public Op<BufferAllocOp, OpTrait::OneOperand, OpTrait::OneResult> {
 public:
-  friend Operation;
   using Op::Op;
 
   // Hooks to customize the behavior of this op.
@@ -61,7 +60,6 @@ public:
 class BufferDeallocOp
     : public Op<BufferDeallocOp, OpTrait::OneOperand, OpTrait::ZeroResult> {
 public:
-  friend Operation;
   using Op::Op;
 
   // Hooks to customize the behavior of this op.
@@ -87,7 +85,6 @@ public:
 class LoadOp
     : public Op<LoadOp, OpTrait::VariadicOperands, OpTrait::OneResult> {
 public:
-  friend Operation;
   using Op::Op;
 
   // Hooks to customize the behavior of this op.
@@ -116,7 +113,6 @@ public:
 class RangeOp : public Op<RangeOp, OpTrait::NOperands<3>::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<SliceOp, OpTrait::VariadicOperands,
   enum { FirstIndexingOperand = 1 };
 
 public:
-  friend Operation;
   using Op::Op;
 
   // Hooks to customize the behavior of this op.
@@ -215,7 +210,6 @@ public:
 class StoreOp
     : public Op<StoreOp, OpTrait::VariadicOperands, OpTrait::ZeroResult> {
 public:
-  friend Operation;
   using Op::Op;
 
   // Hooks to customize the behavior of this op.
@@ -254,7 +248,6 @@ class ViewOp : public Op<ViewOp, OpTrait::VariadicOperands, OpTrait::OneResult,
   enum { FirstIndexingOperand = 1 };
 
 public:
-  friend Operation;
   using Op::Op;
 
   // Hooks to customize the behavior of this op.
index a373c23..e8adc16 100644 (file)
@@ -91,7 +91,6 @@ class CmpIOp
                 OpTrait::OneResult, OpTrait::ResultsAreBoolLike,
                 OpTrait::SameOperandsAndResultShape, OpTrait::HasNoSideEffect> {
 public:
-  friend Operation;
   using Op::Op;
 
   CmpIPredicate getPredicate() {
@@ -208,7 +207,6 @@ class CondBranchOp : public Op<CondBranchOp, OpTrait::AtLeastNOperands<1>::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<DmaStartOp, OpTrait::VariadicOperands, OpTrait::ZeroResult> {
 public:
-  friend Operation;
   using Op::Op;
 
   static void build(Builder *builder, OperationState *result, Value *srcMemRef,
@@ -519,7 +513,6 @@ public:
 class DmaWaitOp
     : public Op<DmaWaitOp, OpTrait::VariadicOperands, OpTrait::ZeroResult> {
 public:
-  friend Operation;
   using Op::Op;
 
   static void build(Builder *builder, OperationState *result, Value *tagMemRef,
@@ -561,7 +554,6 @@ public:
 class LoadOp
     : public Op<LoadOp, OpTrait::VariadicOperands, OpTrait::OneResult> {
 public:
-  friend Operation;
   using Op::Op;
 
   // Hooks to customize behavior of this op.
@@ -604,7 +596,6 @@ public:
 ///
 class MemRefCastOp : public CastOp<MemRefCastOp> {
 public:
-  friend Operation;
   using CastOp::CastOp;
   static StringRef getOperationName() { return "std.memref_cast"; }
 
@@ -632,7 +623,6 @@ public:
 class ReturnOp : public Op<ReturnOp, OpTrait::VariadicOperands,
                            OpTrait::ZeroResult, OpTrait::IsTerminator> {
 public:
-  friend Operation;
   using Op::Op;
 
   static StringRef getOperationName() { return "std.return"; }
@@ -660,7 +650,6 @@ public:
 class SelectOp : public Op<SelectOp, OpTrait::NOperands<3>::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<StoreOp, OpTrait::VariadicOperands, OpTrait::ZeroResult> {
 public:
-  friend Operation;
   using Op::Op;
 
   // Hooks to customize behavior of this op.
@@ -731,7 +719,6 @@ public:
 ///
 class TensorCastOp : public CastOp<TensorCastOp> {
 public:
-  friend Operation;
   using CastOp::CastOp;
 
   static StringRef getOperationName() { return "std.tensor_cast"; }
index f529f98..e9c7551 100644 (file)
@@ -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<VectorTypeCastOp, OpTrait::OneOperand, OpTrait::OneResult> {
 public:
-  friend Operation;
   using Op::Op;
 
   static StringRef getOperationName() { return "vector.type_cast"; }
index e72a704..673e20b 100644 (file)
@@ -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);