From: Jan Zielinski Date: Tue, 23 Jul 2019 10:18:03 +0000 (+0200) Subject: swr/rasterizer: small formatting changes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=47cdb0ac2773c13bcd33388a8e7b351e67efaedf;p=mesa.git swr/rasterizer: small formatting changes Reviewed-by: Alok Hota --- diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp index a549721f147..fc8dc46d9de 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.cpp @@ -64,7 +64,7 @@ JitManager::JitManager(uint32_t simdWidth, const char* arch, const char* core) : mArch(arch) { mpCurrentModule = nullptr; - mpExec = nullptr; + mpExec = nullptr; InitializeNativeTarget(); InitializeNativeTargetAsmPrinter(); @@ -452,7 +452,9 @@ std::string JitManager::GetOutputDir() ////////////////////////////////////////////////////////////////////////// /// @brief Dump function to file. -void JitManager::DumpToFile(Module* M, const char* fileName, llvm::AssemblyAnnotationWriter* annotater) +void JitManager::DumpToFile(Module* M, + const char* fileName, + llvm::AssemblyAnnotationWriter* annotater) { if (KNOB_DUMP_SHADER_IR) { @@ -669,7 +671,6 @@ void JitCache::CalcModuleCacheDir() mModuleCacheDir = moduleDir; } - /// notifyObjectCompiled - Provides a pointer to compiled code for Module M. void JitCache::notifyObjectCompiled(const llvm::Module* M, llvm::MemoryBufferRef Obj) { @@ -805,25 +806,25 @@ std::unique_ptr JitCache::getObject(const llvm::Module* M) return pBuf; } -void InterleaveAssemblyAnnotater::emitInstructionAnnot(const llvm::Instruction *pInst, llvm::formatted_raw_ostream &OS) +void InterleaveAssemblyAnnotater::emitInstructionAnnot(const llvm::Instruction* pInst, + llvm::formatted_raw_ostream& OS) { auto dbgLoc = pInst->getDebugLoc(); - if(dbgLoc) + if (dbgLoc) { unsigned int line = dbgLoc.getLine(); - if(line != mCurrentLineNo) + if (line != mCurrentLineNo) { - if(line > 0 && line <= mAssembly.size()) + if (line > 0 && line <= mAssembly.size()) { // HACK: here we assume that OS is a formatted_raw_ostream(ods()) // and modify the color accordingly. We can't do the color // modification on OS because formatted_raw_ostream strips // the color information. The only way to fix this behavior // is to patch LLVM. - OS << "\n; " << line << ": " << mAssembly[line-1] << "\n"; + OS << "\n; " << line << ": " << mAssembly[line - 1] << "\n"; } mCurrentLineNo = line; } } } - diff --git a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h index bb7ca8b4a3e..d96d22e1b95 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/JitManager.h @@ -110,6 +110,8 @@ public: /// available. std::unique_ptr getObject(const llvm::Module* M) override; + const char* GetModuleCacheDir() { return mModuleCacheDir.c_str(); } + private: std::string mCpu; llvm::SmallString mCacheDir; diff --git a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp index a1bb518905f..5a096533d95 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp @@ -202,7 +202,10 @@ Function* FetchJit::Create(const FETCH_COMPILE_STATE& fetchState) break; case R32_UINT: (fetchState.bDisableIndexOOBCheck) - ? vIndices = LOAD(indices, "", PointerType::get(mSimdInt32Ty, 0), JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH) + ? vIndices = LOAD(indices, + "", + PointerType::get(mSimdInt32Ty, 0), + JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH) : vIndices = GetSimdValid32bitIndices(indices, pLastIndex); break; // incoming type is already 32bit int default: @@ -378,7 +381,8 @@ void FetchJit::CreateGatherOddFormats( Value* pGather; if (info.bpp == 32) { - pGather = GATHERDD(VIMMED1(0), xpBase, pOffsets, pMask, 1, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH); + pGather = + GATHERDD(VIMMED1(0), xpBase, pOffsets, pMask, 1, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH); } else { @@ -399,7 +403,8 @@ void FetchJit::CreateGatherOddFormats( BasicBlock* pCurrentBB = IRB()->GetInsertBlock(); BasicBlock* pMaskedLoadBlock = BasicBlock::Create(JM()->mContext, "MaskedLaneLoad", pCurrentBB->getParent()); - BasicBlock* pEndLoadBB = BasicBlock::Create(JM()->mContext, "AfterMaskedLoad", pCurrentBB->getParent()); + BasicBlock* pEndLoadBB = + BasicBlock::Create(JM()->mContext, "AfterMaskedLoad", pCurrentBB->getParent()); COND_BR(mask, pMaskedLoadBlock, pEndLoadBB); @@ -409,7 +414,7 @@ void FetchJit::CreateGatherOddFormats( { case 8: { - Value* pDst = BITCAST(GEP(pDstMem, C(lane)), PointerType::get(mInt8Ty, 0)); + Value* pDst = BITCAST(GEP(pDstMem, C(lane)), PointerType::get(mInt8Ty, 0)); Value* xpSrc = ADD(xpBase, Z_EXT(index, xpBase->getType())); STORE(LOAD(xpSrc, "", mInt8PtrTy, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH), pDst); break; @@ -417,7 +422,7 @@ void FetchJit::CreateGatherOddFormats( case 16: { - Value* pDst = BITCAST(GEP(pDstMem, C(lane)), PointerType::get(mInt16Ty, 0)); + Value* pDst = BITCAST(GEP(pDstMem, C(lane)), PointerType::get(mInt16Ty, 0)); Value* xpSrc = ADD(xpBase, Z_EXT(index, xpBase->getType())); STORE(LOAD(xpSrc, "", mInt16PtrTy, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH), pDst); break; @@ -427,12 +432,12 @@ void FetchJit::CreateGatherOddFormats( case 24: { // First 16-bits of data - Value* pDst = BITCAST(GEP(pDstMem, C(lane)), PointerType::get(mInt16Ty, 0)); + Value* pDst = BITCAST(GEP(pDstMem, C(lane)), PointerType::get(mInt16Ty, 0)); Value* xpSrc = ADD(xpBase, Z_EXT(index, xpBase->getType())); STORE(LOAD(xpSrc, "", mInt16PtrTy, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH), pDst); // Last 8-bits of data - pDst = BITCAST(GEP(pDst, C(1)), PointerType::get(mInt8Ty, 0)); + pDst = BITCAST(GEP(pDst, C(1)), PointerType::get(mInt8Ty, 0)); xpSrc = ADD(xpSrc, C(2)); STORE(LOAD(xpSrc, "", mInt8PtrTy, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH), pDst); break; @@ -947,8 +952,12 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE& fetchState, // if we have at least one component to fetch if (compMask) { - Value* vGatherResult = GATHERDD( - gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask, 1, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH); + Value* vGatherResult = GATHERDD(gatherSrc, + pStreamBaseGFX, + vOffsets, + vGatherMask, + 1, + JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH); // e.g. result of an 8x32bit integer gather for 8bit components // 256i - 0 1 2 3 4 5 6 7 // xyzw xyzw xyzw xyzw xyzw xyzw xyzw xyzw @@ -977,7 +986,12 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE& fetchState, // if we have at least one component out of x or y to fetch if (isComponentEnabled(compMask, 0) || isComponentEnabled(compMask, 1)) { - vGatherResult[0] = GATHERDD(gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask, 1, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH); + vGatherResult[0] = GATHERDD(gatherSrc, + pStreamBaseGFX, + vOffsets, + vGatherMask, + 1, + JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH); // e.g. result of first 8x32bit integer gather for 16bit components // 256i - 0 1 2 3 4 5 6 7 // xyxy xyxy xyxy xyxy xyxy xyxy xyxy xyxy @@ -990,7 +1004,12 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE& fetchState, // offset base to the next components(zw) in the vertex to gather pStreamBaseGFX = ADD(pStreamBaseGFX, C((int64_t)4)); - vGatherResult[1] = GATHERDD(gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask, 1, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH); + vGatherResult[1] = GATHERDD(gatherSrc, + pStreamBaseGFX, + vOffsets, + vGatherMask, + 1, + JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH); // e.g. result of second 8x32bit integer gather for 16bit components // 256i - 0 1 2 3 4 5 6 7 // zwzw zwzw zwzw zwzw zwzw zwzw zwzw zwzw @@ -1026,8 +1045,12 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE& fetchState, // if we need to gather the component if (compCtrl[i] == StoreSrc) { - Value* pGather = - GATHERDD(gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask, 1, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH); + Value* pGather = GATHERDD(gatherSrc, + pStreamBaseGFX, + vOffsets, + vGatherMask, + 1, + JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH); if (conversionType == CONVERT_USCALED) {