[pypy-svn] r16739 - in pypy/release/0.7.x/pypy/translator/llvm: . module

rxe at codespeak.net rxe at codespeak.net
Sat Aug 27 13:05:59 CEST 2005


Author: rxe
Date: Sat Aug 27 13:05:58 2005
New Revision: 16739

Modified:
   pypy/release/0.7.x/pypy/translator/llvm/database.py
   pypy/release/0.7.x/pypy/translator/llvm/extfuncnode.py
   pypy/release/0.7.x/pypy/translator/llvm/genllvm.py
   pypy/release/0.7.x/pypy/translator/llvm/module/genexterns.c
   pypy/release/0.7.x/pypy/translator/llvm/module/support.py
Log:
Start refactoring out our gen ll from c code... and attempt to make the c code not too different from the original.


Modified: pypy/release/0.7.x/pypy/translator/llvm/database.py
==============================================================================
--- pypy/release/0.7.x/pypy/translator/llvm/database.py	(original)
+++ pypy/release/0.7.x/pypy/translator/llvm/database.py	Sat Aug 27 13:05:58 2005
@@ -304,6 +304,9 @@
     def repr_constructor(self, type_):
         return self.obj2node[type_].constructor_ref
 
+    def repr_name(self, obj):
+        return self.obj2node[obj].ref
+
     # __________________________________________________________
     # Primitive stuff
 

Modified: pypy/release/0.7.x/pypy/translator/llvm/extfuncnode.py
==============================================================================
--- pypy/release/0.7.x/pypy/translator/llvm/extfuncnode.py	(original)
+++ pypy/release/0.7.x/pypy/translator/llvm/extfuncnode.py	Sat Aug 27 13:05:58 2005
@@ -9,7 +9,7 @@
     def __init__(self, db, value):
         self.db = db
         self.value = value
-        self.ref = self.make_ref("%pypy_", value._callable.__name__)
+        self.ref = self.make_ref("%", value._callable.__name__)
 
     def getdecl(self):
         T = self.value._TYPE

Modified: pypy/release/0.7.x/pypy/translator/llvm/genllvm.py
==============================================================================
--- pypy/release/0.7.x/pypy/translator/llvm/genllvm.py	(original)
+++ pypy/release/0.7.x/pypy/translator/llvm/genllvm.py	Sat Aug 27 13:05:58 2005
@@ -29,33 +29,39 @@
 function_count = {}
 llcode_header = ll_functions = None
 
-def get_ll(ccode, extern_dir, functions=[]):
-    
+ll_func_names = [
+       "%prepare_and_raise_IOError",
+       "%prepare_and_raise_ValueError",
+       "%prepare_and_raise_OverflowError",
+       "%prepare_and_raise_ZeroDivisionError",
+       "%RPyString_AsString",
+       "%RPyString_FromString",
+       "%RPyString_Size"]
+       
+def get_ll(ccode, function_names):
+
     # goto codespeak and compile our c code
     request = urllib.urlencode({'ccode':ccode})
     llcode = urllib.urlopen('http://codespeak.net/pypy/llvm-gcc.cgi', request).read()
 
-    # get rid of the struct that llvm-gcc introduces to struct types
-    llcode = llcode.replace("%struct.", "%")
-
-    #find function names, declare them internal with fastcc calling convertion
+    # strip lines
     ll_lines = []
-    funcnames = {
-        "%RPyString_Size"                      : True,
-        "%RPyString_AsString"                  : True,
-        "%RPyString_FromString"                : True,
-        "%ll_frexp_result__Float_Signed"       : True,
-        "%ll_modf_result__Float_Float"         : True,
-        "%prepare_and_raise_ZeroDivisionError" : True,
-        "%prepare_and_raise_OverflowError"     : True,
-        "%prepare_and_raise_ValueError"        : True,
-        "%prepare_and_raise_IOError"           : True,
-        }
+    function_names = list(function_names) + ll_func_names
+    funcnames = dict([(k, True) for k in function_names])
+
+    # strip declares tjat in ll_func_names
     for line in llcode.split('\n'):
