summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2014-05-16 22:45:27 +0200
committerRoland Scheidegger <[email protected]>2014-05-19 17:07:41 +0200
commit1e9cbbb1c40b3df8443877410b5d34a2f12e9ab0 (patch)
treee19c49ac1397652e056a1d66dc31cdb71cdad280 /src/gallium/auxiliary
parent9e74de884a0595e577ebdfb7c7c13f4fd4d4dff5 (diff)
llvmpipe: do IR counting for shader cache management after optimization.
2ea923cf571235dfe573c35c3f0d90f632bd86d8 had the side effect of IR counting now being done after IR optimization instead of before. Some quick analysis shows that there's roughly 1.5 times more IR instructions before optimization than after, hence the effective shader cache size got quite a bit smaller. Could counter this with an increase of the instruction limit but it probably makes more sense to count them after optimizations, so move that code. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_type.c20
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_type.h2
2 files changed, 20 insertions, 2 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 */