From 1c4f283151b191c51cbd76d7f304cc1fe7be3019 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 7 Mar 2013 16:51:13 -0500 Subject: [PATCH] radeon/llvm: Make radeon_llvm_util.cpp a C file All the functions in this file are now implemented in C. --- src/gallium/drivers/radeon/Makefile.sources | 6 ++--- ...adeon_llvm_util.cpp => radeon_llvm_util.c} | 23 ++++--------------- src/gallium/drivers/radeon/radeon_llvm_util.h | 8 ------- 3 files changed, 8 insertions(+), 29 deletions(-) rename src/gallium/drivers/radeon/{radeon_llvm_util.cpp => radeon_llvm_util.c} (69%) diff --git a/src/gallium/drivers/radeon/Makefile.sources b/src/gallium/drivers/radeon/Makefile.sources index aa327490f44..efe0e6bb4da 100644 --- a/src/gallium/drivers/radeon/Makefile.sources +++ b/src/gallium/drivers/radeon/Makefile.sources @@ -1,6 +1,6 @@ CPP_FILES := \ - radeon_llvm_emit.cpp \ - radeon_llvm_util.cpp + radeon_llvm_emit.cpp C_FILES := \ - radeon_setup_tgsi_llvm.c + radeon_setup_tgsi_llvm.c \ + radeon_llvm_util.c diff --git a/src/gallium/drivers/radeon/radeon_llvm_util.cpp b/src/gallium/drivers/radeon/radeon_llvm_util.c similarity index 69% rename from src/gallium/drivers/radeon/radeon_llvm_util.cpp rename to src/gallium/drivers/radeon/radeon_llvm_util.c index aa9f3b3c74c..3d30612ffd9 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_util.cpp +++ b/src/gallium/drivers/radeon/radeon_llvm_util.c @@ -1,21 +1,8 @@ -#include -#include -#if HAVE_LLVM < 0x0303 -#include -#else -#include -#endif -#include -#include -#include -#include -#include -#include -#include - #include "radeon_llvm_util.h" #include "util/u_memory.h" +#include +#include static LLVMModuleRef radeon_llvm_parse_bitcode(const unsigned char * bitcode, unsigned bitcode_len) @@ -29,14 +16,14 @@ static LLVMModuleRef radeon_llvm_parse_bitcode(const unsigned char * bitcode, return module; } -extern "C" unsigned radeon_llvm_get_num_kernels(const unsigned char *bitcode, +unsigned radeon_llvm_get_num_kernels(const unsigned char *bitcode, unsigned bitcode_len) { LLVMModuleRef mod = radeon_llvm_parse_bitcode(bitcode, bitcode_len); return LLVMGetNamedMetadataNumOperands(mod, "opencl.kernels"); } -extern "C" LLVMModuleRef radeon_llvm_get_kernel_module(unsigned index, +LLVMModuleRef radeon_llvm_get_kernel_module(unsigned index, const unsigned char *bitcode, unsigned bitcode_len) { LLVMModuleRef mod; @@ -46,7 +33,7 @@ extern "C" LLVMModuleRef radeon_llvm_get_kernel_module(unsigned index, mod = radeon_llvm_parse_bitcode(bitcode, bitcode_len); num_kernels = LLVMGetNamedMetadataNumOperands(mod, "opencl.kernels"); - kernel_metadata = (LLVMValueRef*)MALLOC(num_kernels * sizeof(LLVMValueRef)); + kernel_metadata = MALLOC(num_kernels * sizeof(LLVMValueRef)); LLVMGetNamedMetadataOperands(mod, "opencl.kernels", kernel_metadata); for (i = 0; i < num_kernels; i++) { LLVMValueRef kernel_signature, kernel_function; diff --git a/src/gallium/drivers/radeon/radeon_llvm_util.h b/src/gallium/drivers/radeon/radeon_llvm_util.h index 1e827ba0d7c..a5870306195 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_util.h +++ b/src/gallium/drivers/radeon/radeon_llvm_util.h @@ -3,16 +3,8 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - unsigned radeon_llvm_get_num_kernels(const unsigned char *bitcode, unsigned bitcode_len); LLVMModuleRef radeon_llvm_get_kernel_module(unsigned index, const unsigned char *bitcode, unsigned bitcode_len); -#ifdef __cplusplus -} -#endif - #endif -- 2.30.2