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 <currojerez@riseup.net>
This commit is contained in:
@@ -672,19 +672,27 @@ namespace {
|
|||||||
targets_initialized = true;
|
targets_initialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // End anonymous namespace
|
|
||||||
|
|
||||||
#define DBG_CLC (1 << 0)
|
#define DBG_CLC (1 << 0)
|
||||||
#define DBG_LLVM (1 << 1)
|
#define DBG_LLVM (1 << 1)
|
||||||
#define DBG_ASM (1 << 2)
|
#define DBG_ASM (1 << 2)
|
||||||
|
|
||||||
static const struct debug_named_value debug_options[] = {
|
unsigned
|
||||||
{"clc", DBG_CLC, "Dump the OpenCL C code for all kernels."},
|
get_debug_flags() {
|
||||||
{"llvm", DBG_LLVM, "Dump the generated LLVM IR for all kernels."},
|
static const struct debug_named_value debug_options[] = {
|
||||||
{"asm", DBG_ASM, "Dump kernel assembly code for targets specifying "
|
{"clc", DBG_CLC, "Dump the OpenCL C code for all kernels."},
|
||||||
"PIPE_SHADER_IR_NATIVE"},
|
{"llvm", DBG_LLVM, "Dump the generated LLVM IR for all kernels."},
|
||||||
DEBUG_NAMED_VALUE_END // must be last
|
{"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
|
module
|
||||||
clover::compile_program_llvm(const compat::string &source,
|
clover::compile_program_llvm(const compat::string &source,
|
||||||
@@ -695,8 +703,6 @@ clover::compile_program_llvm(const compat::string &source,
|
|||||||
compat::string &r_log) {
|
compat::string &r_log) {
|
||||||
|
|
||||||
init_targets();
|
init_targets();
|
||||||
static unsigned debug_flags = debug_get_flags_option("CLOVER_DEBUG",
|
|
||||||
debug_options, 0);
|
|
||||||
|
|
||||||
std::vector<llvm::Function *> kernels;
|
std::vector<llvm::Function *> kernels;
|
||||||
size_t processor_str_len = std::string(target).find_first_of("-");
|
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);
|
optimize(mod, optimization_level, kernels);
|
||||||
|
|
||||||
if (debug_flags & DBG_CLC)
|
if (get_debug_flags() & DBG_CLC)
|
||||||
debug_log(source, ".cl");
|
debug_log(source, ".cl");
|
||||||
|
|
||||||
if (debug_flags & DBG_LLVM) {
|
if (get_debug_flags() & DBG_LLVM) {
|
||||||
std::string log;
|
std::string log;
|
||||||
llvm::raw_string_ostream s_log(log);
|
llvm::raw_string_ostream s_log(log);
|
||||||
mod->print(s_log, NULL);
|
mod->print(s_log, NULL);
|
||||||
@@ -745,7 +751,8 @@ clover::compile_program_llvm(const compat::string &source,
|
|||||||
break;
|
break;
|
||||||
case PIPE_SHADER_IR_NATIVE: {
|
case PIPE_SHADER_IR_NATIVE: {
|
||||||
std::vector<char> code = compile_native(mod, triple, processor,
|
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);
|
m = build_module_native(code, mod, kernels, address_spaces, r_log);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user