#include "coco/IR/BagInfo.forward.h"
#include "coco/IR/ObjectSet.h"
+#include "coco/IR/Locatable.h"
#include <set>
class Bag
{
public:
- struct Update
+ struct Update : public Locatable
{
virtual ~Update() = default;
};
using UpdateSet = std::set<Update *>;
- struct Read
+ struct Read : public Locatable
{
virtual ~Read() = default;
};
std::set<Bag *> reads(void) const override;
std::set<Bag *> updates(void) const override;
+public:
+ Instr *loc(void) override { return this; }
+
private:
PtrLink<Op, Instr> *const _op_link;
const PtrLink<Instr, Block> *const _link;
--- /dev/null
+#ifndef __COCO_IR_LOCATABLE_H__
+#define __COCO_IR_LOCATABLE_H__
+
+#include "coco/IR/Instr.forward.h"
+
+namespace coco
+{
+
+struct Locatable
+{
+ virtual ~Locatable() = default;
+
+ virtual Instr *loc(void) = 0;
+};
+
+} // namespace coco
+
+#endif // __COCO_IR_LOCATABLE_H__
Conv2D *asConv2D(void) override { return this; }
const Conv2D *asConv2D(void) const override { return this; }
+public:
+ Instr *loc(void) override { return parent(); }
+
private:
UseSlot<KernelObject> _ker;
{
struct Def final : public coco::Object::Def
{
+ coco::Instr *loc(void) override { return nullptr; }
};
} // namespace mock
} // namespace
public:
std::set<coco::Bag *> reads(void) const override { return std::set<coco::Bag *>(); }
std::set<coco::Bag *> updates(void) const override { return std::set<coco::Bag *>(); }
+
+public:
+ coco::Instr *loc(void) override { return this; }
};
} // namespace mock
} // namespace
{
struct Use final : public coco::Object::Use
{
+ coco::Instr *loc(void) override { return nullptr; }
};
} // namespace mock
} // namespace