llvmpipe: Delete unneeded LLVM stuff earlier.

Same as Frank's change to draw module but for llvmpipe module.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
José Fonseca 2014-05-12 15:59:13 +01:00
parent ef14f0d59f
commit 0b239d9ed9
7 changed files with 16 additions and 34 deletions

View File

@ -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 */

View File

@ -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);
}

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -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);