llvmpipe: Delete unneeded LLVM stuff earlier.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 12 May 2014 14:59:13 +0000 (15:59 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 14 May 2014 10:05:00 +0000 (11:05 +0100)
Same as Frank's change to draw module but for llvmpipe module.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/llvmpipe/lp_state_setup.c
src/gallium/drivers/llvmpipe/lp_test_arit.c
src/gallium/drivers/llvmpipe/lp_test_blend.c
src/gallium/drivers/llvmpipe/lp_test_conv.c
src/gallium/drivers/llvmpipe/lp_test_format.c
src/gallium/drivers/llvmpipe/lp_test_printf.c

index 5e28f0ec4ea7c4e2a8272aea9a59e45158c0addf..a26b9812c9f25cca62b1e9ead3eefac559f43479 100644 (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 */
index 1d79a4ab5282d4028b757d196dd0487adfca2b51..10ede56b3433f58fb57b589f19d2359bc0d2b05b 100644 (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);
    }
index 89964114342581a902c029bf83e93ed77d2e72d2..f8998c159fbca9b30786a44cdfbc4577262ce10d 100644 (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);
index 70f71fa7844066b5b0f5a4b5a0243200d349e3d2..ec80593baf6d5b6d81c15425fa6705b4c1d525d2 100644 (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;
index e2ec6e2bb45b6e33cc5b8d4d2bf33e3cce187e97..b7d0bfda4b81c99372cdb332c9676c5258917278 100644 (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;
index 34cbdbdd6300c21af0bff466d8d14c48ce3e0514..d27e1b1c7defd245f3673eef161c7fb614a9bd19 100644 (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)
index c483de94d4064ce39be047942e81f30112db7eed..37c1b559e8b899b1597870e587155733b0ae39a9 100644 (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);