*/
namespace
{
+std::string op_kind(const coco::Op *op);
+
+/**
+ * @brief Return the def(producer) type of object
+ */
+std::string def_kind(const coco::Def *def)
+{
+ if (def)
+ {
+ if (auto instr = dynamic_cast<coco::Instr *>(def->producer()))
+ {
+ std::stringstream ss;
+
+ if (auto eval = instr->asEval())
+ {
+ ss << op_kind(eval->op()) << "(" << instr << ")";
+ return ss.str();
+ }
+ else if (instr->asCopy())
+ {
+ ss << "Copy(" << instr << ")";
+ return ss.str();
+ }
+ else if (instr->asShuffle())
+ {
+ ss << "Shuffle(" << instr << ")";
+ return ss.str();
+ }
+ }
+ }
+
+ return "(unknown)";
+}
pp::LinearDocument describe(const coco::Object *obj)
{
doc.append("addr: ", obj);
doc.append("bag: ", obj->bag());
- // TODO Show Def
+ doc.append("producer: ", def_kind(obj->def()));
// TODO Show Uses
// TODO Show FeatureObject/KernelObect info