Rename newbinding directory to llvmpy.
This commit is contained in:
parent
0681d2f37e
commit
3189be4d58
77 changed files with 27 additions and 23 deletions
0
llvmpy/__init__.py
Normal file
0
llvmpy/__init__.py
Normal file
|
|
@ -2,8 +2,8 @@
|
||||||
Wrapped the extra functions in _api.so
|
Wrapped the extra functions in _api.so
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import capsule
|
from llvmpy import capsule
|
||||||
import _api
|
from llvmpy import _api
|
||||||
#
|
#
|
||||||
# Re-export the native API from the _api.extra and wrap the functions
|
# Re-export the native API from the _api.extra and wrap the functions
|
||||||
#
|
#
|
||||||
|
|
@ -135,7 +135,7 @@ class SubModule(object):
|
||||||
filepath = os.path.join(rootdir, '%s.py' % name)
|
filepath = os.path.join(rootdir, '%s.py' % name)
|
||||||
with open(filepath, 'w') as pyfile:
|
with open(filepath, 'w') as pyfile:
|
||||||
println = cg.wrap_println_from_file(pyfile)
|
println = cg.wrap_println_from_file(pyfile)
|
||||||
println('import _api, capsule')
|
println('from llvmpy import _api, capsule')
|
||||||
for ns in self.namespaces:
|
for ns in self.namespaces:
|
||||||
println('from . import %s' % ns.localname)
|
println('from . import %s' % ns.localname)
|
||||||
println()
|
println()
|
||||||
|
|
@ -358,6 +358,7 @@ PyObject* ExecutionEngine_RunFunction(llvm::ExecutionEngine* EE,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
std::vector<GenericValue> vec_args;
|
std::vector<GenericValue> vec_args;
|
||||||
|
|
||||||
Py_ssize_t nargs = PyTuple_Size(Args);
|
Py_ssize_t nargs = PyTuple_Size(Args);
|
||||||
vec_args.reserve(nargs);
|
vec_args.reserve(nargs);
|
||||||
for (Py_ssize_t i = 0; i < nargs; ++i) {
|
for (Py_ssize_t i = 0; i < nargs; ++i) {
|
||||||
|
|
@ -227,7 +227,7 @@ class ConstantExpr:
|
||||||
|
|
||||||
@CustomPythonStaticMethod
|
@CustomPythonStaticMethod
|
||||||
def getGetElementPtr(*args):
|
def getGetElementPtr(*args):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
args = list(args)
|
args = list(args)
|
||||||
valuelist = args[1]
|
valuelist = args[1]
|
||||||
args[1] = extra.make_small_vector_from_values(*valuelist)
|
args[1] = extra.make_small_vector_from_values(*valuelist)
|
||||||
|
|
@ -242,7 +242,7 @@ class ConstantExpr:
|
||||||
|
|
||||||
@CustomPythonStaticMethod
|
@CustomPythonStaticMethod
|
||||||
def getExtractValue(*args):
|
def getExtractValue(*args):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
args = list(args)
|
args = list(args)
|
||||||
valuelist = args[1]
|
valuelist = args[1]
|
||||||
args[1] = extra.make_small_vector_from_unsigned(*valuelist)
|
args[1] = extra.make_small_vector_from_unsigned(*valuelist)
|
||||||
|
|
@ -254,7 +254,7 @@ class ConstantExpr:
|
||||||
|
|
||||||
@CustomPythonStaticMethod
|
@CustomPythonStaticMethod
|
||||||
def getInsertValue(*args):
|
def getInsertValue(*args):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
args = list(args)
|
args = list(args)
|
||||||
valuelist = args[2]
|
valuelist = args[2]
|
||||||
args[1] = extra.make_small_vector_from_unsigned(*valuelist)
|
args[1] = extra.make_small_vector_from_unsigned(*valuelist)
|
||||||
|
|
@ -81,7 +81,7 @@ class DataLayout:
|
||||||
|
|
||||||
@CustomPythonMethod
|
@CustomPythonMethod
|
||||||
def getIndexedOffset(self, *args):
|
def getIndexedOffset(self, *args):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
args = list(args)
|
args = list(args)
|
||||||
args[1] = extra.make_small_vector_from_values(args[1])
|
args[1] = extra.make_small_vector_from_values(args[1])
|
||||||
return self.getIndexedOffset(*args)
|
return self.getIndexedOffset(*args)
|
||||||
|
|
@ -17,7 +17,7 @@ class FunctionType:
|
||||||
|
|
||||||
@CustomPythonStaticMethod
|
@CustomPythonStaticMethod
|
||||||
def get(*args):
|
def get(*args):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
if len(args) == 3:
|
if len(args) == 3:
|
||||||
typelist = args[1]
|
typelist = args[1]
|
||||||
sv = extra.make_small_vector_from_types(*typelist)
|
sv = extra.make_small_vector_from_types(*typelist)
|
||||||
|
|
@ -88,7 +88,7 @@ class ExecutionEngine:
|
||||||
|
|
||||||
@CustomPythonMethod
|
@CustomPythonMethod
|
||||||
def runFunction(self, fn, args):
|
def runFunction(self, fn, args):
|
||||||
import capsule
|
from llvmpy import capsule
|
||||||
unwrapped = map(capsule.unwrap, args)
|
unwrapped = map(capsule.unwrap, args)
|
||||||
return self._runFunction(fn, tuple(unwrapped))
|
return self._runFunction(fn, tuple(unwrapped))
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@ class IRBuilder:
|
||||||
|
|
||||||
@CustomPythonMethod
|
@CustomPythonMethod
|
||||||
def CreateInvoke(self, *args):
|
def CreateInvoke(self, *args):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
args = list(args)
|
args = list(args)
|
||||||
valuelist = args[3]
|
valuelist = args[3]
|
||||||
args[3] = extra.make_small_vector_from_values(*valuelist)
|
args[3] = extra.make_small_vector_from_values(*valuelist)
|
||||||
|
|
@ -181,7 +181,7 @@ class IRBuilder:
|
||||||
|
|
||||||
@CustomPythonMethod
|
@CustomPythonMethod
|
||||||
def CreateGEP(self, *args):
|
def CreateGEP(self, *args):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
args = list(args)
|
args = list(args)
|
||||||
valuelist = args[1]
|
valuelist = args[1]
|
||||||
args[1] = extra.make_small_vector_from_values(*valuelist)
|
args[1] = extra.make_small_vector_from_values(*valuelist)
|
||||||
|
|
@ -194,7 +194,7 @@ class IRBuilder:
|
||||||
|
|
||||||
@CustomPythonMethod
|
@CustomPythonMethod
|
||||||
def CreateInBoundsGEP(self, *args):
|
def CreateInBoundsGEP(self, *args):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
args = list(args)
|
args = list(args)
|
||||||
valuelist = args[1]
|
valuelist = args[1]
|
||||||
args[1] = extra.make_small_vector_from_values(*valuelist)
|
args[1] = extra.make_small_vector_from_values(*valuelist)
|
||||||
|
|
@ -241,7 +241,7 @@ class IRBuilder:
|
||||||
|
|
||||||
@CustomPythonMethod
|
@CustomPythonMethod
|
||||||
def CreateCall(self, *args):
|
def CreateCall(self, *args):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
args = list(args)
|
args = list(args)
|
||||||
valuelist = args[1]
|
valuelist = args[1]
|
||||||
args[1] = extra.make_small_vector_from_values(*valuelist)
|
args[1] = extra.make_small_vector_from_values(*valuelist)
|
||||||
|
|
@ -282,7 +282,7 @@ class IRBuilder:
|
||||||
|
|
||||||
@CustomPythonMethod
|
@CustomPythonMethod
|
||||||
def CreateExtractValue(self, args):
|
def CreateExtractValue(self, args):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
args = list(args)
|
args = list(args)
|
||||||
valuelist = args[1]
|
valuelist = args[1]
|
||||||
args[1] = extra.make_small_vector_from_unsigned(*valuelist)
|
args[1] = extra.make_small_vector_from_unsigned(*valuelist)
|
||||||
|
|
@ -295,7 +295,7 @@ class IRBuilder:
|
||||||
|
|
||||||
@CustomPythonMethod
|
@CustomPythonMethod
|
||||||
def CreateInsertValue(self, args):
|
def CreateInsertValue(self, args):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
args = list(args)
|
args = list(args)
|
||||||
valuelist = args[2]
|
valuelist = args[2]
|
||||||
args[1] = extra.make_small_vector_from_unsigned(*valuelist)
|
args[1] = extra.make_small_vector_from_unsigned(*valuelist)
|
||||||
|
|
@ -46,7 +46,7 @@ class NamedMDNode:
|
||||||
|
|
||||||
@CustomPythonMethod
|
@CustomPythonMethod
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
os = extra.make_raw_ostream_for_printing()
|
os = extra.make_raw_ostream_for_printing()
|
||||||
self.print_(os, None)
|
self.print_(os, None)
|
||||||
return os.str()
|
return os.str()
|
||||||
|
|
@ -77,7 +77,7 @@ class Module:
|
||||||
|
|
||||||
@CustomPythonMethod
|
@CustomPythonMethod
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
os = extra.make_raw_ostream_for_printing()
|
os = extra.make_raw_ostream_for_printing()
|
||||||
self.print_(os, None)
|
self.print_(os, None)
|
||||||
return os.str()
|
return os.str()
|
||||||
|
|
@ -125,7 +125,7 @@ class Type:
|
||||||
|
|
||||||
@CustomPythonMethod
|
@CustomPythonMethod
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
os = extra.make_raw_ostream_for_printing()
|
os = extra.make_raw_ostream_for_printing()
|
||||||
self.print_(os)
|
self.print_(os)
|
||||||
return os.str()
|
return os.str()
|
||||||
|
|
@ -56,7 +56,7 @@ class Value:
|
||||||
|
|
||||||
@CustomPythonMethod
|
@CustomPythonMethod
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
import extra
|
from llvmpy import extra
|
||||||
os = extra.make_raw_ostream_for_printing()
|
os = extra.make_raw_ostream_for_printing()
|
||||||
self.print_(os, None)
|
self.print_(os, None)
|
||||||
return os.str()
|
return os.str()
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
from api import llvm
|
|
||||||
import extra
|
|
||||||
import _capsule
|
|
||||||
from StringIO import StringIO
|
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():
|
def test_basic_jit_use():
|
||||||
llvm.InitializeNativeTarget()
|
llvm.InitializeNativeTarget()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue