diff options
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/jitter/builder.cpp | 17 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/jitter/builder.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp | 1 |
3 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp index 53947c317e2..bd815606fba 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp @@ -111,4 +111,21 @@ namespace SwrJit mSimdVectorIntTy = ArrayType::get(mSimdInt32Ty, 4); mSimdVectorTRTy = ArrayType::get(mSimdFP32Ty, 5); } + + /// @brief Mark this alloca as temporary to avoid hoisting later on + void Builder::SetTempAlloca(Value* inst) + { + AllocaInst* pAlloca = dyn_cast<AllocaInst>(inst); + SWR_ASSERT(pAlloca, "Unexpected non-alloca instruction"); + MDNode* N = MDNode::get(JM()->mContext, MDString::get(JM()->mContext, "is_temp_alloca")); + pAlloca->setMetadata("is_temp_alloca", N); + } + + bool Builder::IsTempAlloca(Value* inst) + { + AllocaInst* pAlloca = dyn_cast<AllocaInst>(inst); + SWR_ASSERT(pAlloca, "Unexpected non-alloca instruction"); + + return (pAlloca->getMetadata("is_temp_alloca") != nullptr); + } } diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder.h b/src/gallium/drivers/swr/rasterizer/jitter/builder.h index 4c79bab964b..27a32bc3e39 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder.h @@ -96,6 +96,8 @@ namespace SwrJit Type* mSimd32Int8Ty; void SetTargetWidth(uint32_t width); + void SetTempAlloca(Value* inst); + bool IsTempAlloca(Value* inst); #include "gen_builder.hpp" #include "gen_builder_meta.hpp" diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp index c5f0b2b9fe0..eccf0ad0d6d 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp @@ -229,6 +229,7 @@ namespace SwrJit // store vSrc on the stack. this way we can select between a valid load address and the vSrc address Value* vSrcPtr = ALLOCA(vSrc->getType()); + SetTempAlloca(vSrcPtr); STORE(vSrc, vSrcPtr); vGather = UndefValue::get(VectorType::get(mDoubleTy, 4)); |