Added Module.to_native_object() and Module.to_native_assembly().
Added test for these new functions.
This commit is contained in:
parent
9ff0b4e8ab
commit
bed4f24cbd
5 changed files with 175 additions and 3 deletions
19
llvm/core.py
19
llvm/core.py
|
|
@ -516,6 +516,16 @@ class Module(llvm.Ownable, llvm.Cacheable):
|
|||
|
||||
id = property(_get_id, _set_id)
|
||||
|
||||
def to_native_object(self):
|
||||
'''returns byte string of the module as native object code
|
||||
'''
|
||||
return _core.LLVMGetNativeCodeFromModule(self.ptr, 0)
|
||||
|
||||
def to_native_assembly(self):
|
||||
'''returns byte string of the module as native assembly code
|
||||
'''
|
||||
return _core.LLVMGetNativeCodeFromModule(self.ptr, 1)
|
||||
|
||||
#===----------------------------------------------------------------------===
|
||||
# Types
|
||||
#===----------------------------------------------------------------------===
|
||||
|
|
@ -2126,3 +2136,12 @@ def inline_function(call):
|
|||
check_is_value(call)
|
||||
return _core.LLVMInlineFunction(call.ptr)
|
||||
|
||||
|
||||
|
||||
#===----------------------------------------------------------------------===
|
||||
# Initialization
|
||||
#===----------------------------------------------------------------------===
|
||||
if _core.LLVMInitializeNativeTarget():
|
||||
raise llvm.LLVMException("No native target!?")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue