summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2013-03-07 16:51:13 -0500
committerTom Stellard <thomas.stellard@amd.com>2013-03-13 16:01:31 +0000
commit1c4f283151b191c51cbd76d7f304cc1fe7be3019 (patch)
treef4999004dba953df04f802da9ce124d8bf8203d5
parent3958c104c63d6675fd3e938ddff6efcfb1d67cde (diff)
radeon/llvm: Make radeon_llvm_util.cpp a C file
All the functions in this file are now implemented in C.
-rw-r--r--src/gallium/drivers/radeon/Makefile.sources6
-rw-r--r--src/gallium/drivers/radeon/radeon_llvm_util.c (renamed from src/gallium/drivers/radeon/radeon_llvm_util.cpp)23
-rw-r--r--src/gallium/drivers/radeon/radeon_llvm_util.h8
3 files changed, 8 insertions, 29 deletions
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
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 <llvm/ADT/OwningPtr.h>
-#include <llvm/ADT/StringRef.h>
-#if HAVE_LLVM < 0x0303
-#include <llvm/LLVMContext.h>
-#else
-#include <llvm/IR/LLVMContext.h>
-#endif
-#include <llvm/PassManager.h>
-#include <llvm/Support/IRReader.h>
-#include <llvm/Support/MemoryBuffer.h>
-#include <llvm/Support/SourceMgr.h>
-#include <llvm/Transforms/IPO.h>
-#include <llvm-c/BitReader.h>
-#include <llvm-c/Core.h>
-
#include "radeon_llvm_util.h"
#include "util/u_memory.h"
+#include <llvm-c/BitReader.h>
+#include <llvm-c/Core.h>
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 <llvm-c/Core.h>
-#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