[Mesa-dev] [PATCH] gallium/swr: explicity use llvm legacy FunctionPassManager

Tim Rowley timothy.o.rowley at intel.com
Thu Mar 3 17:20:38 UTC 2016


swr uses the legacy FunctionPassManager for llvm-3.6 compatibility,
but a change to llvm headers in 3.9 includes the new version as well.
Explicity use the legacy version to prevent ambiguity.
---
 src/gallium/drivers/swr/rasterizer/jitter/JitManager.h     |  1 -
 src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp    |  8 +++++++-
 src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp    | 14 ++++++++++++--
 .../drivers/swr/rasterizer/jitter/streamout_jit.cpp        |  8 +++++++-
 4 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
index c974a61..0f484b7 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h
@@ -64,7 +64,6 @@
 #include "llvm/PassManager.h"
 #else
 #include "llvm/IR/LegacyPassManager.h"
-using namespace llvm::legacy;
 #endif
 
 #include "llvm/CodeGen/Passes.h"
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
index 954524a..16ccabf 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
@@ -717,7 +717,13 @@ struct BlendJit : public Builder
 
         JitManager::DumpToFile(blendFunc, "");
 
-        FunctionPassManager passes(JM()->mpCurrentModule);
+#if LLVM_VERISON_MAJOR == 3 && LLVM_VERSION_MINOR == 6
+        FunctionPassManager
+#else
+        llvm::legacy::FunctionPassManager
+#endif
+           passes(JM()->mpCurrentModule);
+
         passes.add(createBreakCriticalEdgesPass());
         passes.add(createCFGSimplificationPass());
         passes.add(createEarlyCSEPass());
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
index c5a180e..4965f55 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
@@ -174,7 +174,12 @@ Function* FetchJit::Create(const FETCH_COMPILE_STATE& fetchState)
 
     verifyFunction(*fetch);
 
-    FunctionPassManager setupPasses(JM()->mpCurrentModule);
+#if LLVM_VERISON_MAJOR == 3 && LLVM_VERSION_MINOR == 6
+        FunctionPassManager
+#else
+        llvm::legacy::FunctionPassManager
+#endif
+           setupPasses(JM()->mpCurrentModule);
 
     ///@todo We don't need the CFG passes for fetch. (e.g. BreakCriticalEdges and CFGSimplification)
     setupPasses.add(createBreakCriticalEdgesPass());
@@ -186,7 +191,12 @@ Function* FetchJit::Create(const FETCH_COMPILE_STATE& fetchState)
 
     JitManager::DumpToFile(fetch, "se");
 
-    FunctionPassManager optPasses(JM()->mpCurrentModule);
+#if LLVM_VERISON_MAJOR == 3 && LLVM_VERSION_MINOR == 6
+        FunctionPassManager
+#else
+        llvm::legacy::FunctionPassManager
+#endif
+           optPasses(JM()->mpCurrentModule);
 
     ///@todo Haven't touched these either. Need to remove some of these and add others.
     optPasses.add(createCFGSimplificationPass());
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp
index 6c5f22b..852d96d 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp
@@ -293,7 +293,13 @@ struct StreamOutJit : public Builder
 
         JitManager::DumpToFile(soFunc, "SoFunc");
 
-        FunctionPassManager passes(JM()->mpCurrentModule);
+#if LLVM_VERISON_MAJOR == 3 && LLVM_VERSION_MINOR == 6
+        FunctionPassManager
+#else
+        llvm::legacy::FunctionPassManager
+#endif
+           passes(JM()->mpCurrentModule);
+
         passes.add(createBreakCriticalEdgesPass());
         passes.add(createCFGSimplificationPass());
         passes.add(createEarlyCSEPass());
-- 
1.9.1



More information about the mesa-dev mailing list