From 4cc507eba93354477417ea18a3894f5f6c31c4cc Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=B2=9C=EA=B5=90/On-Device=20Lab=28SR=29/Enginee?= =?utf8?q?r/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 26 Nov 2019 08:02:02 +0900 Subject: [PATCH] [exo] Remove deprecated CommutativeArgsGetter (#9188) This commit removes deprecated `CommutativeArgsGetter`. This is replaced by `NodeFiller`. Comment for helper also updated. Signed-off-by: Cheongyo Bahk --- compiler/exo/src/Pass/FuseInstanceNormPass.cpp | 77 +------------------------- 1 file changed, 1 insertion(+), 76 deletions(-) diff --git a/compiler/exo/src/Pass/FuseInstanceNormPass.cpp b/compiler/exo/src/Pass/FuseInstanceNormPass.cpp index 45416b2..a3e21c6 100644 --- a/compiler/exo/src/Pass/FuseInstanceNormPass.cpp +++ b/compiler/exo/src/Pass/FuseInstanceNormPass.cpp @@ -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 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 bool is(ARG_TYPE_1 *&arg_1, ARG_TYPE_2 *&arg_2); - -private: - COMM_NODE *_node = nullptr; -}; - -template -inline CommutativeArgsGetter commutative_args_of(COMM_NODE *node) -{ - return CommutativeArgsGetter{node}; -} - -template -template -bool CommutativeArgsGetter::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(_node->x()); - auto y = dynamic_cast(_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(_node->x()); - auto y = dynamic_cast(_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 NodeFiller final { public: -- 2.7.4