add method to retrieve host cpu name

add stub method to enginebuilder to setMCPU and setMAttrs -- these are not implemented in llvm3.1
This commit is contained in:
Siu Kwan Lam 2012-08-18 17:32:40 -07:00
commit 1ed2049395
5 changed files with 65 additions and 3 deletions

View file

@ -225,6 +225,14 @@ class EngineBuilder(object):
_core.LLVMEngineBuilderSetOptLevel(self.ptr, level)
return self
def mattrs(self, string):
'''set machine attributes as a comma/space separated string
e.g: +sse,-3dnow
'''
_core.LLVMEngineBuilderSetMAttrs(self.ptr, string.replace(',', ' '))
return self
def create(self):
ret = _core.LLVMEngineBuilderCreate(self.ptr)
if isinstance(ret, str):
@ -310,6 +318,11 @@ def print_registered_targets():
'''
_core.LLVMPrintRegisteredTargetsForVersion()
def get_host_cpu_name():
'''return the string name of the host CPU
'''
return _core.LLVMGetHostCPUName()
class TargetMachine(object):
@staticmethod