[Mesa-dev] [PATCH 10/12] llvmpipe: Delete unneeded LLVM stuff earlier.
jfonseca at vmware.com
jfonseca at vmware.com
Tue May 13 05:01:16 PDT 2014
From: José Fonseca <jfonseca at vmware.com>
Same as Frank's change to draw module but for llvmpipe module.
---
src/gallium/drivers/llvmpipe/lp_state_fs.c | 13 ++-----------
src/gallium/drivers/llvmpipe/lp_state_setup.c | 13 ++-----------
src/gallium/drivers/llvmpipe/lp_test_arit.c | 4 ++--
src/gallium/drivers/llvmpipe/lp_test_blend.c | 4 ++--
src/gallium/drivers/llvmpipe/lp_test_conv.c | 4 ++--
src/gallium/drivers/llvmpipe/lp_test_format.c | 8 ++++----
src/gallium/drivers/llvmpipe/lp_test_printf.c | 4 ++--
7 files changed, 16 insertions(+), 34 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 5e28f0e..a26b981 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 1d79a4a..10ede56 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 8996411..f8998c1 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 70f71fa..ec80593 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 e2ec6e2..b7d0bfd 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 34cbdbd..d27e1b1 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 c483de9..37c1b55 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);
--
1.9.1
More information about the mesa-dev
mailing list