Rename newbinding directory to llvmpy.

This commit is contained in:
Siu Kwan Lam 2013-02-11 09:59:15 -06:00
commit 3189be4d58
77 changed files with 27 additions and 23 deletions

0
llvmpy/__init__.py Normal file
View file

View file

@ -2,8 +2,8 @@
Wrapped the extra functions in _api.so
'''
import capsule
import _api
from llvmpy import capsule
from llvmpy import _api
#
# Re-export the native API from the _api.extra and wrap the functions
#

View file

@ -135,7 +135,7 @@ class SubModule(object):
filepath = os.path.join(rootdir, '%s.py' % name)
with open(filepath, 'w') as pyfile:
println = cg.wrap_println_from_file(pyfile)
println('import _api, capsule')
println('from llvmpy import _api, capsule')
for ns in self.namespaces:
println('from . import %s' % ns.localname)
println()

View file

@ -358,6 +358,7 @@ PyObject* ExecutionEngine_RunFunction(llvm::ExecutionEngine* EE,
return NULL;
}
std::vector<GenericValue> vec_args;
Py_ssize_t nargs = PyTuple_Size(Args);
vec_args.reserve(nargs);
for (Py_ssize_t i = 0; i < nargs; ++i) {

View file

@ -227,7 +227,7 @@ class ConstantExpr:
@CustomPythonStaticMethod
def getGetElementPtr(*args):
import extra
from llvmpy import extra
args = list(args)
valuelist = args[1]
args[1] = extra.make_small_vector_from_values(*valuelist)
@ -242,7 +242,7 @@ class ConstantExpr:
@CustomPythonStaticMethod
def getExtractValue(*args):
import extra
from llvmpy import extra
args = list(args)
valuelist = args[1]
args[1] = extra.make_small_vector_from_unsigned(*valuelist)
@ -254,7 +254,7 @@ class ConstantExpr:
@CustomPythonStaticMethod
def getInsertValue(*args):
import extra
from llvmpy import extra
args = list(args)
valuelist = args[2]
args[1] = extra.make_small_vector_from_unsigned(*valuelist)

View file

@ -81,7 +81,7 @@ class DataLayout:
@CustomPythonMethod
def getIndexedOffset(self, *args):
import extra
from llvmpy import extra
args = list(args)
args[1] = extra.make_small_vector_from_values(args[1])
return self.getIndexedOffset(*args)

View file

@ -17,7 +17,7 @@ class FunctionType:
@CustomPythonStaticMethod
def get(*args):
import extra
from llvmpy import extra
if len(args) == 3:
typelist = args[1]
sv = extra.make_small_vector_from_types(*typelist)

View file

@ -88,7 +88,7 @@ class ExecutionEngine:
@CustomPythonMethod
def runFunction(self, fn, args):
import capsule
from llvmpy import capsule
unwrapped = map(capsule.unwrap, args)
return self._runFunction(fn, tuple(unwrapped))

View file

@ -68,7 +68,7 @@ class IRBuilder:
@CustomPythonMethod
def CreateInvoke(self, *args):
import extra
from llvmpy import extra
args = list(args)
valuelist = args[3]
args[3] = extra.make_small_vector_from_values(*valuelist)
@ -181,7 +181,7 @@ class IRBuilder:
@CustomPythonMethod
def CreateGEP(self, *args):
import extra
from llvmpy import extra
args = list(args)
valuelist = args[1]
args[1] = extra.make_small_vector_from_values(*valuelist)
@ -194,7 +194,7 @@ class IRBuilder:
@CustomPythonMethod
def CreateInBoundsGEP(self, *args):
import extra
from llvmpy import extra
args = list(args)
valuelist = args[1]
args[1] = extra.make_small_vector_from_values(*valuelist)
@ -241,7 +241,7 @@ class IRBuilder:
@CustomPythonMethod
def CreateCall(self, *args):
import extra
from llvmpy import extra
args = list(args)
valuelist = args[1]
args[1] = extra.make_small_vector_from_values(*valuelist)
@ -282,7 +282,7 @@ class IRBuilder:
@CustomPythonMethod
def CreateExtractValue(self, args):
import extra
from llvmpy import extra
args = list(args)
valuelist = args[1]
args[1] = extra.make_small_vector_from_unsigned(*valuelist)
@ -295,7 +295,7 @@ class IRBuilder:
@CustomPythonMethod
def CreateInsertValue(self, args):
import extra
from llvmpy import extra
args = list(args)
valuelist = args[2]
args[1] = extra.make_small_vector_from_unsigned(*valuelist)

View file

@ -46,7 +46,7 @@ class NamedMDNode:
@CustomPythonMethod
def __str__(self):
import extra
from llvmpy import extra
os = extra.make_raw_ostream_for_printing()
self.print_(os, None)
return os.str()

View file

@ -77,7 +77,7 @@ class Module:
@CustomPythonMethod
def __str__(self):
import extra
from llvmpy import extra
os = extra.make_raw_ostream_for_printing()
self.print_(os, None)
return os.str()

View file

@ -125,7 +125,7 @@ class Type:
@CustomPythonMethod
def __str__(self):
import extra
from llvmpy import extra
os = extra.make_raw_ostream_for_printing()
self.print_(os)
return os.str()

View file

@ -56,7 +56,7 @@ class Value:
@CustomPythonMethod
def __str__(self):
import extra
from llvmpy import extra
os = extra.make_raw_ostream_for_printing()
self.print_(os, None)
return os.str()

View file

@ -1,8 +1,11 @@
from api import llvm
import extra
import _capsule
from StringIO import StringIO
llvm.capsule.set_debug(True)
from llvmpy.api import llvm
from llvmpy import extra
from llvmpy import _capsule
import llvmpy.capsule
llvmpy.capsule.set_debug(True)
def test_basic_jit_use():
llvm.InitializeNativeTarget()