[Mesa-dev] [PATCH v2 5/7] swr/rast: Removed superfluous JitManager argument from passes

Alok Hota alok.hota at intel.com
Fri May 25 15:19:47 UTC 2018


---
 src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp |  2 +-
 src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp |  2 +-
 .../swr/rasterizer/jitter/functionpasses/lower_x86.cpp  | 17 ++++++++---------
 .../swr/rasterizer/jitter/functionpasses/passes.h       |  2 +-
 .../drivers/swr/rasterizer/jitter/streamout_jit.cpp     |  2 +-
 src/gallium/drivers/swr/swr_shader.cpp                  |  2 +-
 6 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
index 72bf900..20f2e42 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
@@ -819,7 +819,7 @@ struct BlendJit : public Builder
         passes.add(createSCCPPass());
         passes.add(createAggressiveDCEPass());
 
-        passes.add(createLowerX86Pass(JM(), this));
+        passes.add(createLowerX86Pass(this));
 
         passes.run(*blendFunc);
 
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
index 7b0b80a..0abcd1a 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp
@@ -269,7 +269,7 @@ Function* FetchJit::Create(const FETCH_COMPILE_STATE& fetchState)
 
     optPasses.run(*fetch);
 
-    optPasses.add(createLowerX86Pass(JM(), this));
+    optPasses.add(createLowerX86Pass(this));
     optPasses.run(*fetch);
 
     JitManager::DumpToFile(fetch, "opt");
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/lower_x86.cpp b/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/lower_x86.cpp
index 5a69eae..f2bd888 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/lower_x86.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/lower_x86.cpp
@@ -136,21 +136,21 @@ namespace SwrJit
 
     struct LowerX86 : public FunctionPass
     {
-        LowerX86(JitManager* pJitMgr = nullptr, Builder* b = nullptr)
-            : FunctionPass(ID), mpJitMgr(pJitMgr), B(b)
+        LowerX86(Builder* b = nullptr)
+            : FunctionPass(ID), B(b)
         {
             initializeLowerX86Pass(*PassRegistry::getPassRegistry());
 
             // Determine target arch
-            if (mpJitMgr->mArch.AVX512F())
+            if (JM()->mArch.AVX512F())
             {
                 mTarget = AVX512;
             }
-            else if (mpJitMgr->mArch.AVX2())
+            else if (JM()->mArch.AVX2())
             {
                 mTarget = AVX2;
             }
-            else if (mpJitMgr->mArch.AVX())
+            else if (JM()->mArch.AVX())
             {
                 mTarget = AVX;
 
@@ -356,9 +356,8 @@ namespace SwrJit
         {
         }
 
-        JitManager* JM() { return mpJitMgr; }
+        JitManager* JM() { return B->JM(); }
 
-        JitManager* mpJitMgr;
         Builder* B;
 
         TargetArch mTarget;
@@ -368,9 +367,9 @@ namespace SwrJit
 
     char LowerX86::ID = 0;   // LLVM uses address of ID as the actual ID.
 
-    FunctionPass* createLowerX86Pass(JitManager* pJitMgr, Builder* b)
+    FunctionPass* createLowerX86Pass(Builder* b)
     {
-        return new LowerX86(pJitMgr, b);
+        return new LowerX86(b);
     }
 
     Instruction* NO_EMU(LowerX86* pThis, TargetArch arch, TargetWidth width, CallInst* pCallInst)
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/passes.h b/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/passes.h
index f7373f0..95ef4bc 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/passes.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/passes.h
@@ -33,5 +33,5 @@ namespace SwrJit
 {
     using namespace llvm;
 
-    FunctionPass* createLowerX86Pass(JitManager* pJitMgr, Builder* b);
+    FunctionPass* createLowerX86Pass(Builder* b);
 }
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp
index f804900..cb2e3ae 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp
@@ -307,7 +307,7 @@ struct StreamOutJit : public Builder
         passes.add(createSCCPPass());
         passes.add(createAggressiveDCEPass());
 
-        passes.add(createLowerX86Pass(JM(), this));
+        passes.add(createLowerX86Pass(this));
 
         passes.run(*soFunc);
 
diff --git a/src/gallium/drivers/swr/swr_shader.cpp b/src/gallium/drivers/swr/swr_shader.cpp
index 13d8986..afa184f 100644
--- a/src/gallium/drivers/swr/swr_shader.cpp
+++ b/src/gallium/drivers/swr/swr_shader.cpp
@@ -1402,7 +1402,7 @@ BuilderSWR::CompileFS(struct swr_context *ctx, swr_jit_fs_key &key)
 
    // after the gallivm passes, we have to lower the core's intrinsics
    llvm::legacy::FunctionPassManager lowerPass(JM()->mpCurrentModule);
-   lowerPass.add(createLowerX86Pass(mpJitMgr, this));
+   lowerPass.add(createLowerX86Pass(this));
    lowerPass.run(*pFunction);
 
    PFN_PIXEL_KERNEL kernel =
-- 
2.7.4



More information about the mesa-dev mailing list