With this commit, PadF may serve as a node of Op tree.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
#define __COCO_IR_PAD_F_H__
#include "coco/IR/Op.h"
+#include "coco/IR/Part.h"
#include "coco/IR/Padding2D.h"
namespace coco
const PadF *asPadF(void) const override { return this; }
public:
+ Op *arg(void) const { return _arg.child(); }
+ void arg(Op *arg) { _arg.child(arg); }
+
+public:
Padding2D *pad(void) { return &_pad; }
const Padding2D *pad(void) const { return &_pad; }
private:
+ // @brief An argument of PadF operation (= IFM)
+ Part _arg;
+
+private:
Padding2D _pad;
};
namespace coco
{
-PadF::PadF()
+PadF::PadF() : _arg{this}
{
// DO NOTHING
}
{
// NOTE PadF accesses no object
std::set<Object *> res;
+
+ if (auto ifm = arg())
+ {
+ for (auto obj : ifm->uses())
+ {
+ res.insert(obj);
+ }
+ }
+
return res;
}
// parent() should be nullptr on construction
ASSERT_EQ(op->parent(), nullptr);
+ // arg() should be nullptr on construction
+ ASSERT_EQ(op->arg(), nullptr);
+
// pad() should be a valid
ASSERT_NE(op->pad(), nullptr);
}