[loco] Clean up deprecated FixedArityNode class (#6970)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 28 Aug 2019 02:16:12 +0000 (11:16 +0900)
committer오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 28 Aug 2019 02:16:12 +0000 (11:16 +0900)
Let's clean up deprecated FixedArityNode class.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
compiler/loco/include/loco/IR/Node.h
compiler/loco/src/IR/Node.test.cpp
compiler/loco/src/Service/MultiDialectShapeInferenceRule.test.cpp
compiler/loco/src/Service/TypeInference.test.cpp

index fd9104e..ef0bf23 100644 (file)
@@ -142,43 +142,6 @@ private:
 
 Subst<SubstQualifier::Default> replace(Node *node);
 
-/**
- * @brief Nodes with the fixed number of inputs
- */
-template <unsigned N, typename Base> class FixedArityNode : public Base
-{
-public:
-  FixedArityNode()
-  {
-    for (uint32_t n = 0; n < N; ++n)
-    {
-      _args[n] = std::unique_ptr<Use>{new Use{this}};
-    }
-  }
-
-  virtual ~FixedArityNode() = default;
-
-public:
-  unsigned arity(void) const final { return N; }
-
-  Node *arg(uint32_t n) const final { return _args.at(n)->node(); }
-
-  void drop(void) final
-  {
-    for (uint32_t n = 0; n < N; ++n)
-    {
-      _args.at(n)->node(nullptr);
-    }
-  }
-
-protected:
-  // This API allows inherited classes to access "_args" field.
-  Use *at(unsigned n) const { return _args.at(n).get(); }
-
-private:
-  std::array<std::unique_ptr<Use>, N> _args;
-};
-
 } // namespace loco
 
 #endif // __LOCO_IR_NODE_H__
index 554543c..00e4444 100644 (file)
@@ -84,6 +84,8 @@ TEST(NodeTest, constructor)
   ASSERT_EQ(node.graph(), nullptr);
 }
 
+// TODO Rewrite this as a FixedAritry mix-in test
+#if 0
 TEST(FixedArityNodeTest, constructor)
 {
   struct DerivedNode final : public loco::FixedArityNode<1, loco::Node>
@@ -97,3 +99,4 @@ TEST(FixedArityNodeTest, constructor)
   ASSERT_EQ(node.arity(), 1);
   ASSERT_EQ(node.arg(0), nullptr);
 }
+#endif
index ace7947..ffa9ee5 100644 (file)
@@ -42,7 +42,7 @@ public:
 };
 
 template <uint32_t D1, uint32_t D2>
-struct TestOpNode final : public loco::FixedArityNode<1, loco::Node>,
+struct TestOpNode final : public loco::FixedArity<1>::Mixin<loco::Node>,
                           public loco::NodeMixin<loco::NodeTrait::TensorShape>
 {
   void input(Node *node) { at(0)->node(node); }
index d725306..ff00bfd 100644 (file)
@@ -183,7 +183,7 @@ public:
 };
 
 template <loco::DataType N>
-struct TestOpNode final : public loco::FixedArityNode<1, loco::Node>,
+struct TestOpNode final : public loco::FixedArity<1>::Mixin<loco::Node>,
                           public loco::NodeMixin<loco::NodeTrait::DataType>
 {
   void input(Node *node) { at(0)->node(node); }