Wrap LLVMGetPointerToGlobal & add ExecutionEngine.get_pointer_to_global.

This commit is contained in:
Bradley M. Froehle 2013-01-03 19:51:53 -08:00 • committed by Siu Kwan Lam
commit dd32ce56b1
3 changed files with 23 additions and 0 deletions

View file

@ -1322,6 +1322,23 @@ _wLLVMGetPointerToFunction(PyObject *self, PyObject *args)
LLVMPY_CATCH_ALL
}
static PyObject *
_wLLVMGetPointerToGlobal(PyObject *self, PyObject *args)
{
LLVMPY_TRY
PyObject *obj_ee;
PyObject *obj_val;
if (!PyArg_ParseTuple(args, "OO", &obj_ee, &obj_val))
return NULL;
const LLVMExecutionEngineRef ee = pycap_get<LLVMExecutionEngineRef>( obj_ee ) ;
const LLVMValueRef val = pycap_get<LLVMValueRef>( obj_val ) ;
return PyLong_FromVoidPtr(LLVMGetPointerToGlobal(ee, val));
LLVMPY_CATCH_ALL
}
/* the args should have been ptr, num */
LLVMGenericValueRef LLVMRunFunction2(LLVMExecutionEngineRef EE,
LLVMValueRef F, LLVMGenericValueRef *Args, unsigned NumArgs)
@ -2067,6 +2084,7 @@ static PyMethodDef core_methods[] = {
_method( LLVMDisposeExecutionEngine )
_method( LLVMRunFunction2 )
_method( LLVMGetPointerToFunction )
_method( LLVMGetPointerToGlobal )
_method( LLVMGetExecutionEngineTargetData )
_method( LLVMRunStaticConstructors )
_method( LLVMRunStaticDestructors )