freedreno/ir3: array rework
[mesa.git] / src / gallium / auxiliary / gallivm / lp_bld_type.c
index 9b25e15efcc21209eae477efcf893afe94e119e1..5a8019990808c2c89559d5250394fbf177853163 100644 (file)
@@ -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;
+}