[coco] Store size in Bag (#1531)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Mon, 17 Sep 2018 10:02:07 +0000 (19:02 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 17 Sep 2018 10:02:07 +0000 (19:02 +0900)
This commit revises Bag to store its size in it. This is a step toward
Bag/BagInfo unification.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/coco/core/include/coco/IR/Bag.h
contrib/coco/core/src/IR/Bag.cpp

index f439eef..3b73534 100644 (file)
@@ -107,6 +107,8 @@ private:
   std::unique_ptr<BagInfo> _info;
 
 private:
+  uint32_t _size;
+
   /** @brief Links to dependent Object(s) */
   DepSet _deps;
   /** @brief Direct reads (not through Object) */
index 5f6f305..1e468e2 100644 (file)
 namespace coco
 {
 
-Bag::Bag(std::unique_ptr<BagInfo> &&info) : _info{std::move(info)}
-{
-  // DO NOTHING
-}
+Bag::Bag(std::unique_ptr<BagInfo> &&info) : _info{std::move(info)} { _size = _info->size(); }
 
 Bag::~Bag()
 {
@@ -25,7 +22,7 @@ Bag::~Bag()
   assert(updates()->size() == 0);
 }
 
-uint32_t Bag::size(void) const { return _info->size(); }
+uint32_t Bag::size(void) const { return _size; }
 
 bool Bag::isInput(void) const { return _input != nullptr; }
 bool Bag::isOutput(void) const { return _output != nullptr; }