From: José Fonseca Date: Mon, 12 May 2014 14:59:13 +0000 (+0100) Subject: llvmpipe: Delete unneeded LLVM stuff earlier. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0b239d9ed98f197176e2c9ccaaa3fb475144d23d;p=mesa.git llvmpipe: Delete unneeded LLVM stuff earlier. Same as Frank's change to draw module but for llvmpipe module. Reviewed-by: Roland Scheidegger --- diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 5e28f0ec4ea..a26b9812c9f 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -2639,6 +2639,8 @@ generate_variant(struct llvmpipe_context *lp, variant->jit_function[RAST_WHOLE] = variant->jit_function[RAST_EDGE_TEST]; } + gallivm_free_ir(variant->gallivm); + return variant; } @@ -2763,8 +2765,6 @@ void llvmpipe_remove_shader_variant(struct llvmpipe_context *lp, struct lp_fragment_shader_variant *variant) { - unsigned i; - if (gallivm_debug & GALLIVM_DEBUG_IR) { debug_printf("llvmpipe: del fs #%u var #%u v created #%u v cached" " #%u v total cached #%u\n", @@ -2775,15 +2775,6 @@ llvmpipe_remove_shader_variant(struct llvmpipe_context *lp, lp->nr_fs_variants); } - /* free all the variant's JIT'd functions */ - for (i = 0; i < Elements(variant->function); i++) { - if (variant->function[i]) { - gallivm_free_function(variant->gallivm, - variant->function[i], - variant->jit_function[i]); - } - } - gallivm_destroy(variant->gallivm); /* remove from shader's list */ diff --git a/src/gallium/drivers/llvmpipe/lp_state_setup.c b/src/gallium/drivers/llvmpipe/lp_state_setup.c index 1d79a4ab528..10ede56b343 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_state_setup.c @@ -800,6 +800,8 @@ generate_setup_variant(struct lp_setup_variant_key *key, if (!variant->jit_function) goto fail; + gallivm_free_ir(variant->gallivm); + /* * Update timing information: */ @@ -813,11 +815,6 @@ generate_setup_variant(struct lp_setup_variant_key *key, fail: if (variant) { - if (variant->function) { - gallivm_free_function(gallivm, - variant->function, - variant->jit_function); - } if (variant->gallivm) { gallivm_destroy(variant->gallivm); } @@ -893,12 +890,6 @@ remove_setup_variant(struct llvmpipe_context *lp, variant->no, lp->nr_setup_variants); } - if (variant->function) { - gallivm_free_function(variant->gallivm, - variant->function, - variant->jit_function); - } - if (variant->gallivm) { gallivm_destroy(variant->gallivm); } diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c b/src/gallium/drivers/llvmpipe/lp_test_arit.c index 89964114342..f8998c159fb 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c @@ -362,6 +362,8 @@ test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test) test_func_jit = (unary_func_t) gallivm_jit_function(gallivm, test_func); + gallivm_free_ir(gallivm); + for (j = 0; j < (test->num_values + length - 1) / length; j++) { int num_vals = ((j + 1) * length <= test->num_values) ? length : test->num_values % length; @@ -401,8 +403,6 @@ test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test) } } - gallivm_free_function(gallivm, test_func, test_func_jit); - gallivm_destroy(gallivm); align_free(in); diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c index 70f71fa7844..ec80593baf6 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_blend.c +++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c @@ -458,6 +458,8 @@ test_one(unsigned verbose, blend_test_ptr = (blend_test_ptr_t)gallivm_jit_function(gallivm, func); + gallivm_free_ir(gallivm); + success = TRUE; { @@ -576,8 +578,6 @@ test_one(unsigned verbose, if(fp) write_tsv_row(fp, blend, type, cycles_avg, success); - gallivm_free_function(gallivm, func, blend_test_ptr); - gallivm_destroy(gallivm); return success; diff --git a/src/gallium/drivers/llvmpipe/lp_test_conv.c b/src/gallium/drivers/llvmpipe/lp_test_conv.c index e2ec6e2bb45..b7d0bfda4b8 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_conv.c +++ b/src/gallium/drivers/llvmpipe/lp_test_conv.c @@ -219,6 +219,8 @@ test_one(unsigned verbose, conv_test_ptr = (conv_test_ptr_t)gallivm_jit_function(gallivm, func); + gallivm_free_ir(gallivm); + success = TRUE; for(i = 0; i < n && success; ++i) { unsigned src_stride = src_type.length*src_type.width/8; @@ -319,8 +321,6 @@ test_one(unsigned verbose, if(fp) write_tsv_row(fp, src_type, dst_type, cycles_avg, success); - gallivm_free_function(gallivm, func, conv_test_ptr); - gallivm_destroy(gallivm); return success; diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index 34cbdbdd630..d27e1b1c7de 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -146,6 +146,8 @@ test_format_float(unsigned verbose, FILE *fp, fetch_ptr = (fetch_ptr_t) gallivm_jit_function(gallivm, fetch); + gallivm_free_ir(gallivm); + for (l = 0; l < util_format_nr_test_cases; ++l) { const struct util_format_test_case *test = &util_format_test_cases[l]; @@ -199,8 +201,6 @@ test_format_float(unsigned verbose, FILE *fp, } } - gallivm_free_function(gallivm, fetch, fetch_ptr); - gallivm_destroy(gallivm); if(fp) @@ -231,6 +231,8 @@ test_format_unorm8(unsigned verbose, FILE *fp, fetch_ptr = (fetch_ptr_t) gallivm_jit_function(gallivm, fetch); + gallivm_free_ir(gallivm); + for (l = 0; l < util_format_nr_test_cases; ++l) { const struct util_format_test_case *test = &util_format_test_cases[l]; @@ -284,8 +286,6 @@ test_format_unorm8(unsigned verbose, FILE *fp, } } - gallivm_free_function(gallivm, fetch, fetch_ptr); - gallivm_destroy(gallivm); if(fp) diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c index c483de94d40..37c1b559e8b 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_printf.c +++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c @@ -102,9 +102,9 @@ test_printf(unsigned verbose, FILE *fp, test_printf_func = (test_printf_t) gallivm_jit_function(gallivm, test); - test_printf_func(0); + gallivm_free_ir(gallivm); - gallivm_free_function(gallivm, test, test_printf_func); + test_printf_func(0); gallivm_destroy(gallivm);