add autoselect ELF generation for MCJIT
This commit is contained in:
parent
c20c4d776f
commit
b4d943a671
1 changed files with 8 additions and 0 deletions
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
"Execution Engine and related classes."
|
"Execution Engine and related classes."
|
||||||
|
|
||||||
|
import sys
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
|
|
@ -150,6 +151,12 @@ class EngineBuilder(llvm.Wrapper):
|
||||||
'''
|
'''
|
||||||
if tm is not None:
|
if tm is not None:
|
||||||
engine = self._ptr.create(tm._ptr)
|
engine = self._ptr.create(tm._ptr)
|
||||||
|
elif (sys.prefix.startswith('win32') and
|
||||||
|
getattr(self, '_use_mcjit', False)):
|
||||||
|
# force ELF generation on MCJIT on win32
|
||||||
|
triple = get_default_triple()
|
||||||
|
tm = TargetMachine.new('%s-elf' % triple)
|
||||||
|
engine = self._ptr.create(tm)
|
||||||
else:
|
else:
|
||||||
engine = self._ptr.create()
|
engine = self._ptr.create()
|
||||||
ee = ExecutionEngine(engine)
|
ee = ExecutionEngine(engine)
|
||||||
|
|
@ -173,6 +180,7 @@ class EngineBuilder(llvm.Wrapper):
|
||||||
'''Enable/disable MCJIT
|
'''Enable/disable MCJIT
|
||||||
'''
|
'''
|
||||||
self._ptr.setUseMCJIT(enable)
|
self._ptr.setUseMCJIT(enable)
|
||||||
|
self._use_mcjit = True
|
||||||
return self
|
return self
|
||||||
|
|
||||||
#===----------------------------------------------------------------------===
|
#===----------------------------------------------------------------------===
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue