Execution engine and passes work. Documentation and tests updated.

git-svn-id: http://llvm-py.googlecode.com/svn/trunk@4 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
mdevan.foobar 2008-06-07 13:44:25 +00:00
commit 2255a7e5dd
15 changed files with 559 additions and 396 deletions

View file

@ -13,6 +13,8 @@
/* llvm includes */
#include "llvm-c/Core.h"
#include "llvm-c/Analysis.h"
#include "llvm-c/ExecutionEngine.h"
#include "llvm-c/Target.h"
/*===----------------------------------------------------------------------===*/
@ -56,6 +58,20 @@ PyObject *ctor_LLVMPassManagerRef(LLVMPassManagerRef p);
/* standard types */
PyObject *ctor_int(int i);
#define _declare_std_ctor(typ) \
PyObject * ctor_ ## typ ( typ p);
#define _define_std_ctor(typ) \
PyObject * ctor_ ## typ ( typ p) \
{ \
if (p) \
return PyCObject_FromVoidPtr(p, NULL); \
Py_RETURN_NONE; \
}
_declare_std_ctor(LLVMExecutionEngineRef)
_declare_std_ctor(LLVMTargetDataRef)
/*===----------------------------------------------------------------------===*/
/* Helper methods */
@ -257,6 +273,22 @@ _w ## func (PyObject *self, PyObject *args) \
return ctor_ ## outtype ( func (arg1, arg2, arg3)); \
}
/**
* Wrap LLVM functions of the type
* outtype func(const char *s)
*/
#define _wrap_str2obj(func, outtype) \
static PyObject * \
_w ## func (PyObject *self, PyObject *args) \
{ \
const char *arg1; \
\
if (!PyArg_ParseTuple(args, "s", &arg1)) \
return NULL; \
\
return ctor_ ## outtype ( func (arg1)); \
}
/**
* Wrap LLVM functions of the type
* outtype func()