[pypy-svn] r25342 - in pypy/dist/pypy/translator/llvm/pythonllvm: . test
ericvrp at codespeak.net
ericvrp at codespeak.net
Wed Apr 5 11:12:41 CEST 2006
Author: ericvrp
Date: Wed Apr 5 11:12:40 2006
New Revision: 25342
Modified:
pypy/dist/pypy/translator/llvm/pythonllvm/helper.py
pypy/dist/pypy/translator/llvm/pythonllvm/test/test_ee.py
Log:
Added (python) to_llvm_value support.
Modified: pypy/dist/pypy/translator/llvm/pythonllvm/helper.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/pythonllvm/helper.py (original)
+++ pypy/dist/pypy/translator/llvm/pythonllvm/helper.py Wed Apr 5 11:12:40 2006
@@ -26,9 +26,31 @@
def to_llvm_value(pythonvalue, type_):
value = GenericValue_()
value.LongVal = 0
-
- # XXX store in correct value.<type> here
- value.IntVal = pythonvalue
+ id_ = type_.getTypeID()
+ if id_ == PointerTyID and type_.getContainedType(0).getTypeID() == SByteTyID:
+ value.PointerVal = pointer(pythonvalue)
+ elif id_ == VoidTyID:
+ pass
+ elif id_ == BoolTyID:
+ value.BoolVal = pythonvalue
+ elif id_ == UByteTyID:
+ value.UByteVal = pythonvalue
+ elif id_ == SByteTyID:
+ value.SByteVal = pythonvalue
+ elif id_ == UShortTyID:
+ value.UShortVal = pythonvalue
+ elif id_ == ShortTyID:
+ value.ShortVal = pythonvalue
+ elif id_ == UIntTyID:
+ value.UIntVal = pythonvalue
+ elif id_ == IntTyID:
+ value.IntVal = pythonvalue
+ elif id_ == ULongTyID:
+ value.ULongVal = pythonvalue
+ elif id_ == LongTyID:
+ value.ULongVal = pythonvalue
+ else:
+ raise Exception("don't know how to convert pythontype '%s' to llvm" % type_.getDescription())
return value
Modified: pypy/dist/pypy/translator/llvm/pythonllvm/test/test_ee.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/pythonllvm/test/test_ee.py (original)
+++ pypy/dist/pypy/translator/llvm/pythonllvm/test/test_ee.py Wed Apr 5 11:12:40 2006
@@ -130,6 +130,15 @@
ee.parse(ll_snippet.add1)
assert f("calc")(100) == 101
+def TODOtest_multiple_executionengines():
+ pass
+
+def TODOtest_returntypes():
+ pass
+
+def TODOtest_paramtypes():
+ pass
+
def TODOtest_add_to_function():
pass
More information about the Pypy-commit
mailing list