From b6b114c1aeaa996a4bf8c1fd409e8141d18b120c Mon Sep 17 00:00:00 2001 From: Alok Hota Date: Fri, 25 May 2018 10:19:47 -0500 Subject: [PATCH] swr/rast: Removed superfluous JitManager argument from passes Reviewed-by: Bruce Cherniak --- .../drivers/swr/rasterizer/jitter/blend_jit.cpp | 2 +- .../drivers/swr/rasterizer/jitter/fetch_jit.cpp | 2 +- .../jitter/functionpasses/lower_x86.cpp | 17 ++++++++--------- .../rasterizer/jitter/functionpasses/passes.h | 2 +- .../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 72bf900c85e..20f2e42eec9 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 7b0b80a7139..0abcd1a8d76 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 5a69eaef260..f2bd8889fc5 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 f7373f034be..95ef4bcf016 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 f804900291e..cb2e3aed61a 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 13d89863fd7..afa184fc466 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.30.2