Merge branch 'master' of github.com:llvmpy/llvmpy

This commit is contained in:
Maggie Mari 2012-08-17 16:55:43 -05:00
commit 505d280fe0
3 changed files with 35 additions and 0 deletions

View file

@ -778,6 +778,7 @@ _wrap_objstrint2obj(LLVMBuildFence, LLVMBuilderRef, LLVMValueRef)
/* Miscellaneous instructions */
_wrap_objobjintstr2obj(LLVMBuildGetResult, LLVMBuilderRef, LLVMValueRef, LLVMValueRef)
_wrap_objobjobjintstr2obj(LLVMBuildInsertValue, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objobjstr2obj(LLVMBuildPhi, LLVMBuilderRef, LLVMTypeRef, LLVMValueRef)
_wrap_objobjliststr2obj(LLVMBuildCall, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
_wrap_objobjobjobjstr2obj(LLVMBuildSelect, LLVMBuilderRef, LLVMValueRef, LLVMValueRef, LLVMValueRef, LLVMValueRef)
@ -1764,6 +1765,7 @@ static PyMethodDef core_methods[] = {
/* Miscellaneous instructions */
_method( LLVMBuildGetResult )
_method( LLVMBuildInsertValue )
_method( LLVMBuildPhi )
_method( LLVMBuildCall )
_method( LLVMBuildSelect )

View file

@ -1959,6 +1959,13 @@ class Builder(object):
# obsolete synonym for extract_value
getresult = extract_value
def insert_value(self, retval, rhs, idx, name=""):
check_is_value(retval)
check_is_value(rhs)
return _make_value(
_core.LLVMBuildInsertValue(self.ptr, retval.ptr, rhs.ptr, idx,
name))
def phi(self, ty, name=""):
check_is_type(ty)
return _make_value(_core.LLVMBuildPhi(self.ptr, ty.ptr, name))

View file

@ -659,6 +659,32 @@ _w ## func (PyObject *self, PyObject *args) \
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4)) ; \
}
/**
* Wrap LLVM functions of the type
* outtype func(intype1 arg1, intype2 arg2, intype3, int arg3, const char *arg4)
*/
#define _wrap_objobjobjintstr2obj(func, intype1, intype2, intype3, outtype) \
static PyObject * \
_w ## func (PyObject *self, PyObject *args) \
{ \
PyObject *obj1, *obj2, *obj3; \
intype1 arg1; \
intype2 arg2; \
intype3 arg3; \
int arg4; \
const char *arg5; \
\
if (!PyArg_ParseTuple(args, "OOOis", &obj1, &obj2, &obj3, &arg4, \
&arg5)) \
return NULL; \
\
arg1 = ( intype1 ) PyCapsule_GetPointer(obj1, NULL); \
arg2 = ( intype2 ) PyCapsule_GetPointer(obj2, NULL); \
arg3 = ( intype3 ) PyCapsule_GetPointer(obj3, NULL); \
\
return ctor_ ## outtype ( func (arg1, arg2, arg3, arg4, arg5)) ; \
}
/**
* Wrap LLVM functions of the type
* outtype func(intype1 arg1, intype2 arg2, intype3 arg3, const char *arg4)