[Mesa-dev] [PATCH 1/7] clover: move CLOVER_DEBUG stuff into anonymous ns

EdB edb+mesa at sigluy.net
Sun Dec 14 02:31:21 PST 2014


---
 .../state_trackers/clover/llvm/invocation.cpp      | 26 +++++++++++++---------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index 5265d10..10dbe08 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
@@ -664,19 +664,26 @@ 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
-};
+   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 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,
@@ -687,8 +694,7 @@ 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);
+   unsigned debug_flags = get_debug_flags();
 
    std::vector<llvm::Function *> kernels;
    size_t processor_str_len = std::string(target.begin()).find_first_of("-");
-- 
2.2.0



More information about the mesa-dev mailing list