radeon/llvm: Implement radeon_llvm_get_num_kernels() using the C API
authorTom Stellard <thomas.stellard@amd.com>
Thu, 7 Mar 2013 21:51:10 +0000 (16:51 -0500)
committerTom Stellard <thomas.stellard@amd.com>
Wed, 13 Mar 2013 16:01:31 +0000 (16:01 +0000)
src/gallium/drivers/radeon/radeon_llvm_util.cpp

index 5f63ed7a9c62f6363774d92bab3d2373af812f7d..fcfb6d8966d8a14c7494dcad0f2da303556d0b6e 100644 (file)
@@ -43,12 +43,7 @@ extern "C" unsigned radeon_llvm_get_num_kernels(const unsigned char *bitcode,
                                unsigned bitcode_len)
 {
        LLVMModuleRef mod = radeon_llvm_parse_bitcode(bitcode, bitcode_len);
-       llvm::Module *M = llvm::unwrap(mod);
-       const llvm::NamedMDNode *kernel_node
-                               = M->getNamedMetadata("opencl.kernels");
-       unsigned kernel_count = kernel_node->getNumOperands();
-       delete M;
-       return kernel_count;
+       return LLVMGetNamedMetadataNumOperands(mod, "opencl.kernels");
 }
 
 extern "C" LLVMModuleRef radeon_llvm_get_kernel_module(unsigned index,