[exo] Remove deprecated CommutativeArgsGetter (#9188)
author박천교/On-Device Lab(SR)/Engineer/삼성전자 <ch.bahk@samsung.com>
Mon, 25 Nov 2019 23:02:02 +0000 (08:02 +0900)
committer박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Mon, 25 Nov 2019 23:02:02 +0000 (08:02 +0900)
This commit removes deprecated `CommutativeArgsGetter`. This is replaced
by `NodeFiller`. Comment for helper also updated.

Signed-off-by: Cheongyo Bahk <ch.bahk@samsung.com>
compiler/exo/src/Pass/FuseInstanceNormPass.cpp

index 45416b2..a3e21c6 100644 (file)
@@ -40,7 +40,7 @@ namespace
  *         ARG_TYPE_1 *arg1;
  *         ARG_TYPE_2 *arg2;
  *
- *         bool ok = commutative_args_of(node).is(arg1, arg2);
+ *         bool ok = fill(&arg1, &arg2).with_commutative_args_of(node);
  *
  * Result
  *         If 'node's commutative argument types are actually {ARG_TYPE_1, ARG_TYPE_2}
@@ -49,81 +49,6 @@ namespace
  *         Otherwise, 'arg1' and 'arg2' not changed, 'ok' is false.
  */
 
-/// @require  COMM_NODE has member x() and y()
-template <class COMM_NODE> class CommutativeArgsGetter final
-{
-public:
-  CommutativeArgsGetter(COMM_NODE *node) : _node(node)
-  {
-    assert(node);
-    assert(node->arity() == 2);
-    assert(node->x());
-    assert(node->y());
-  }
-
-public:
-  /**
-   * @note  This function might make change to arguments
-   *
-   * @param[out] arg_*  These would be set to actual argument node pointer on check success
-   *
-   * @return true   When '_node's argument types are 'ARG_TYPE_1' and 'ARG_TYPE_2'
-   *                In such case, it assign 'arg_1' and 'arg_2' to actual arguments
-   *
-   * @return false  When '_node's argument types are NOT matched with 'ARG_TYPE_*'
-   *                In such case, it does not amend 'arg_1' and 'arg_2'
-   */
-  template <class ARG_TYPE_1, class ARG_TYPE_2> bool is(ARG_TYPE_1 *&arg_1, ARG_TYPE_2 *&arg_2);
-
-private:
-  COMM_NODE *_node = nullptr;
-};
-
-template <class COMM_NODE>
-inline CommutativeArgsGetter<COMM_NODE> commutative_args_of(COMM_NODE *node)
-{
-  return CommutativeArgsGetter<COMM_NODE>{node};
-}
-
-template <class COMM_NODE>
-template <class ARG_TYPE_1, class ARG_TYPE_2>
-bool CommutativeArgsGetter<COMM_NODE>::is(ARG_TYPE_1 *&arg_1, ARG_TYPE_2 *&arg_2)
-{
-  // Case 1) X == ARG_TYPE_1 / Y == ARG_TYPE_2
-  {
-    auto x = dynamic_cast<ARG_TYPE_1 *>(_node->x());
-    auto y = dynamic_cast<ARG_TYPE_2 *>(_node->y());
-
-    if (x && y)
-    {
-      arg_1 = x;
-      arg_2 = y;
-      return true;
-    }
-  }
-
-  // Case 2) X == ARG_TYPE_2 / Y == ARG_TYPE_1
-  {
-    auto x = dynamic_cast<ARG_TYPE_2 *>(_node->x());
-    auto y = dynamic_cast<ARG_TYPE_1 *>(_node->y());
-
-    if (x && y)
-    {
-      arg_1 = y;
-      arg_2 = x;
-      return true;
-    }
-  }
-
-  return false;
-}
-
-/**
- * Alternative approach
- *
- *         bool ok = fill(&arg1, &arg2).with_commutative_args_of(node);
- */
-
 template <class ARG_TYPE_1, class ARG_TYPE_2> class NodeFiller final
 {
 public: