[pypy-svn] r15069 - pypy/dist/pypy/translator/llvm2/tool

ericvrp at codespeak.net ericvrp at codespeak.net
Mon Jul 25 19:50:33 CEST 2005


Author: ericvrp
Date: Mon Jul 25 19:50:32 2005
New Revision: 15069

Added:
   pypy/dist/pypy/translator/llvm2/tool/
   pypy/dist/pypy/translator/llvm2/tool/suggested_primitive.py   (contents, props changed)
Log:
Wrote simple tool to get an overview of the suggested_primitive functions that
still need to be implemented in the llvm backend.
The tool should be run from it's own directory for now!
This is the current output: (tail is what we want to know)


rpython suggested primitives:
['ll_os_stat', 'll_math_floor', 'll_os_isatty', 'll_time_sleep', 'll_math_frexp', 'll_math_atan2', 'll_os_open', 'll_os_ftruncate', 'll_read_into', 'll_math_fmod', 'll_time_time', 'll_math_ceil', 'll_math_modf', 'll_os_write', 'll_os_lseek', 'll_time_clock', 'll_math_log10', 'll_os_dup', 'll_os_fstat', 'll_os_getcwd', 'll_os_close']

llvm implemented functions:
['ll_time_time', 'll_os_write', 'll_time_sleep', 'll_os_open', 'll_read_into', 'cast', 'll_time_clock', 'll_os_dup', 'll_os_close']

llvm missing primitives:
['ll_os_stat', 'll_math_floor', 'll_os_isatty', 'll_math_frexp', 'll_math_atan2', 'll_os_ftruncate', 'll_math_fmod', 'll_math_ceil', 'll_math_modf', 'll_os_lseek', 'll_math_log10', 'll_os_fstat', 'll_os_getcwd']


Added: pypy/dist/pypy/translator/llvm2/tool/suggested_primitive.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/llvm2/tool/suggested_primitive.py	Mon Jul 25 19:50:32 2005
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+
+import os
+
+def main():
+
+    ll_modules_path = '../../../rpython/module'
+    ll_files = [ll_modules_path + '/' + f for f in os.listdir(ll_modules_path) if f[:3] == 'll_' and f[-3:] == '.py']
+    ll_function = {}    #XXX better use sets
+    for ll_file in ll_files:
+        for s in file(ll_file):
+            s = s.strip()
+            if not s.startswith('ll_') or s.find('suggested_primitive') == -1 or s.find('True') == -1:
+                continue
+            ll_function[s.split('.')[0]] = True
+
+    llvm_modules_path = '..'
+    llvm_files = [llvm_modules_path + '/' + 'extfunction.py']
+    llvm_function = {}
+    for llvm_file in llvm_files:
+        t = 'extfunctions["%'
+        for s in file(llvm_file):
+            s = s.strip()
+            if not s.startswith(t):
+                continue
+            llvm_function[s.split('"')[1][1:]] = True
+
+    print 'rpython suggested primitives:'
+    print ll_function.keys()
+    print
+
+    print 'llvm implemented functions:'
+    print llvm_function.keys()
+    print
+
+    print 'llvm missing primitives:'
+    missing_functions = [func for func in ll_function.keys() if func not in llvm_function]
+    print missing_functions
+    print
+
+if __name__ == '__main__':
+    main()



More information about the Pypy-commit mailing list