Get raw function pointers, inline functions (Corrado Zoccolo)
git-svn-id: http://llvm-py.googlecode.com/svn/trunk@75 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
parent
585801d769
commit
fa30225181
6 changed files with 111 additions and 0 deletions
13
llvm/ee.py
13
llvm/ee.py
|
|
@ -141,6 +141,12 @@ class GenericValue(object):
|
|||
ptr = _core.LLVMCreateGenericValueOfFloat(ty.ptr, floatval)
|
||||
return GenericValue(ptr)
|
||||
|
||||
@staticmethod
|
||||
def pointer(ty, intval):
|
||||
core.check_is_type(ty)
|
||||
ptr = _core.LLVMCreateGenericValueOfPointer(ty.ptr, intval)
|
||||
return GenericValue(ptr)
|
||||
|
||||
def __init__(self, ptr):
|
||||
self.ptr = ptr
|
||||
|
||||
|
|
@ -157,6 +163,9 @@ class GenericValue(object):
|
|||
core.check_is_type(ty) # only float or double
|
||||
return _core.LLVMGenericValueToFloat(ty.ptr, self.ptr)
|
||||
|
||||
def as_pointer(self):
|
||||
return _core.LLVMGenericValueToPointer(self.ptr)
|
||||
|
||||
|
||||
# helper functions for generic value objects
|
||||
def check_is_generic_value(obj): _util.check_gen(obj, GenericValue)
|
||||
|
|
@ -192,6 +201,10 @@ class ExecutionEngine(object):
|
|||
gvptr = _core.LLVMRunFunction2(self.ptr, fn.ptr, ptrs)
|
||||
return GenericValue(gvptr)
|
||||
|
||||
def get_pointer_to_function(self, fn):
|
||||
core.check_is_function(fn)
|
||||
return _core.LLVMGetPointerToFunction(self.ptr,fn.ptr)
|
||||
|
||||
def run_static_ctors(self):
|
||||
_core.LLVMRunStaticConstructors(self.ptr)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue