Mesa (master): gallivm: add lp_build_alloca_undef

Nicolai Hähnle nh at kemper.freedesktop.org
Wed Aug 17 10:11:31 UTC 2016


Module: Mesa
Branch: master
Commit: 41001ca4bdcb6effe9fd52f6d7db84084b8337a3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=41001ca4bdcb6effe9fd52f6d7db84084b8337a3

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Tue Aug  9 12:25:43 2016 +0200

gallivm: add lp_build_alloca_undef

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/auxiliary/gallivm/lp_bld_flow.c | 19 +++++++++++++++++++
 src/gallium/auxiliary/gallivm/lp_bld_flow.h |  5 +++++
 2 files changed, 24 insertions(+)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c
index 9183f45..c522bc4 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c
@@ -508,6 +508,25 @@ lp_build_alloca(struct gallivm_state *gallivm,
 
 
 /**
+ * Like lp_build_alloca, but do not zero-initialize the variable.
+ */
+LLVMValueRef
+lp_build_alloca_undef(struct gallivm_state *gallivm,
+                      LLVMTypeRef type,
+                      const char *name)
+{
+   LLVMBuilderRef first_builder = create_builder_at_entry(gallivm);
+   LLVMValueRef res;
+
+   res = LLVMBuildAlloca(first_builder, type, name);
+
+   LLVMDisposeBuilder(first_builder);
+
+   return res;
+}
+
+
+/**
  * Allocate an array of scalars/vectors.
  *
  * mem2reg pass is not capable of promoting structs or arrays to registers, but
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.h b/src/gallium/auxiliary/gallivm/lp_bld_flow.h
index 083b0ad..674fc18 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_flow.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.h
@@ -196,6 +196,11 @@ lp_build_alloca(struct gallivm_state *gallivm,
                 const char *name);
 
 LLVMValueRef
+lp_build_alloca_undef(struct gallivm_state *gallivm,
+                      LLVMTypeRef type,
+                      const char *name);
+
+LLVMValueRef
 lp_build_array_alloca(struct gallivm_state *gallivm,
                       LLVMTypeRef type,
                       LLVMValueRef count,




More information about the mesa-commit mailing list