summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_type.c20
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_type.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c4
3 files changed, 22 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_type.c b/src/gallium/auxiliary/gallivm/lp_bld_type.c
index 9b25e15efcc..5a801999080 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_type.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_type.c
@@ -394,7 +394,7 @@ lp_build_context_init(struct lp_build_context *bld,
/**
* Count the number of instructions in a function.
*/
-unsigned
+static unsigned
lp_build_count_instructions(LLVMValueRef function)
{
unsigned num_instrs = 0;
@@ -414,3 +414,21 @@ lp_build_count_instructions(LLVMValueRef function)
return num_instrs;
}
+
+
+/**
+ * Count the number of instructions in a module.
+ */
+unsigned
+lp_build_count_ir_module(LLVMModuleRef module)
+{
+ LLVMValueRef func;
+ unsigned num_instrs = 0;
+
+ func = LLVMGetFirstFunction(module);
+ while (func) {
+ num_instrs += lp_build_count_instructions(func);
+ func = LLVMGetNextFunction(func);
+ }
+ return num_instrs;
+}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_type.h b/src/gallium/auxiliary/gallivm/lp_bld_type.h
index d0b490b51e8..191cf92d2d1 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_type.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_type.h
@@ -447,7 +447,7 @@ lp_build_context_init(struct lp_build_context *bld,
unsigned
-lp_build_count_instructions(LLVMValueRef function);
+lp_build_count_ir_module(LLVMModuleRef module);
#endif /* !LP_BLD_TYPE_H */
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 4872e0d1a30..0b74d15cc64 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -2438,8 +2438,6 @@ generate_fragment(struct llvmpipe_context *lp,
LLVMBuildRetVoid(builder);
gallivm_verify_function(gallivm, function);
-
- variant->nr_instrs += lp_build_count_instructions(function);
}
@@ -2629,6 +2627,8 @@ generate_variant(struct llvmpipe_context *lp,
gallivm_compile_module(variant->gallivm);
+ variant->nr_instrs += lp_build_count_ir_module(variant->gallivm->module);
+
if (variant->function[RAST_EDGE_TEST]) {
variant->jit_function[RAST_EDGE_TEST] = (lp_jit_frag_func)
gallivm_jit_function(variant->gallivm,