[Beignet] [PATCH V2 5/5] Enable structural analysis

Yongjia Zhang zhang_yong_jia at 126.com
Thu Jul 17 11:14:41 PDT 2014


enable structural analysis and use if, else and endif in the
generated asm.

Signed-off-by: Yongjia Zhang <yongjia.zhang at intel.com>
---
 backend/src/llvm/llvm_to_gen.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp
index 153b11d..328dbc1 100644
--- a/backend/src/llvm/llvm_to_gen.cpp
+++ b/backend/src/llvm/llvm_to_gen.cpp
@@ -60,6 +60,8 @@
 #include "llvm/llvm_to_gen.hpp"
 #include "sys/cvar.hpp"
 #include "sys/platform.hpp"
+#include "ir/unit.hpp"
+#include "ir/structural_analysis.hpp"
 
 #include <clang/CodeGen/CodeGenAction.h>
 
@@ -244,6 +246,16 @@ namespace gbe
 #endif
     passes.run(mod);
 
+    const ir::Unit::FunctionSet& fs = unit.getFunctionSet();
+    ir::Unit::FunctionSet::const_iterator iter = fs.begin();
+    while(iter != fs.end())
+    {
+      analysis::ControlTree *ct = new analysis::ControlTree(iter->second);
+      ct->analyze();
+      delete ct;
+      iter++;
+    }
+
     return true;
   }
 } /* namespace gbe */
-- 
1.8.3.2




More information about the Beignet mailing list