[pypy-svn] r20805 - pypy/dist/pypy/translator/llvm

rxe at codespeak.net rxe at codespeak.net
Tue Dec 6 18:58:07 CET 2005


Author: rxe
Date: Tue Dec  6 18:58:06 2005
New Revision: 20805

Modified:
   pypy/dist/pypy/translator/llvm/externs2ll.py
Log:
Small updates to include paths... not all tested yet.



Modified: pypy/dist/pypy/translator/llvm/externs2ll.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/externs2ll.py	(original)
+++ pypy/dist/pypy/translator/llvm/externs2ll.py	Tue Dec  6 18:58:06 2005
@@ -24,16 +24,9 @@
     "%LLVM_RPython_StartupCode",
     ]
 
-def get_c_cpath():
-    from pypy.translator import translator
-    return os.path.dirname(translator.__file__)
-
 def get_genexterns_path():
     return os.path.join(get_llvm_cpath(), "genexterns.c")
 
-def get_llvm_cpath():
-    return os.path.join(os.path.dirname(__file__), "module")
-
 def get_ll(ccode, function_names):
     function_names += support_functions
     filename = str(udir.join("ccode.c"))
@@ -42,12 +35,10 @@
     f.close()
 
     plain = filename[:-2]
-    cmd = "llvm-gcc -I%s -I%s -I%s -I%s -S %s.c -o %s.ll 2>&1" % (get_llvm_cpath(),
-                                                             get_incdir(),
-                                                             get_c_cpath(),
-                                                             get_python_inc(),
-                                                             plain,
-                                                             plain)
+    includes = get_incdirs()
+    cmd = "llvm-gcc %s -S %s.c -o %s.ll 2>&1" % (includes,
+                                                 plain,
+                                                 plain)
     os.system(cmd)
     llcode = open(plain + '.ll').read()
 
@@ -134,13 +125,26 @@
 
     return decls
 
-def get_python_inc():
-    import distutils.sysconfig
-    return distutils.sysconfig.get_python_inc()
+def get_c_cpath():
+    from pypy.translator import translator
+    return os.path.dirname(translator.__file__)
+
+def get_llvm_cpath():
+    return os.path.join(os.path.dirname(__file__), "module")
+
+def get_incdirs():
 
-def get_incdir():
     import distutils.sysconfig
-    return distutils.sysconfig.EXEC_PREFIX + "/include"
+    includes = (distutils.sysconfig.EXEC_PREFIX + "/include", 
+                distutils.sysconfig.EXEC_PREFIX + "/include/gc",
+                distutils.sysconfig.get_python_inc(),
+                get_c_cpath(),
+                get_llvm_cpath())
+
+    includestr = ""
+    for ii in includes:
+        includestr += "-I %s " % ii
+    return includestr
 
 def generate_llfile(db, extern_decls, entrynode, standalone):
     ccode = []



More information about the Pypy-commit mailing list