summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorEdB <[email protected]>2014-12-14 11:31:21 +0100
committerFrancisco Jerez <[email protected]>2015-01-28 02:27:41 +0200
commit13d23a9a176b62453d36035b5d793082a638a686 (patch)
tree6fab548b1b26f6b16f0281c76a52e6d05378b585 /src/gallium/state_trackers
parent349df23eb0d119e3f22ff6149824497414f07505 (diff)
clover/llvm: Move CLOVER_DEBUG stuff into anonymous namespace.
[ Francisco Jerez: As we're at it make debug_options[] local to its only user and remove temporary. ] Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/clover/llvm/invocation.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index edeed56ea90..085bb6ac182 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
@@ -672,19 +672,27 @@ namespace {
targets_initialized = true;
}
}
-} // End anonymous namespace
#define DBG_CLC (1 << 0)
#define DBG_LLVM (1 << 1)
#define DBG_ASM (1 << 2)
-static const struct debug_named_value debug_options[] = {
- {"clc", DBG_CLC, "Dump the OpenCL C code for all kernels."},
- {"llvm", DBG_LLVM, "Dump the generated LLVM IR for all kernels."},
- {"asm", DBG_ASM, "Dump kernel assembly code for targets specifying "
- "PIPE_SHADER_IR_NATIVE"},
- DEBUG_NAMED_VALUE_END // must be last
-};
+ unsigned
+ get_debug_flags() {
+ static const struct debug_named_value debug_options[] = {
+ {"clc", DBG_CLC, "Dump the OpenCL C code for all kernels."},
+ {"llvm", DBG_LLVM, "Dump the generated LLVM IR for all kernels."},
+ {"asm", DBG_ASM, "Dump kernel assembly code for targets specifying "
+ "PIPE_SHADER_IR_NATIVE"},
+ DEBUG_NAMED_VALUE_END // must be last
+ };
+ static const unsigned debug_flags =
+ debug_get_flags_option("CLOVER_DEBUG", debug_options, 0);
+
+ return debug_flags;
+ }
+
+} // End anonymous namespace
module
clover::compile_program_llvm(const compat::string &source,
@@ -695,8 +703,6 @@ clover::compile_program_llvm(const compat::string &source,
compat::string &r_log) {
init_targets();
- static unsigned debug_flags = debug_get_flags_option("CLOVER_DEBUG",
- debug_options, 0);
std::vector<llvm::Function *> kernels;
size_t processor_str_len = std::string(target).find_first_of("-");
@@ -721,10 +727,10 @@ clover::compile_program_llvm(const compat::string &source,
optimize(mod, optimization_level, kernels);
- if (debug_flags & DBG_CLC)
+ if (get_debug_flags() & DBG_CLC)
debug_log(source, ".cl");
- if (debug_flags & DBG_LLVM) {
+ if (get_debug_flags() & DBG_LLVM) {
std::string log;
llvm::raw_string_ostream s_log(log);
mod->print(s_log, NULL);
@@ -745,7 +751,8 @@ clover::compile_program_llvm(const compat::string &source,
break;
case PIPE_SHADER_IR_NATIVE: {
std::vector<char> code = compile_native(mod, triple, processor,
- debug_flags & DBG_ASM, r_log);
+ get_debug_flags() & DBG_ASM,
+ r_log);
m = build_module_native(code, mod, kernels, address_spaces, r_log);
break;
}