llvmpipe: delete function bodies after generating machine code
authorZack Rusin <zackr@vmware.com>
Tue, 27 Jul 2010 16:26:54 +0000 (12:26 -0400)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 30 Jul 2010 15:25:29 +0000 (16:25 +0100)
src/gallium/auxiliary/draw/draw_llvm.c
src/gallium/auxiliary/gallivm/lp_bld_init.h
src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
src/gallium/drivers/llvmpipe/lp_state_fs.c

index 48489e5f6f176b39714a5b237877573e370f256c..8022b720b34d7bd05aecdf9e271fb03ea408512d 100644 (file)
@@ -826,6 +826,7 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
    if (gallivm_debug & GALLIVM_DEBUG_ASM) {
       lp_disassemble(code);
    }
+   lp_func_delete_body(variant->function);
 }
 
 
@@ -1001,6 +1002,7 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
    if (gallivm_debug & GALLIVM_DEBUG_ASM) {
       lp_disassemble(code);
    }
+   lp_func_delete_body(variant->function_elts);
 }
 
 void
index a32ced9b4c3a526c73806300e8a37f65f2dda97f..f26fdac46631541a52d08300d716f6ab39850c7f 100644 (file)
@@ -44,5 +44,7 @@ extern LLVMPassManagerRef lp_build_pass;
 void
 lp_build_init(void);
 
+extern void
+lp_func_delete_body(LLVMValueRef func);
 
 #endif /* !LP_BLD_INIT_H */
index 072408b26897a04a9f82da04c0f94ff5c89c9feb..6d5410d9701e9e1911ebb49a582844c1d07aa105 100644 (file)
@@ -166,3 +166,11 @@ lp_set_target_options(void)
    }
 #endif
 }
+
+
+extern "C" void
+lp_func_delete_body(LLVMValueRef FF)
+{
+   llvm::Function *func = llvm::unwrap<llvm::Function>(FF);
+   func->deleteBody();
+}
index dbcc286417af2f915a9cccb6be3c585d6a903296..5ee5bde184dcc65e4b84062e62028474629286ac 100644 (file)
@@ -715,6 +715,7 @@ generate_fragment(struct llvmpipe_context *lp,
       if (gallivm_debug & GALLIVM_DEBUG_ASM) {
          lp_disassemble(f);
       }
+      lp_func_delete_body(function);
    }
 }