summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/gallivm/lp_bld_logic.c
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2010-02-08 21:50:33 -0500
committerZack Rusin <zackr@vmware.com>2010-02-08 21:50:33 -0500
commit85c7ec70ad41c8ada75a4cbace83d16815d3e2c5 (patch)
tree7154254e4d6c26e27e410524f814a52329ff46d3 /src/gallium/auxiliary/gallivm/lp_bld_logic.c
parent257267ee9817d67e6963e81766a121c367478f65 (diff)
llvmpipe: switch to using dynamic stack allocation instead of registers
with mutable vars we don't need to follow the phi nodes. meaning that control flow becomes trivial as we don't have scan the rest of the tgsi to figure out the variable usage anymore. futhermore the memory2register pass promotes alloca/store/load to registers while inserting the right phi nodes. so we get simplicity and performance.
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_logic.c')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_logic.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
index d23de4f0ef..41ac81b744 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
@@ -419,3 +419,15 @@ lp_build_select_aos(struct lp_build_context *bld,
#endif
}
}
+
+LLVMValueRef
+lp_build_alloca(struct lp_build_context *bld)
+{
+ const struct lp_type type = bld->type;
+
+ if (type.length > 1) { /*vector*/
+ return LLVMBuildAlloca(bld->builder, lp_build_vec_type(type), "");
+ } else { /*scalar*/
+ return LLVMBuildAlloca(bld->builder, lp_build_elem_type(type), "");
+ }
+}