+
+        # get rid of any of the structs that llvm-gcc introduces to struct types
+        line = line.replace("%struct.", "%")
+
+        # strip comments
         comment = line.find(';')
         if comment >= 0:
             line = line[:comment]
         line = line.rstrip()
+
+        # find function names, declare them internal with fastcc calling convertion
         if line[-1:] == '{':
            returntype, s = line.split(' ', 1)
            funcname  , s = s.split('(', 1)
@@ -64,7 +70,7 @@
            line = '%s %s %s' % ("", DEFAULT_CCONV, line,)
         ll_lines.append(line)
 
-    #patch calls to function that we just declared fastcc
+    # patch calls to function that we just declared fastcc
     ll_lines2, calltag, declaretag = [], 'call ', 'declare '
     for line in ll_lines:
         i = line.find(calltag)
@@ -86,31 +92,7 @@
 
     llcode = '\n'.join(ll_lines2)
     global llcode_header, ll_functions 
-    llcode_header, ll_functions = llcode.split('implementation')       # XXX testing
-
-    #XXX temp disabled
-    #
-    ## create file
-    #llfilename = extern_dir.join("externs").new(ext='.ll')
-    #f = open(str(llfilename), 'w')
-    #f.write(llcode)
-    #f.close()
-    #
-    # create bytecode
-    #os.chdir(str(extern_dir))
-    #cmdexec('llvm-as externs.ll')
-    #bcfilename = extern_dir.join("externs").new(ext='.bc')
-    #if functions:
-    #    for func in functions:
-    #        # extract
-    #        cmdexec('llvm-extract -func %s -o %s.bc externs.bc' % (func, func))
-    #    
-    #    # link all the ll files
-    #    functions_bcs = ' '.join(['%s.bc' % func for func in functions])
-    #    cmdexec('llvm-link -o externs_linked.bc ' + functions_bcs)
-    #    bcfilename = extern_dir.join("externs_linked").new(ext='.bc')
-    #
-    #return bcfilename
+    llcode_header, ll_functions = llcode.split('implementation')
     
 class GenLLVM(object):
 
@@ -160,44 +142,33 @@
         return decls
 
     def generate_llfile(self, extern_decls):
-        
-        #XXX outcommented because we are not puting files here
-        #extern_dir = udir.join("externs")
-        #if extern_dir.check(dir=1):
-        #    return
-        #extern_dir.mkdir()
-        extern_dir = None
-
-        genllcode = ""
+        ccode = []
+        function_names = []
 
         def predeclarefn(c_name, llname):
+            function_names.append(llname)
             assert llname[0] == "%"
+            llname = llname[1:]
             assert '\n' not in llname
-            return '#define\t%s\t%s' % (c_name, llname[1:])
-
+            ccode.append('#define\t%s\t%s\n' % (c_name, llname))
+            
         for c_name, obj in extern_decls:
             if isinstance(obj, lltype.LowLevelType):
                 pass
             elif isinstance(obj, types.FunctionType):
                 funcptr = getfunctionptr(self.translator, obj)
                 c = inputconst(lltype.typeOf(funcptr), funcptr)
-                llname = self.db.repr_arg(c)
-                genllcode += predeclarefn(c_name, llname) + "\n"
-            #elif isinstance(lltype.typeOf(obj), lltype.Ptr):
-            #    if isinstance(obj.TO, lltype.FuncType):
-            #        llname = self.db.repr_constant(obj)[1]
-            #XXXXXXXXXXX        genllcode += predeclarefn(c_name, llname) + "\n"
+                predeclarefn(c_name, self.db.repr_arg(c))
+            elif isinstance(lltype.typeOf(obj), lltype.Ptr):
+                if isinstance(lltype.typeOf(obj._obj), lltype.FuncType):
+                    predeclarefn(c_name, self.db.repr_name(obj._obj))
 
+        # append local file
         j = os.path.join
         p = j(j(os.path.dirname(__file__), "module"), "genexterns.c")
+        ccode.append(open(p).read())
 
