summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/llvm_wrapper.cpp
diff options
context:
space:
mode:
authorAdam Rak <[email protected]>2011-11-30 22:20:41 +0100
committerTom Stellard <[email protected]>2012-06-01 11:28:10 -0400
commit6a829a1b724ca0d960decee217d260b4de8a5463 (patch)
tree0bc6a96e7a7151ba50aa391e94ca6f0adfc37376 /src/gallium/drivers/r600/llvm_wrapper.cpp
parent46a13b3b11d859e131399853c11ae2be0eb02f0a (diff)
r600g: compute support for evergreen
Tom Stellard: - Updated for gallium interface changes - Fixed a few bugs: + Set the loop counter + Calculate the correct number of pipes - Added hooks into the LLVM compiler
Diffstat (limited to 'src/gallium/drivers/r600/llvm_wrapper.cpp')
-rw-r--r--src/gallium/drivers/r600/llvm_wrapper.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/llvm_wrapper.cpp b/src/gallium/drivers/r600/llvm_wrapper.cpp
new file mode 100644
index 00000000000..174fb013c83
--- /dev/null
+++ b/src/gallium/drivers/r600/llvm_wrapper.cpp
@@ -0,0 +1,19 @@
+#include <llvm/ADT/OwningPtr.h>
+#include <llvm/ADT/StringRef.h>
+#include <llvm/LLVMContext.h>
+#include <llvm/Support/IRReader.h>
+#include <llvm/Support/MemoryBuffer.h>
+#include <llvm/Support/SourceMgr.h>
+
+#include "llvm_wrapper.h"
+
+
+extern "C" LLVMModuleRef llvm_parse_bitcode(const unsigned char * bitcode, unsigned bitcode_len)
+{
+ llvm::OwningPtr<llvm::Module> M;
+ llvm::StringRef str((const char*)bitcode, bitcode_len);
+ llvm::MemoryBuffer* buffer = llvm::MemoryBuffer::getMemBufferCopy(str);
+ llvm::SMDiagnostic Err;
+ M.reset(llvm::ParseIR(buffer, Err, llvm::getGlobalContext()));
+ return wrap(M.take());
+}