gallivm: add lp_build_alloca_undef
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 9 Aug 2016 10:25:43 +0000 (12:25 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 17 Aug 2016 10:11:24 +0000 (12:11 +0200)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/gallivm/lp_bld_flow.c
src/gallium/auxiliary/gallivm/lp_bld_flow.h

index 9183f457b1184f2701faa1f07cdf065cfcaeefa2..c522bc4f4ab30aeb6647434bb55daffda2cfc1ae 100644 (file)
@@ -507,6 +507,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.
  *
index 083b0ad9fecb4e4cc37960335938cba84d96f8d6..674fc189f1a0e564c13816ab389fbd1e7f6bcb59 100644 (file)
@@ -195,6 +195,11 @@ lp_build_alloca(struct gallivm_state *gallivm,
                 LLVMTypeRef type,
                 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,