From 56dfef4240b75f5d8ee3e328897bda49ec98893b Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Wed, 25 Jul 2018 09:35:47 +0900 Subject: [PATCH] [coco] Support Output alloc through EntityManager (#788) This commit revises EntityManager (and related implementation) to support 'Output' object allocation through EntityManager. Signed-off-by: Jonghyun Park --- contrib/coco/core/include/coco/IR/EntityManager.h | 4 ++++ contrib/coco/core/src/IR/Module.cpp | 8 ++++++++ contrib/coco/core/src/IR/Module.test.cpp | 3 +++ 3 files changed, 15 insertions(+) diff --git a/contrib/coco/core/include/coco/IR/EntityManager.h b/contrib/coco/core/include/coco/IR/EntityManager.h index 5ec93fd..4f950b0 100644 --- a/contrib/coco/core/include/coco/IR/EntityManager.h +++ b/contrib/coco/core/include/coco/IR/EntityManager.h @@ -9,6 +9,7 @@ #include "coco/IR/BlockManager.h" #include "coco/IR/InputManager.h" +#include "coco/IR/OutputManager.h" namespace coco { @@ -40,6 +41,9 @@ struct EntityManager virtual InputManager *input(void) = 0; virtual const InputManager *input(void) const = 0; + + virtual OutputManager *output(void) = 0; + virtual const OutputManager *output(void) const = 0; }; } // namespace coco diff --git a/contrib/coco/core/src/IR/Module.cpp b/contrib/coco/core/src/IR/Module.cpp index 85a0885..91f6a6a 100644 --- a/contrib/coco/core/src/IR/Module.cpp +++ b/contrib/coco/core/src/IR/Module.cpp @@ -48,6 +48,13 @@ public: public: coco::InputManager *input(void) override { return _input.get(); } const coco::InputManager *input(void) const override { return _input.get(); } + +public: + std::unique_ptr _output; + +public: + coco::OutputManager *output(void) override { return _output.get(); } + const coco::OutputManager *output(void) const override { return _output.get(); } }; } // namespace @@ -110,6 +117,7 @@ std::unique_ptr Module::create(void) mgr->_instr = nncc::foundation::make_unique(ins_link.get()); mgr->_block = nncc::foundation::make_unique(blk_link.get(), ins_link.get()); mgr->_input = nncc::foundation::make_unique(); + mgr->_output = nncc::foundation::make_unique(); } m->_entity = std::move(mgr); diff --git a/contrib/coco/core/src/IR/Module.test.cpp b/contrib/coco/core/src/IR/Module.test.cpp index f2e8ed6..84bdea3 100644 --- a/contrib/coco/core/src/IR/Module.test.cpp +++ b/contrib/coco/core/src/IR/Module.test.cpp @@ -32,6 +32,9 @@ TEST(IR_MODULE, create) ASSERT_NE(mutable_m->entity()->input(), nullptr); ASSERT_EQ(immutable_m->entity()->input(), mutable_m->entity()->input()); + ASSERT_NE(mutable_m->entity()->output(), nullptr); + ASSERT_EQ(immutable_m->entity()->output(), mutable_m->entity()->output()); + ASSERT_NE(mutable_m->block(), nullptr); ASSERT_EQ(immutable_m->block(), mutable_m->block()); -- 2.7.4