aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/rasterizer/jitter/builder.cpp
diff options
context:
space:
mode:
authorGeorge Kyriazis <[email protected]>2018-04-05 15:59:54 -0500
committerGeorge Kyriazis <[email protected]>2018-04-18 10:51:38 -0500
commitaa482014e542de21785b2a4386ebbfc4a8e8df1d (patch)
tree0f332dba90f34c915ec9a702b3a20643b19f106a /src/gallium/drivers/swr/rasterizer/jitter/builder.cpp
parent81371a59093d59963a43b7f1becbed9d3c657e45 (diff)
swr/rast: Fix alloca usage in jitter
Fix issue where temporary allocas were getting hoisted to function entry unnecessarily. We now explicitly mark temporary allocas and skip hoisting during the hoist pass. Shuold reduce stack usage. Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer/jitter/builder.cpp')
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/builder.cpp17
1 files changed, 17 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);
+ }
}