Adding target specific passes.
This commit is contained in:
parent
bcc467b2b5
commit
3b399f9d8b
5 changed files with 149 additions and 3 deletions
13
llvm/ee.py
13
llvm/ee.py
|
|
@ -257,8 +257,21 @@ def get_host_cpu_name():
|
|||
'''
|
||||
return _core.LLVMGetHostCPUName()
|
||||
|
||||
def get_default_triple():
|
||||
'''return the target triple of the host in str-rep
|
||||
'''
|
||||
return _core.LLVMDefaultTargetTriple()
|
||||
|
||||
class TargetMachine(object):
|
||||
|
||||
@staticmethod
|
||||
def new(triple='', cpu='', features='', opt=2):
|
||||
if not triple and not cpu:
|
||||
triple = get_default_triple()
|
||||
cpu = get_host_cpu_name()
|
||||
ptr = _core.LLVMCreateTargetMachine(triple, cpu, features, opt)
|
||||
return TargetMachine(ptr)
|
||||
|
||||
@staticmethod
|
||||
def lookup(arch, cpu='', features='', opt=2):
|
||||
'''create a targetmachine given an architecture name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue