[pypy-svn] r34000 - in pypy/dist/pypy/jit/codegen/llvm: . lib test

ericvrp at codespeak.net ericvrp at codespeak.net
Wed Nov 1 12:33:13 CET 2006


Author: ericvrp
Date: Wed Nov  1 12:33:10 2006
New Revision: 34000

Added:
   pypy/dist/pypy/jit/codegen/llvm/README.txt   (contents, props changed)
   pypy/dist/pypy/jit/codegen/llvm/lib/
   pypy/dist/pypy/jit/codegen/llvm/lib/llvmjit.cpp
   pypy/dist/pypy/jit/codegen/llvm/lib/llvmjit.h
   pypy/dist/pypy/jit/codegen/llvm/llvmjit.py   (contents, props changed)
   pypy/dist/pypy/jit/codegen/llvm/setup.py   (contents, props changed)
   pypy/dist/pypy/jit/codegen/llvm/test/test_llvmjit.py   (contents, props changed)
Modified:
   pypy/dist/pypy/jit/codegen/llvm/jitcode.py
Log:
(mwh, ericvrp) starting minimal llvm c-api library and ctypes wrapper


Added: pypy/dist/pypy/jit/codegen/llvm/README.txt
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/jit/codegen/llvm/README.txt	Wed Nov  1 12:33:10 2006
@@ -0,0 +1,4 @@
+Create llvm c api library by running "python setup.py build_ext -i" here
+
+note: This library building should maybe not be done with distutils at all!
+      It should probably be done with the regular: ./configure;make;make install

Modified: pypy/dist/pypy/jit/codegen/llvm/jitcode.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/llvm/jitcode.py	(original)
+++ pypy/dist/pypy/jit/codegen/llvm/jitcode.py	Wed Nov  1 12:33:10 2006
@@ -1,4 +1,7 @@
 """
+This code is not used anymore and it's tests are skipped.
+Keeping it around for a while...
+
 All code for using LLVM's JIT in one place
 """
 

Added: pypy/dist/pypy/jit/codegen/llvm/lib/llvmjit.cpp
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/jit/codegen/llvm/lib/llvmjit.cpp	Wed Nov  1 12:33:10 2006
@@ -0,0 +1,5 @@
+//implementation for using the LLVM JIT
+
+int testme(int n) {
+    return n * 2;
+}

Added: pypy/dist/pypy/jit/codegen/llvm/lib/llvmjit.h
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/jit/codegen/llvm/lib/llvmjit.h	Wed Nov  1 12:33:10 2006
@@ -0,0 +1,11 @@
+//for using the LLVM C++ API
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+int testme(int n);
+
+#ifdef  __cplusplus    
+}
+#endif

Added: pypy/dist/pypy/jit/codegen/llvm/llvmjit.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/jit/codegen/llvm/llvmjit.py	Wed Nov  1 12:33:10 2006
@@ -0,0 +1,9 @@
+'''
+    Another go at using the LLVM JIT as a codegenerator for PyPy.
+    
+    For now we use the LLVM C++ API as little as possible!
+    In future we might talk directly to the LLVM C++ API.
+
+    This file contains the ctypes specification to use the llvmjit library!
+'''
+

Added: pypy/dist/pypy/jit/codegen/llvm/setup.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/jit/codegen/llvm/setup.py	Wed Nov  1 12:33:10 2006
@@ -0,0 +1,19 @@
+from distutils.core import setup
+from distutils.extension import Extension
+from os import popen
+
+cxxflags = popen('llvm-config --cxxflags').readline().split()
+ldflags  = popen('llvm-config --ldflags').readline().split()
+libs     = popen('llvm-config --libs all').readline().split()
+
+opts = dict(name='llvmjit',
+            sources=['lib/llvmjit.cpp'],
+            libraries=[],
+            include_dirs =["include"] + [f[2:] for f in cxxflags if f.startswith('-I')],
+            library_dirs =[f[2:] for f in ldflags  if f.startswith('-L')],
+            define_macros=[(f[2:], None) for f in cxxflags if f.startswith('-D')],
+            extra_objects=libs)
+
+ext_modules = Extension(**opts)
+
+setup(name=opts['name'], ext_modules=[ext_modules])

Added: pypy/dist/pypy/jit/codegen/llvm/test/test_llvmjit.py
==============================================================================


More information about the pypy-svn mailing list