[Beignet] [PATCH] GBE: Implement liveness dump.

Ruiling Song ruiling.song at intel.com
Wed Sep 23 19:05:07 PDT 2015


Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
 backend/src/ir/liveness.cpp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/backend/src/ir/liveness.cpp b/backend/src/ir/liveness.cpp
index c5a6374..62a95ea 100644
--- a/backend/src/ir/liveness.cpp
+++ b/backend/src/ir/liveness.cpp
@@ -273,6 +273,26 @@ namespace ir {
 #endif
    }
 
+  std::ostream &operator<< (std::ostream &out, const Liveness &live) {
+    const Function &fn = live.getFunction();
+    fn.foreachBlock([&] (const BasicBlock &bb) {
+      out << std::endl;
+      out << "Label $" << bb.getLabelIndex() << std::endl;
+      const Liveness::BlockInfo &bbInfo = live.getBlockInfo(&bb);
+      out << "liveIn:" << std::endl;
+      for (auto &x: bbInfo.upwardUsed) {
+        out << x << " ";
+      }
+      out << std::endl << "liveOut:" << std::endl;
+      for (auto &x : bbInfo.liveOut)
+        out << x << " ";
+      out << std::endl << "varKill:" << std::endl;
+      for (auto &x : bbInfo.varKill)
+        out << x << " ";
+      out << std::endl;
+    });
+    return out;
+  }
 
   /*! To pretty print the livfeness info */
   static const uint32_t prettyInsnStrSize = 48;
-- 
2.3.1



More information about the Beignet mailing list