From 3681108c2d18ef5b8e2489f3f42fb5dc0e201812 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: Mon, 23 Jul 2018 10:07:34 +0900 Subject: [PATCH] [coco] Add 'BagManager' (#751) This commit adds 'BagManager' with base implementation, which creates and tracks 'Bag' objects in coco IR. Signed-off-by: Jonghyun Park --- contrib/coco/core/include/coco/IR/BagManager.h | 18 ++++++++++++++++++ contrib/coco/core/src/IR/BagManager.cpp | 13 +++++++++++++ contrib/coco/core/src/IR/BagManager.test.cpp | 12 ++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 contrib/coco/core/include/coco/IR/BagManager.h create mode 100644 contrib/coco/core/src/IR/BagManager.cpp create mode 100644 contrib/coco/core/src/IR/BagManager.test.cpp diff --git a/contrib/coco/core/include/coco/IR/BagManager.h b/contrib/coco/core/include/coco/IR/BagManager.h new file mode 100644 index 0000000..b3cddeb --- /dev/null +++ b/contrib/coco/core/include/coco/IR/BagManager.h @@ -0,0 +1,18 @@ +#ifndef __BAG_MANAGER_H__ +#define __BAG_MANAGER_H__ + +#include "coco/IR/Bag.h" + +#include "coco/ADT/PtrManager.h" + +namespace coco +{ + +struct BagManager : public PtrManager +{ + Bag *create(uint32_t size); +}; + +} // namespace coco + +#endif // __BAG_MANAGER_H__ diff --git a/contrib/coco/core/src/IR/BagManager.cpp b/contrib/coco/core/src/IR/BagManager.cpp new file mode 100644 index 0000000..96177a5 --- /dev/null +++ b/contrib/coco/core/src/IR/BagManager.cpp @@ -0,0 +1,13 @@ +#include "coco/IR/BagManager.h" + +#include + +namespace coco +{ + +Bag *BagManager::create(uint32_t size) +{ + return take(nncc::foundation::make_unique(size)); +} + +} // namespace coco diff --git a/contrib/coco/core/src/IR/BagManager.test.cpp b/contrib/coco/core/src/IR/BagManager.test.cpp new file mode 100644 index 0000000..fb5cd73 --- /dev/null +++ b/contrib/coco/core/src/IR/BagManager.test.cpp @@ -0,0 +1,12 @@ +#include "coco/IR/BagManager.h" + +#include + +TEST(IR_BAG_MANAGER, create) +{ + coco::BagManager mgr; + + auto bag = mgr.create(3); + + ASSERT_EQ(bag->size(), 3); +} -- 2.7.4