-        math_fns  = 'acos asin atan ceil cos cosh exp fabs floor log log10 atan2 fmod '
-        math_fns += 'sin sinh sqrt tan tanh frexp modf pow hypot ldexp is_error'
-        fns = [('ll_math_%s' % f) for f in math_fns.split()]
-        fns += "ll_time_time ll_time_clock ll_time_sleep ll_floattime".split()
-        fns += "ll_strtod_parts_to_float ll_strtod_formatd".split()
-
-        get_ll(open(p).read(), extern_dir, fns)
+        get_ll("".join(ccode), function_names)
 
     def gen_llvm_source(self, func=None):
         if self.debug:  print 'gen_llvm_source begin) ' + time.ctime()
@@ -389,7 +360,7 @@
                                                            exe_name=exe_name)
         else:
             postfix = ''
-            basename = filename.purebasename+'_wrapper'+postfix+'.pyx'
+            basename = filename.purebasename + '_wrapper' + postfix + '.pyx'
             pyxfile = filename.new(basename = basename)
             write_pyx_wrapper(self.entrynode, pyxfile)    
             return build_llvm_module.make_module_from_llvm(filename,
@@ -400,23 +371,12 @@
         codewriter.append("declare int %printf(sbyte*, ...)")
 
 def genllvm(translator, log_source=False, **kwds):
-    if not llvm_is_on_path():
-        # XXX not good to call py.test.skip here
-        py.test.skip("llvm not found")
-
     gen = GenLLVM(translator)
     filename = gen.gen_llvm_source()
     if log_source:
         log.genllvm(open(filename).read())
     return gen.create_module(filename, **kwds)
 
-def llvm_is_on_path():
-    try:
-        py.path.local.sysfind("llvm-as")
-    except py.error.ENOENT: 
-        return False 
-    return True
-
 def compile_module(function, annotation, view=False, **kwds):
     t = Translator(function)
     a = t.annotate(annotation)

Modified: pypy/release/0.7.x/pypy/translator/llvm/module/genexterns.c
==============================================================================
--- pypy/release/0.7.x/pypy/translator/llvm/module/genexterns.c	(original)
+++ pypy/release/0.7.x/pypy/translator/llvm/module/genexterns.c	Sat Aug 27 13:05:58 2005
@@ -1,34 +1,34 @@
-#include <errno.h>
-#include <locale.h>
-#include <ctype.h>
-#include <python2.3/Python.h>
-
-#define LL_MATH_SET_ERANGE_IF_MATH_ERROR Py_SET_ERANGE_IF_OVERFLOW
-
-// c forward declarations
-double frexp(double, int*);
 
+// Forward declare hacks
 struct RPyFREXP_RESULT;
 struct RPyMODF_RESULT;
 struct RPyString;
 struct RPySTAT_RESULT;
+struct RPyListOfString;
 
-struct RPyFREXP_RESULT *pypy_ll_frexp_result__Float_Signed(double, int);
-struct RPyMODF_RESULT *pypy_ll_modf_result__Float_Float(double, double);
-struct RPySTAT_RESULT *pypy_ll_stat_result__Signed_Signed_Signed_Signed_Signed_Signed_Signed_Signed_Signed_Signed(int, int, int, int, int, 
-													     int, int, int, int, int);
+// We hand craft these in module/support.ll
+void prepare_and_raise_OverflowError(char *);
+void prepare_and_raise_ValueError(char *);
+void prepare_and_raise_IOError(char *);
 char *RPyString_AsString(struct RPyString*);
 int RPyString_Size(struct RPyString*);
 struct RPyString *RPyString_FromString(char *);
 
-void prepare_and_raise_OverflowError(char *);
-void prepare_and_raise_ValueError(char *);
-void prepare_and_raise_IOError(char *);
-void pypy_ll_raise_OSError__Signed(int error);
+// Generated by rpython - argggh have to feed in prototypes
+struct RPyFREXP_RESULT *ll_frexp_result(double, int);
+struct RPyMODF_RESULT *ll_modf_result(double, double);
+struct RPySTAT_RESULT *ll_stat_result(int, int, int, int, int, int, int, int, int, int);
+void RPYTHON_RAISE_OSERROR(int error);
+int pypy_entry_point(struct RPyListOfString*);
 
-#define RPYTHON_RAISE_OSERROR(error) pypy_ll_raise_OSError__Signed(error)
+#include <errno.h>
+#include <locale.h>
+#include <ctype.h>
+#include <python2.3/Python.h>
+
+#define LL_MATH_SET_ERANGE_IF_MATH_ERROR Py_SET_ERANGE_IF_OVERFLOW
 
-int pypy_ll_math_is_error(double x) {
+int ll_math_is_error(double x) {
 	if (errno == ERANGE) {
 		if (!x) 
 			return 0;
@@ -43,12 +43,12 @@
 
 #define LL_MATH_CHECK_ERROR(x, errret) do {  \
 	LL_MATH_SET_ERANGE_IF_MATH_ERROR(x); \
-	if (errno && pypy_ll_math_is_error(x))    \
+	if (errno && ll_math_is_error(x))    \
 		return errret;               \
 } while(0)
 
 
-double pypy_ll_math_pow(double x, double y) {
+double ll_math_pow(double x, double y) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = pow(x, y);
@@ -56,7 +56,7 @@
 	return r;
 }
 
-double pypy_ll_math_atan2(double x, double y) {
+double ll_math_atan2(double x, double y) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = atan2(x, y);
@@ -64,7 +64,7 @@
 	return r;
 }
 
-double pypy_ll_math_fmod(double x, double y) {
+double ll_math_fmod(double x, double y) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = fmod(x, y);
@@ -72,7 +72,7 @@
 	return r;
 }
 
-double pypy_ll_math_ldexp(double x, long y) {
+double ll_math_ldexp(double x, long y) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = ldexp(x, (int) y);
@@ -80,7 +80,7 @@
 	return r;
 }
 
-double pypy_ll_math_hypot(double x, double y) {
+double ll_math_hypot(double x, double y) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = hypot(x, y);
@@ -88,17 +88,17 @@
 	return r;
 }
 
-struct RPyMODF_RESULT* pypy_ll_math_modf(double x) {
+struct RPyMODF_RESULT* ll_math_modf(double x) {
 	double intpart, fracpart;
 	LL_MATH_ERROR_RESET;
 	fracpart = modf(x, &intpart);
 	LL_MATH_CHECK_ERROR(fracpart, NULL);
-	return pypy_ll_modf_result__Float_Float(fracpart, intpart);
+	return ll_modf_result(fracpart, intpart);
 }
 
 /* simple math function */
 
-double pypy_ll_math_acos(double x) {
+double ll_math_acos(double x) {
 	double r;	
 	LL_MATH_ERROR_RESET;
 	r = acos(x);
@@ -106,7 +106,7 @@
 	return r;
 }
 
-double pypy_ll_math_asin(double x) {
+double ll_math_asin(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = asin(x);
@@ -114,7 +114,7 @@
 	return r;
 }
 
-double pypy_ll_math_atan(double x) {
+double ll_math_atan(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = atan(x);
@@ -122,7 +122,7 @@
 	return r;
 }
 
-double pypy_ll_math_ceil(double x) {
+double ll_math_ceil(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = ceil(x);
@@ -130,7 +130,7 @@
 	return r;
 }
 
-double pypy_ll_math_cos(double x) {
+double ll_math_cos(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = cos(x);
@@ -138,7 +138,7 @@
 	return r;
 }
 
-double pypy_ll_math_cosh(double x) {
+double ll_math_cosh(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = cosh(x);
@@ -146,7 +146,7 @@
 	return r;
 }
 
-double pypy_ll_math_exp(double x) {
+double ll_math_exp(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = exp(x);
@@ -154,7 +154,7 @@
 	return r;
 }
 
-double pypy_ll_math_fabs(double x) {
+double ll_math_fabs(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = fabs(x);
@@ -162,7 +162,7 @@
 	return r;
 }
 
-double pypy_ll_math_floor(double x) {
+double ll_math_floor(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = floor(x);
@@ -170,7 +170,7 @@
 	return r;
 }
 
-double pypy_ll_math_log(double x) {
+double ll_math_log(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = log(x);
@@ -178,7 +178,7 @@
 	return r;
 }
 
-double pypy_ll_math_log10(double x) {
+double ll_math_log10(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = log10(x);
@@ -186,7 +186,7 @@
 	return r;
 }
 
-double pypy_ll_math_sin(double x) {
+double ll_math_sin(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = sin(x);
@@ -194,7 +194,7 @@
 	return r;
 }
 
-double pypy_ll_math_sinh(double x) {
+double ll_math_sinh(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = sinh(x);
@@ -202,7 +202,7 @@
 	return r;
 }
 
-double pypy_ll_math_sqrt(double x) {
+double ll_math_sqrt(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = sqrt(x);
@@ -210,7 +210,7 @@
 	return r;
 }
 
-double pypy_ll_math_tan(double x) {
+double ll_math_tan(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = tan(x);
@@ -218,7 +218,7 @@
 	return r;
 }
 
-double pypy_ll_math_tanh(double x) {
+double ll_math_tanh(double x) {
 	double r;
 	LL_MATH_ERROR_RESET;
 	r = tanh(x);
@@ -226,13 +226,13 @@
 	return r;
 }
 
-struct RPyFREXP_RESULT* pypy_ll_math_frexp(double x) {
+struct RPyFREXP_RESULT* ll_math_frexp(double x) {
 	int expo;
 	double m;
 	LL_MATH_ERROR_RESET;
 	m= frexp(x, &expo);
 	LL_MATH_CHECK_ERROR(m, NULL);
-	return pypy_ll_frexp_result__Float_Signed(m, expo);
+	return ll_frexp_result(m, expo);
 }
 
 /************************************************************/
@@ -251,7 +251,7 @@
    XXX Win64 does not yet, but might when the platform matures. */
 #include <windows.h>
 
-double pypy_ll_time_clock(void)
+double ll_time_clock(void)
 {
 	static LARGE_INTEGER ctrStart;
 	static double divisor = 0.0;
@@ -283,14 +283,14 @@
 #endif
 #endif
 
-double pypy_ll_time_clock(void)
+double ll_time_clock(void)
 {
 	return ((double)clock()) / CLOCKS_PER_SEC;
 }
 #endif /* MS_WINDOWS */
 
 
-void pypy_ll_time_sleep(double secs)
+void ll_time_sleep(double secs)
 {
 #if defined(MS_WINDOWS)
 	double millisecs = secs * 1000.0;
@@ -343,7 +343,7 @@
 #endif /* MS_WINDOWS */
 #endif /* HAVE_FTIME */
 
-double pypy_ll_floattime(void)
+double ll_floattime(void)
 {
 	/* There are three ways to get the time:
 	  (1) gettimeofday() -- resolution in microseconds
@@ -378,13 +378,13 @@
 	}
 }
 
-double pypy_ll_time_time(void) /* xxx had support for better resolutions */
+double ll_time_time(void) /* xxx had support for better resolutions */
 {
-	return pypy_ll_floattime();
+	return ll_floattime();
 }
 
 
-double pypy_ll_strtod_parts_to_float(struct RPyString *sign, 
+double ll_strtod_parts_to_float(struct RPyString *sign, 
 				     struct RPyString *beforept, 
 				     struct RPyString *afterpt, 
 				     struct RPyString *exponent)
@@ -445,7 +445,7 @@
 }
 
 
-struct RPyString *pypy_ll_strtod_formatd(struct RPyString *fmt, double x) {
+struct RPyString *ll_strtod_formatd(struct RPyString *fmt, double x) {
 	char buffer[120]; /* this should be enough, from PyString_Format code */
 	int buflen = 120;
 	int res;
@@ -512,9 +512,9 @@
 /* The functions below are mapped to functions from pypy.rpython.module.*
    by the pypy.translator.c.extfunc.EXTERNALS dictionary.
    They should correspond to the functions with the suggested_primitive
-   flag set, and NOT necessarily directly to the pypy_ll_os_*() functions.
-   See for example pypy_ll_read_into(), which is called by pypy_ll_os_read().
-   The latter would be messy to write here, but pypy_ll_read_into() is quite easy.
+   flag set, and NOT necessarily directly to the ll_os_*() functions.
+   See for example ll_read_into(), which is called by ll_os_read().
+   The latter would be messy to write here, but ll_read_into() is quite easy.
 */
 
 
@@ -531,7 +531,7 @@
 #endif
 
 
-int pypy_ll_os_open(struct RPyString *filename, int flag, int mode)
+int ll_os_open(struct RPyString *filename, int flag, int mode)
 {
 	/* XXX unicode_file_names */
 	char buf[PATH_MAX];
@@ -550,7 +550,7 @@
 	}
 }
 
-long pypy_ll_read_into(int fd, struct RPyString *buffer)
+long ll_read_into(int fd, struct RPyString *buffer)
 {
 	long n = read(fd, RPyString_AsString(buffer), RPyString_Size(buffer));
 	if (n < 0)
@@ -558,7 +558,7 @@
 	return n;
 }
 
-long pypy_ll_os_write(int fd, struct RPyString *buffer)
+long ll_os_write(int fd, struct RPyString *buffer)
 {
 	long n = write(fd, RPyString_AsString(buffer), RPyString_Size(buffer));
 	if (n < 0)
@@ -566,13 +566,13 @@
 	return n;
 }
 
-void pypy_ll_os_close(int fd)
+void ll_os_close(int fd)
 {
 	if (close(fd) < 0)
 		RPYTHON_RAISE_OSERROR(errno);
 }
 
-int pypy_ll_os_dup(int fd)
+int ll_os_dup(int fd)
 {
 	fd = dup(fd);
 	if (fd < 0)
@@ -580,7 +580,7 @@
 	return fd;
 }
 
-struct RPyString *pypy_ll_os_getcwd(void)
+struct RPyString *ll_os_getcwd(void)
 {
 	char buf[PATH_MAX];
 	char *res;
@@ -606,12 +606,11 @@
   res9 = (long)st.st_ctime; /*XXX ignoring quite a lot of things for time here */
   /*XXX ignoring BLOCK info here*/
 
-  return pypy_ll_stat_result__Signed_Signed_Signed_Signed_Signed_Signed_Signed_Signed_Signed_Signed(res0, res1, res2, res3, res4,
-											       res5, res6, res7, res8, res9);
+  return ll_stat_result(res0, res1, res2, res3, res4, res5, res6, res7, res8, res9);
 }
 
 
-struct RPySTAT_RESULT* pypy_ll_os_stat(struct RPyString * fname) {
+struct RPySTAT_RESULT* ll_os_stat(struct RPyString * fname) {
   STRUCT_STAT st;
   int error = STAT(RPyString_AsString(fname), &st);
   if (error != 0) {
@@ -621,7 +620,7 @@
   return _stat_construct_result_helper(st);
 }
 
-struct RPySTAT_RESULT* pypy_ll_os_fstat(long fd) {
+struct RPySTAT_RESULT* ll_os_fstat(long fd) {
   STRUCT_STAT st;
   int error = FSTAT(fd, &st);
   if (error != 0) {
@@ -631,7 +630,7 @@
   return _stat_construct_result_helper(st);
 }
 
-long pypy_ll_os_lseek(long fd, long pos, long how) {
+long ll_os_lseek(long fd, long pos, long how) {
 #if defined(MS_WIN64) || defined(MS_WINDOWS)
     PY_LONG_LONG res;
 #else
@@ -655,12 +654,12 @@
     return res;
 }
 
-long pypy_ll_os_isatty(long fd) {
+long ll_os_isatty(long fd) {
     return (int)isatty((int)fd);
 }
 
 #ifdef HAVE_FTRUNCATE
-void pypy_ll_os_ftruncate(long fd, long length) { /*XXX add longfile support */
+void ll_os_ftruncate(long fd, long length) { /*XXX add longfile support */
     int res;
     res = ftruncate((int)fd, (off_t)length);
     if (res < 0) {
@@ -669,38 +668,38 @@
 }
 #endif
 
-struct RPyString *pypy_ll_os_strerror(int errnum) {
+struct RPyString *ll_os_strerror(int errnum) {
 	char *res;
 	res = strerror(errnum);
 	return RPyString_FromString(res);
 }
 
-long pypy_ll_os_system(struct RPyString * fname) {
+long ll_os_system(struct RPyString * fname) {
   return system(RPyString_AsString(fname));
 }
 
-void pypy_ll_os_unlink(struct RPyString * fname) {
+void ll_os_unlink(struct RPyString * fname) {
   int error = unlink(RPyString_AsString(fname));
   if (error != 0) {
     RPYTHON_RAISE_OSERROR(errno);
   }
 }
 
-void pypy_ll_os_chdir(struct RPyString * path) {
+void ll_os_chdir(struct RPyString * path) {
     int error = chdir(RPyString_AsString(path));
     if (error != 0) {
 	RPYTHON_RAISE_OSERROR(errno);
     }
 }
 
-void pypy_ll_os_mkdir(struct RPyString * path, int mode) {
+void ll_os_mkdir(struct RPyString * path, int mode) {
     int error = mkdir(RPyString_AsString(path), mode);
     if (error != 0) {
 	RPYTHON_RAISE_OSERROR(errno);
     }
 }
 
-void pypy_ll_os_rmdir(struct RPyString * path) {
+void ll_os_rmdir(struct RPyString * path) {
     int error = rmdir(RPyString_AsString(path));
     if (error != 0) {
 	RPYTHON_RAISE_OSERROR(errno);

Modified: pypy/release/0.7.x/pypy/translator/llvm/module/support.py
==============================================================================
--- pypy/release/0.7.x/pypy/translator/llvm/module/support.py	(original)
+++ pypy/release/0.7.x/pypy/translator/llvm/module/support.py	Sat Aug 27 13:05:58 2005
@@ -43,7 +43,6 @@
     %sizeptr = getelementptr %RPyString* %structstring, int 0, uint 1, uint 0
     %size = load int* %sizeptr
     ret int %size
-
 }
 
 """)
@@ -266,44 +265,6 @@
 }
 """ % locals())
 
-extfunctions["%main"] = [(), """
-int %main(int %argc, sbyte** %argv) {
-entry:
-    %pypy_argv = call fastcc %RPyListOfString* %pypy_ll_newlist__listPtrConst_Signed(int 0)
-    br label %no_exit
-
-no_exit:
-    %indvar = phi uint [ %indvar.next, %next_arg ], [ 0, %entry ]
-    %i.0.0 = cast uint %indvar to int
-    %tmp.8 = getelementptr sbyte** %argv, uint %indvar
-    %tmp.9 = load sbyte** %tmp.8
-
-    %t    = getelementptr [19 x sbyte]* %__print_debug_info_option, int 0, int 0
-    %res  = call ccc int %strcmp(sbyte* %tmp.9, sbyte* %t)
-    %cond = seteq int %res, 0
-    br bool %cond, label %debugging, label %not_debugging
-
-debugging:
-    store bool true, bool* %__print_debug_info
-    br label %next_arg
-
-not_debugging:
-    %rpy = call fastcc %RPyString* %RPyString_FromString(sbyte* %tmp.9)
-    call fastcc void %pypy_ll_append__listPtr_rpy_stringPtr(%RPyListOfString* %pypy_argv, %RPyString* %rpy)
-    br label %next_arg
-
-next_arg:
-    %inc = add int %i.0.0, 1
-    %tmp.2 = setlt int %inc, %argc
-    %indvar.next = add uint %indvar, 1
-    br bool %tmp.2, label %no_exit, label %loopexit
-
-loopexit:
-    %ret  = call fastcc int %pypy_entry_point(%structtype.list* %pypy_argv)
-    ret int %ret
-}
-"""]
-
 extfunctions["%main_noargs"] = [(), """
 int %main(int %argc, sbyte** %argv) {
 entry:



More information about the Pypy-commit mailing list