1. Add a bool env OCL_DEBUGINFO to enable generate debug infomation while 
compiling cl source, set it false as default value.
    2. Define a structure type DebugInfo.

Signed-off-by: Yannan Bai <[email protected]>
---
 backend/src/backend/program.cpp | 2 ++
 backend/src/backend/program.h   | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index 472734b..774ce29 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -515,6 +515,7 @@ namespace gbe {
     program->CleanLlvmResource();
   }
 
+  BVAR(OCL_DEBUGINFO, false);
 #ifdef GBE_COMPILER_AVAILABLE
   BVAR(OCL_OUTPUT_BUILD_LOG, false);
 
@@ -553,6 +554,7 @@ namespace gbe {
 #endif /* LLVM_VERSION_MINOR <= 2 */
     args.push_back("stringInput.cl");
     args.push_back("-ffp-contract=off");
+    if(OCL_DEBUGINFO) args.push_back("-g");
 
     // The compiler invocation needs a DiagnosticsEngine so it can report 
problems
     std::string ErrorString;
diff --git a/backend/src/backend/program.h b/backend/src/backend/program.h
index 86b3177..1baacdf 100644
--- a/backend/src/backend/program.h
+++ b/backend/src/backend/program.h
@@ -36,6 +36,11 @@
 extern "C" {
 #endif /* __cplusplus */
 
+typedef struct _DebugInfo {
+    uint32_t line;
+    uint32_t col;
+} DebugInfo;
+
 /*! Opaque structure that interfaces a GBE program */
 typedef struct _gbe_program *gbe_program;
 
-- 
1.9.1

_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to