swr/rast: Scope MEM_CLIENT enum for mem usages
authorAlok Hota <alok.hota@intel.com>
Fri, 7 Sep 2018 00:58:53 +0000 (19:58 -0500)
committerAlok Hota <alok.hota@intel.com>
Wed, 16 Jan 2019 19:53:30 +0000 (13:53 -0600)
Avoids confusion with other defaulted integer parameters

- fixed some unspecified usages
- removed unnecessary includes
- removed unecessary protected access specifier in buckets framework

src/gallium/drivers/swr/rasterizer/jitter/builder.h
src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp
src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h
src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h
src/gallium/drivers/swr/rasterizer/jitter/fetch_jit.cpp

index a047f2a065fef42ca5f6991386d8bca9d3202e18..0ce8d025b5cdec4f975e662c4d5fa43f6947e964 100644 (file)
@@ -161,7 +161,6 @@ namespace SwrJit
 #include "builder_math.h"
 #include "builder_mem.h"
 
-    protected:
         void SetPrivateContext(Value* pPrivateContext)
         {
             mpPrivateContext = pPrivateContext;
index c68f3b9a61986880c9949b6ee842f2377647d5f6..19eec7e99e04731aad4730e19604c782ac5b0519 100644 (file)
@@ -52,7 +52,7 @@ namespace SwrJit
 
     void BuilderGfxMem::AssertGFXMemoryParams(Value* ptr, Builder::JIT_MEM_CLIENT usage)
     {
-        SWR_ASSERT(!(ptr->getType() == mInt64Ty && usage == MEM_CLIENT_INTERNAL),
+        SWR_ASSERT(!(ptr->getType() == mInt64Ty && usage == JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL),
                    "Internal memory should not be gfxptr_t.");
     }
 
index aefbbef9fba29c6ea361848fa89f562380f7bda5..4cf06253695dbd223c5f2d37122c8fdaaa306556 100644 (file)
@@ -51,21 +51,21 @@ namespace SwrJit
         virtual LoadInst* LOAD(Value*         Ptr,
                                const char*    Name,
                                Type*          Ty    = nullptr,
-                               JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                               JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
         virtual LoadInst* LOAD(Value*         Ptr,
                                const Twine&   Name  = "",
                                Type*          Ty    = nullptr,
-                               JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                               JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
         virtual LoadInst* LOAD(Value*         Ptr,
                                bool           isVolatile,
                                const Twine&   Name  = "",
                                Type*          Ty    = nullptr,
-                               JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                               JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
         virtual LoadInst* LOAD(Value*                                 BasePtr,
                                const std::initializer_list<uint32_t>& offset,
                                const llvm::Twine&                     Name  = "",
                                Type*                                  Ty    = nullptr,
-                               JIT_MEM_CLIENT                         usage = MEM_CLIENT_INTERNAL);
+                               JIT_MEM_CLIENT                         usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 
 
         virtual CallInst* MASKED_LOAD(Value*         Ptr,
@@ -74,36 +74,36 @@ namespace SwrJit
                                       Value*         PassThru = nullptr,
                                       const Twine&   Name     = "",
                                       Type*          Ty       = nullptr,
-                                      JIT_MEM_CLIENT usage    = MEM_CLIENT_INTERNAL);
+                                      JIT_MEM_CLIENT usage    = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 
         virtual Value* GATHERPS(Value*         src,
                                 Value*         pBase,
                                 Value*         indices,
                                 Value*         mask,
                                 uint8_t        scale = 1,
-                                JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                                JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
         virtual Value* GATHERDD(Value*         src,
                                 Value*         pBase,
                                 Value*         indices,
                                 Value*         mask,
                                 uint8_t        scale = 1,
-                                JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                                JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 
         virtual void SCATTERPS(Value*         pDst,
                                Value*         vSrc,
                                Value*         vOffsets,
                                Value*         vMask,
-                               JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                               JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 
 
         Value* TranslateGfxAddressForRead(Value*         xpGfxAddress,
                                           Type*          PtrTy = nullptr,
                                           const Twine&   Name  = "",
-                                          JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                                          JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
         Value* TranslateGfxAddressForWrite(Value*         xpGfxAddress,
                                            Type*          PtrTy = nullptr,
                                            const Twine&   Name  = "",
-                                           JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                                           JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 
 
     protected:
index 94489f1c7fd2e98ad6e2530c4e8da7638269e4d0..a9d649092d41337bd3bcd7ac93195f7ef26a1fc2 100644 (file)
@@ -29,7 +29,6 @@
  ******************************************************************************/
 #include "jit_pch.hpp"
 #include "builder.h"
-#include "common/rdtsc_buckets.h"
 
 #include <cstdarg>
 
index 15def96cb76c9e7775cc5972406cae62b37a6eee..c533984da30cf6749e3501d22165af6610f2be2e 100644 (file)
 #pragma once
 
 public:
-typedef enum _JIT_MEM_CLIENT
+enum class JIT_MEM_CLIENT
 {
     MEM_CLIENT_INTERNAL,
     GFX_MEM_CLIENT_FETCH,
     GFX_MEM_CLIENT_SAMPLER,
     GFX_MEM_CLIENT_SHADER,
-} JIT_MEM_CLIENT;
+};
 
 protected:
 virtual Value* OFFSET_TO_NEXT_COMPONENT(Value* base, Constant* offset);
@@ -56,23 +56,23 @@ Value* IN_BOUNDS_GEP(Value* ptr, const std::initializer_list<Value*>& indexList)
 Value* IN_BOUNDS_GEP(Value* ptr, const std::initializer_list<uint32_t>& indexList);
 
 virtual LoadInst*
-                  LOAD(Value* Ptr, const char* Name, Type* Ty = nullptr, JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                  LOAD(Value* Ptr, const char* Name, Type* Ty = nullptr, JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 virtual LoadInst* LOAD(Value*         Ptr,
                        const Twine&   Name  = "",
                        Type*          Ty    = nullptr,
-                       JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                       JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 virtual LoadInst*
-                  LOAD(Type* Ty, Value* Ptr, const Twine& Name = "", JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                  LOAD(Type* Ty, Value* Ptr, const Twine& Name = "", JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 virtual LoadInst* LOAD(Value*         Ptr,
                        bool           isVolatile,
                        const Twine&   Name  = "",
                        Type*          Ty    = nullptr,
-                       JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                       JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 virtual LoadInst* LOAD(Value*                                 BasePtr,
                        const std::initializer_list<uint32_t>& offset,
                        const llvm::Twine&                     Name  = "",
                        Type*                                  Ty    = nullptr,
-                       JIT_MEM_CLIENT                         usage = MEM_CLIENT_INTERNAL);
+                       JIT_MEM_CLIENT                         usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 
 virtual CallInst* MASKED_LOAD(Value*         Ptr,
                               unsigned       Align,
@@ -80,7 +80,7 @@ virtual CallInst* MASKED_LOAD(Value*         Ptr,
                               Value*         PassThru = nullptr,
                               const Twine&   Name     = "",
                               Type*          Ty       = nullptr,
-                              JIT_MEM_CLIENT usage    = MEM_CLIENT_INTERNAL)
+                              JIT_MEM_CLIENT usage    = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL)
 {
     return IRB()->CreateMaskedLoad(Ptr, Align, Mask, PassThru, Name);
 }
@@ -101,14 +101,14 @@ void Gather4(const SWR_FORMAT format,
              Value*           mask,
              Value*           vGatherComponents[],
              bool             bPackedOutput,
-             JIT_MEM_CLIENT   usage = MEM_CLIENT_INTERNAL);
+             JIT_MEM_CLIENT   usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 
 virtual Value* GATHERPS(Value*         src,
                         Value*         pBase,
                         Value*         indices,
                         Value*         mask,
                         uint8_t        scale = 1,
-                        JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                        JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 
 void GATHER4PS(const SWR_FORMAT_INFO& info,
                Value*                 pSrcBase,
@@ -116,14 +116,14 @@ void GATHER4PS(const SWR_FORMAT_INFO& info,
                Value*                 mask,
                Value*                 vGatherComponents[],
                bool                   bPackedOutput,
-               JIT_MEM_CLIENT         usage = MEM_CLIENT_INTERNAL);
+               JIT_MEM_CLIENT         usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 
 virtual Value* GATHERDD(Value*         src,
                         Value*         pBase,
                         Value*         indices,
                         Value*         mask,
                         uint8_t        scale = 1,
-                        JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                        JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 
 void GATHER4DD(const SWR_FORMAT_INFO& info,
                Value*                 pSrcBase,
@@ -131,7 +131,7 @@ void GATHER4DD(const SWR_FORMAT_INFO& info,
                Value*                 mask,
                Value*                 vGatherComponents[],
                bool                   bPackedOutput,
-               JIT_MEM_CLIENT         usage = MEM_CLIENT_INTERNAL);
+               JIT_MEM_CLIENT         usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 
 Value* GATHERPD(Value* src, Value* pBase, Value* indices, Value* mask, uint8_t scale = 1);
 
@@ -141,7 +141,7 @@ virtual void SCATTERPS(Value*         pDst,
                        Value*         vSrc,
                        Value*         vOffsets,
                        Value*         vMask,
-                       JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
+                       JIT_MEM_CLIENT usage = JIT_MEM_CLIENT::MEM_CLIENT_INTERNAL);
 
 void Shuffle8bpcGather4(const SWR_FORMAT_INFO& info,
                         Value*                 vGatherInput,
index 6feb1a76e63fe5e2d6a6c40a8a106bfb9df0c4cf..a1bb518905fbdfe294aee01cf6b1278dd507eca1 100644 (file)
@@ -202,7 +202,7 @@ Function* FetchJit::Create(const FETCH_COMPILE_STATE& fetchState)
         break;
     case R32_UINT:
         (fetchState.bDisableIndexOOBCheck)
-            ? vIndices = LOAD(indices, "", PointerType::get(mSimdInt32Ty, 0), 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 +378,7 @@ void FetchJit::CreateGatherOddFormats(
     Value* pGather;
     if (info.bpp == 32)
     {
-        pGather = GATHERDD(VIMMED1(0), xpBase, pOffsets, pMask);
+        pGather = GATHERDD(VIMMED1(0), xpBase, pOffsets, pMask, 1, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH);
     }
     else
     {
@@ -411,7 +411,7 @@ void FetchJit::CreateGatherOddFormats(
             {
                 Value* pDst = BITCAST(GEP(pDstMem, C(lane)), PointerType::get(mInt8Ty, 0));
                 Value* xpSrc = ADD(xpBase, Z_EXT(index, xpBase->getType()));
-                STORE(LOAD(xpSrc, "", mInt8PtrTy, GFX_MEM_CLIENT_FETCH), pDst);
+                STORE(LOAD(xpSrc, "", mInt8PtrTy, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH), pDst);
                 break;
             }
 
@@ -419,7 +419,7 @@ void FetchJit::CreateGatherOddFormats(
             {
                 Value* pDst = BITCAST(GEP(pDstMem, C(lane)), PointerType::get(mInt16Ty, 0));
                 Value* xpSrc = ADD(xpBase, Z_EXT(index, xpBase->getType()));
-                STORE(LOAD(xpSrc, "", mInt16PtrTy, GFX_MEM_CLIENT_FETCH), pDst);
+                STORE(LOAD(xpSrc, "", mInt16PtrTy, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH), pDst);
                 break;
             }
             break;
@@ -429,12 +429,12 @@ void FetchJit::CreateGatherOddFormats(
                 // First 16-bits of data
                 Value* pDst = BITCAST(GEP(pDstMem, C(lane)), PointerType::get(mInt16Ty, 0));
                 Value* xpSrc = ADD(xpBase, Z_EXT(index, xpBase->getType()));
-                STORE(LOAD(xpSrc, "", mInt16PtrTy, GFX_MEM_CLIENT_FETCH), pDst);
+                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));
                 xpSrc = ADD(xpSrc, C(2));
-                STORE(LOAD(xpSrc, "", mInt8PtrTy, GFX_MEM_CLIENT_FETCH), pDst);
+                STORE(LOAD(xpSrc, "", mInt8PtrTy, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH), pDst);
                 break;
             }
 
@@ -806,7 +806,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE& fetchState,
                                          vNewOffsets,
                                          vGatherMask,
                                          1,
-                                         GFX_MEM_CLIENT_FETCH);
+                                         JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH);
                         }
                         else
                         {
@@ -948,7 +948,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE& fetchState,
                 if (compMask)
                 {
                     Value* vGatherResult = GATHERDD(
-                        gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask, 1, GFX_MEM_CLIENT_FETCH);
+                        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 +977,7 @@ 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);
+                    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 +990,7 @@ 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);
+                    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
@@ -1027,7 +1027,7 @@ void FetchJit::JitGatherVertices(const FETCH_COMPILE_STATE& fetchState,
                         if (compCtrl[i] == StoreSrc)
                         {
                             Value* pGather =
-                                GATHERDD(gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask);
+                                GATHERDD(gatherSrc, pStreamBaseGFX, vOffsets, vGatherMask, 1, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH);
 
                             if (conversionType == CONVERT_USCALED)
                             {
@@ -1124,7 +1124,7 @@ Value* FetchJit::GetSimdValidIndicesHelper(Value* pIndices, Value* pLastIndex)
 
             // if valid, load the index. if not, load 0 from the stack
             Value* pValid = SELECT(mask, pIndex, pZeroIndex);
-            Value* index  = LOAD(pValid, "valid index", Ty, GFX_MEM_CLIENT_FETCH);
+            Value* index  = LOAD(pValid, "valid index", Ty, JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH);
 
             // zero extended index to 32 bits and insert into the correct simd lane
             index    = Z_EXT(index, mInt32Ty);
@@ -1199,7 +1199,7 @@ Value* FetchJit::GetSimdValid32bitIndices(Value* pIndices, Value* pLastIndex)
                        VIMMED1(0),
                        "vIndices",
                        PointerType::get(mSimdInt32Ty, 0),
-                       GFX_MEM_CLIENT_FETCH);
+                       JIT_MEM_CLIENT::GFX_MEM_CLIENT_FETCH);
 }
 
 //////////////////////////////////////////////////////////////////////////