[Beignet] [PATCH 3/3] GBE: Enable CFG printer.
Ruiling Song
ruiling.song at intel.com
Thu Apr 10 23:48:18 PDT 2014
export OCL_OUTPUT_CFG=1
or export OCL_OUTPUT_CFG_ONLY=1
then it will output .dot file of CFG for the compiled kernels.
The CFG_ONLY means pure cfg without llvm IR.
You can use xdot to view .dot file.
Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
backend/src/llvm/llvm_to_gen.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp
index 50b84ce..37a5b2b 100644
--- a/backend/src/llvm/llvm_to_gen.cpp
+++ b/backend/src/llvm/llvm_to_gen.cpp
@@ -55,6 +55,7 @@
#include "llvm/Assembly/PrintModulePass.h"
#endif
+#include "llvm/Analysis/CFGPrinter.h"
#include "llvm/llvm_gen_backend.hpp"
#include "llvm/llvm_to_gen.hpp"
#include "sys/cvar.hpp"
@@ -68,6 +69,8 @@
namespace gbe
{
BVAR(OCL_OUTPUT_LLVM, false);
+ BVAR(OCL_OUTPUT_CFG, false);
+ BVAR(OCL_OUTPUT_CFG_ONLY, false);
BVAR(OCL_OUTPUT_LLVM_BEFORE_EXTRA_PASS, false);
using namespace llvm;
@@ -204,6 +207,11 @@ namespace gbe
passes.add(createDeadInstEliminationPass()); // Remove simplified instructions
passes.add(createCFGSimplificationPass()); // Merge & remove BBs
passes.add(createScalarizePass()); // Expand all vector ops
+
+ if(OCL_OUTPUT_CFG)
+ passes.add(createCFGPrinterPass());
+ if(OCL_OUTPUT_CFG_ONLY)
+ passes.add(createCFGOnlyPrinterPass());
passes.add(createGenPass(unit));
// Print the code extra optimization passes
--
1.7.10.4
More information about the Beignet
mailing list