freedreno/ir3: fix register usage calculations
[mesa.git] / src / gallium / auxiliary / gallivm / lp_bld_type.c
index 6c3aa38bfb12be05d5d45c854de54eb7c8e67414..5a8019990808c2c89559d5250394fbf177853163 100644 (file)
@@ -311,18 +311,10 @@ lp_typekind_name(LLVMTypeKind t)
       return "LLVMArrayTypeKind";
    case LLVMPointerTypeKind:
       return "LLVMPointerTypeKind";
-#if HAVE_LLVM < 0x0300
-   case LLVMOpaqueTypeKind:
-      return "LLVMOpaqueTypeKind";
-#endif
    case LLVMVectorTypeKind:
       return "LLVMVectorTypeKind";
    case LLVMMetadataTypeKind:
       return "LLVMMetadataTypeKind";
-#if HAVE_LLVM == 0x0207
-   case LLVMUnionTypeKind:
-      return "LLVMUnionTypeKind";
-#endif
    default:
       return "unknown LLVMTypeKind";
    }
@@ -402,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;
@@ -422,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;
+}