[Mesa-dev] [PATCH v3 3/3] draw/llvm: delete unneeded LLVM stuff earlier

Frank Henigman fjhenigman at google.com
Wed Nov 27 15:00:45 PST 2013


Free up unneeded LLVM stuff immediately after generating vertex shader
code.  Saves about 500K per shader.
---
 src/gallium/auxiliary/draw/draw_llvm.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 71cc45f..8808993 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -594,6 +594,14 @@ draw_llvm_create_variant(struct draw_llvm *llvm,
    variant->jit_func_elts = (draw_jit_vert_func_elts)
          gallivm_jit_function(variant->gallivm, variant->function_elts);
 
+   gallivm_free_function(variant->gallivm,
+                         variant->function, variant->jit_func);
+
+   gallivm_free_function(variant->gallivm,
+                         variant->function_elts, variant->jit_func_elts);
+
+   gallivm_teardown(variant->gallivm);
+
    variant->shader = shader;
    variant->list_item_global.base = variant;
    variant->list_item_local.base = variant;
@@ -1995,17 +2003,8 @@ draw_llvm_destroy_variant(struct draw_llvm_variant *variant)
 {
    struct draw_llvm *llvm = variant->llvm;
 
-   if (variant->function_elts) {
-      gallivm_free_function(variant->gallivm,
-                            variant->function_elts, variant->jit_func_elts);
-   }
-
-   if (variant->function) {
-      gallivm_free_function(variant->gallivm,
-                            variant->function, variant->jit_func);
-   }
-
-   gallivm_destroy(variant->gallivm);
+   gallivm_free_code(variant->gallivm);
+   FREE(variant->gallivm);
 
    remove_from_list(&variant->list_item_local);
    variant->shader->variants_cached--;
-- 
1.8.4.1



More information about the mesa-dev mailing list