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";
}
/**
* Count the number of instructions in a function.
*/
-unsigned
+static unsigned
lp_build_count_instructions(LLVMValueRef function)
{
unsigned num_instrs = 0;
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;
+}