Module: Mesa
Branch: master
Commit: 2c02f34fccee563e22db70cbfb03fb2cc7da30f9
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c02f34fccee563e22db70cbfb03fb2cc7da30f9

Author: José Fonseca <[email protected]>
Date:   Wed May 14 12:20:14 2014 +0100

gallivm: Support MCJIT on Windows.

It works fine, though it requires using ELF objects.

With this change there is nothing preventing us to switch exclusively
to MCJIT, everywhere.  It's still off though.

---

 scons/llvm.py                                 |    8 +++-----
 src/gallium/auxiliary/gallivm/lp_bld_misc.cpp |    9 +++++++++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/scons/llvm.py b/scons/llvm.py
index cdfbe43..288a080 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -104,7 +104,7 @@ def generate(env):
                 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
                 'LLVMX86CodeGen', 'LLVMX86Desc', 'LLVMSelectionDAG',
                 'LLVMAsmPrinter', 'LLVMMCParser', 'LLVMX86AsmPrinter',
-                'LLVMX86Utils', 'LLVMX86Info', 'LLVMJIT',
+                'LLVMX86Utils', 'LLVMX86Info', 'LLVMMCJIT', 'LLVMJIT',
                 'LLVMExecutionEngine', 'LLVMCodeGen', 'LLVMScalarOpts',
                 'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa',
                 'LLVMAnalysis', 'LLVMTarget', 'LLVMMC', 'LLVMCore',
@@ -116,7 +116,7 @@ def generate(env):
                 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
                 'LLVMX86CodeGen', 'LLVMX86Desc', 'LLVMSelectionDAG',
                 'LLVMAsmPrinter', 'LLVMMCParser', 'LLVMX86AsmPrinter',
-                'LLVMX86Utils', 'LLVMX86Info', 'LLVMJIT',
+                'LLVMX86Utils', 'LLVMX86Info', 'LLVMMCJIT', 'LLVMJIT',
                 'LLVMExecutionEngine', 'LLVMCodeGen', 'LLVMScalarOpts',
                 'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa',
                 'LLVMAnalysis', 'LLVMTarget', 'LLVMMC', 'LLVMCore',
@@ -165,9 +165,7 @@ def generate(env):
             if '-fno-rtti' in cxxflags:
                 env.Append(CXXFLAGS = ['-fno-rtti'])
 
-            components = ['engine', 'bitwriter', 'x86asmprinter']
-
-            components.append('mcjit')
+            components = ['engine', 'mcjit', 'bitwriter', 'x86asmprinter']
 
             env.ParseConfig('llvm-config --libs ' + ' '.join(components))
             env.ParseConfig('llvm-config --ldflags')
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp 
b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index d03680f..d1cc9b6 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -57,6 +57,7 @@
 #include <llvm/ADT/Triple.h>
 #include <llvm/ExecutionEngine/JITMemoryManager.h>
 #include <llvm/Support/CommandLine.h>
+#include <llvm/Support/Host.h>
 #include <llvm/Support/PrettyStackTrace.h>
 
 #include <llvm/Support/TargetSelect.h>
@@ -452,6 +453,14 @@ 
lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
 
    if (useMCJIT) {
        builder.setUseMCJIT(true);
+#ifdef _WIN32
+       /*
+        * MCJIT works on Windows, but currently only through ELF object format.
+        */
+       std::string targetTriple = llvm::sys::getProcessTriple();
+       targetTriple.append("-elf");
+       unwrap(M)->setTargetTriple(targetTriple);
+#endif
    }
 
    llvm::SmallVector<std::string, 1> MAttrs;

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to