Fix: ExecutionEngine should own TargetData instance returned from ee.target_data
This commit is contained in:
parent
ca1a23dff5
commit
6bc5b72c71
2 changed files with 5 additions and 2 deletions
|
|
@ -366,7 +366,9 @@ class TargetMachine(llvm.Ownable):
|
|||
'''get target data of this machine
|
||||
'''
|
||||
ptr = _core.LLVMTargetMachineGetTargetData(self.ptr)
|
||||
return TargetData(ptr)
|
||||
td = TargetData(ptr)
|
||||
td._own(self)
|
||||
return td
|
||||
|
||||
@property
|
||||
def target_name(self):
|
||||
|
|
|
|||
|
|
@ -160,6 +160,7 @@ class PassManager(object):
|
|||
pass_obj --- Either a Pass instance, a string name of a pass
|
||||
'''
|
||||
if isinstance(pass_obj, Pass):
|
||||
_util.check_is_unowned(pass_obj)
|
||||
_core.LLVMAddPass(self.ptr, pass_obj.ptr)
|
||||
pass_obj._own(self) # PassManager owns the pass
|
||||
elif _util.isstring(pass_obj):
|
||||
|
|
@ -365,7 +366,7 @@ def build_pass_managers(tm, opt=2, loop_vectorize=False, vectorize=False,
|
|||
if inline_threshold:
|
||||
pmb.use_inliner_with_threshold(inline_threshold)
|
||||
if pm:
|
||||
pm.add(tm.target_data)
|
||||
pm.add(tm.target_data.clone())
|
||||
pm.add(TargetLibraryInfo.new(tm.triple))
|
||||
if llvm.version >= (3, 2):
|
||||
pm.add(TargetTransformInfo.new(tm))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue