diff options
author | Bai Yannan <yannan.bai@intel.com> | 2015-11-18 16:28:35 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2015-12-02 15:28:59 +0800 |
commit | 32664c3f9b2624f0f3cea5f2b92a4fbfd5301674 (patch) | |
tree | addfe0c7c7f8100185630b20b299524b6712ea10 | |
parent | ec92544c387c5c2e3c7f6acfccddd353e7974e13 (diff) |
GBE/DebugInfo: Enable new feature
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 <yannan.bai@intel.com>
Reviewed-by: Ruiling Song <ruiling.song@intel.com>
-rw-r--r-- | backend/src/backend/program.cpp | 2 | ||||
-rw-r--r-- | backend/src/backend/program.h | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp index adf22182..e2d3f4f3 100644 --- a/backend/src/backend/program.cpp +++ b/backend/src/backend/program.cpp @@ -529,6 +529,7 @@ namespace gbe { program->CleanLlvmResource(); } + BVAR(OCL_DEBUGINFO, false); #ifdef GBE_COMPILER_AVAILABLE static bool buildModuleFromSource(const char *source, llvm::Module** out_module, llvm::LLVMContext* llvm_ctx, std::string dumpLLVMFileName, std::vector<std::string>& options, size_t stringSize, char *err, @@ -565,6 +566,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 f948a6b3..51797ee4 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; |