From 41001ca4bdcb6effe9fd52f6d7db84084b8337a3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Tue, 9 Aug 2016 12:25:43 +0200 Subject: [PATCH] gallivm: add lp_build_alloca_undef MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Roland Scheidegger Reviewed-by: Marek Olšák --- 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 9183f457b11..c522bc4f4ab 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c @@ -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. * diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.h b/src/gallium/auxiliary/gallivm/lp_bld_flow.h index 083b0ad9fec..674fc189f1a 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_flow.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.h @@ -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, -- 2.30.2