[pypy-svn] r64224 - in pypy/trunk/pypy/translator: . goal test

pedronis at codespeak.net pedronis at codespeak.net
Fri Apr 17 11:15:18 CEST 2009


Author: pedronis
Date: Fri Apr 17 11:15:18 2009
New Revision: 64224

Modified:
   pypy/trunk/pypy/translator/driver.py
   pypy/trunk/pypy/translator/goal/bench-cronjob.py
   pypy/trunk/pypy/translator/interactive.py
   pypy/trunk/pypy/translator/test/test_driver.py
   pypy/trunk/pypy/translator/test/test_interactive.py
Log:
kill more llvm related code



Modified: pypy/trunk/pypy/translator/driver.py
==============================================================================
--- pypy/trunk/pypy/translator/driver.py	(original)
+++ pypy/trunk/pypy/translator/driver.py	Fri Apr 17 11:15:18 2009
@@ -33,7 +33,6 @@
 
 _BACKEND_TO_TYPESYSTEM = {
     'c': 'lltype',
-    'llvm': 'lltype'
 }
 
 def backend_to_typesystem(backend):
@@ -521,62 +520,6 @@
                                       [STACKCHECKINSERTION, '?'+BACKENDOPT, RTYPE], 
                                       "LLInterpreting")
 
-    def task_source_llvm(self):
-        translator = self.translator
-        if translator.annotator is None:
-            raise ValueError, "llvm requires annotation."
-
-        from pypy.translator.llvm import genllvm
-
-        self.llvmgen = genllvm.GenLLVM(translator, self.standalone)
-
-        llvm_filename = self.llvmgen.gen_source(self.entry_point)
-        self.log.info("written: %s" % (llvm_filename,))
-    #
-    task_source_llvm = taskdef(task_source_llvm, 
-                               [STACKCHECKINSERTION, BACKENDOPT, RTYPE], 
-                               "Generating llvm source")
-
-    def task_compile_llvm(self):
-        gen = self.llvmgen
-        if self.standalone:
-            exe_name = (self.exe_name or 'testing') % self.get_info()
-            self.c_entryp = gen.compile_standalone(exe_name)
-            self.create_exe()
-        else:
-            self.c_module, self.c_entryp = gen.compile_module()
-    #
-    task_compile_llvm = taskdef(task_compile_llvm, 
-                                ['source_llvm'], 
-                                "Compiling llvm source")
-
-    def task_run_llvm(self):
-        self.backend_run('llvm')
-    #
-    task_run_llvm = taskdef(task_run_llvm, ['compile_llvm'], 
-                            "Running compiled llvm source",
-                            idemp=True)
-
-    def task_source_js(self):
-        from pypy.translator.js.js import JS
-        self.gen = JS(self.translator, functions=[self.entry_point],
-                      stackless=self.config.translation.stackless)
-        filename = self.gen.write_source()
-        self.log.info("Wrote %s" % (filename,))
-    task_source_js = taskdef(task_source_js, 
-                        [OOTYPE],
-                        'Generating Javascript source')
-
-    def task_compile_js(self):
-        pass
-    task_compile_js = taskdef(task_compile_js, ['source_js'],
-                              'Skipping Javascript compilation')
-
-    def task_run_js(self):
-        pass
-    task_run_js = taskdef(task_run_js, ['compile_js'],
-                              'Please manually run the generated code')
-
     def task_source_cli(self):
         from pypy.translator.cli.gencli import GenCli
         from pypy.translator.cli.entrypoint import get_entrypoint

Modified: pypy/trunk/pypy/translator/goal/bench-cronjob.py
==============================================================================
--- pypy/trunk/pypy/translator/goal/bench-cronjob.py	(original)
+++ pypy/trunk/pypy/translator/goal/bench-cronjob.py	Fri Apr 17 11:15:18 2009
@@ -2,12 +2,11 @@
 
 import os
 homedir = os.getenv('HOME')
-os.environ['PATH'] += ':/usr/local/bin:/usr/local/llvm/cfrontend/ppc/llvm-gcc/bin:'+homedir+'/bin'
+os.environ['PATH'] += ':'+homedir+'/bin'
 
 import autopath
 import py
 import time, os, sys, stat
-from pypy.translator.llvm.buildllvm import Builder
 
 os.umask(022)      # allow everyone to read/execute the produced pypy-c's
 
@@ -30,71 +29,6 @@
     os.chdir(homedir + '/projects/pypy-dist')
     run('/usr/local/bin/svn up 2>&1')
 
-def update_llvm():
-    os.chdir(homedir + '/projects/llvm')
-    run('cvs -q up 2>&1')
-    run('make -k -j3 tools-only 2>&1')
-
-def compile_llvm_variants(revision, features):
-    ll2bc(revision, features)
-    bc2c_exe(revision, features, 'from richards import *;main(iterations=1)')
-    bc2x86_exe(revision, features, 'llvm')
-
-def ll2bc(revision, features):
-    if features:
-        features = '-' + features
-    cmd = 'cp %spypy.ll pypy/translator/goal/archive/pypy%s-%s.ll' % (tmpdir, features, revision)
-    run(cmd)
-
-    opts = Builder(None).optimizations()
-    cmd  = '~/bin/llvm-as < %spypy.ll | ~/bin/opt %s -f -o %spypy.bc' % (
-        tmpdir, opts, tmpdir)
-    run(cmd)
-
-    cmd = 'cp %spypy.bc pypy/translator/goal/archive/pypy%s-%s.bc' % (tmpdir, features, revision)
-    run(cmd)
-
-
-def bc2c_exe(revision, features, profile_command=None):
-    if features:
-        features = '-' + features
-    filename = "pypy-llvm-%s%s-c" % (revision, features)
-    b = tmpdir + filename
-
-    run("~/bin/llc %spypy.bc -march=c -f -o %s.c" % (tmpdir, b))
-    run("cp %s.c pypy/translator/goal/archive" % b)
-    run("gcc %s.c %s -S -o %s.s" % (b, cflags, b))
-    run("cp %s.s pypy/translator/goal/archive" % b)
-    run("gcc %s.s %s -o %s" % (b, lflags, b))
-    run("cp %s pypy/translator/goal" % b)
-
-    if profile_command:
-        run("gcc %s.c -fprofile-generate %s -S -o %s.s" % (b, cflags, b))
-        run("gcc %s.s -fprofile-generate %s -o %s" % (b, lflags, b))
-        run("%s -c '%s'" % (b, profile_command))
-        run("gcc %s.c -fprofile-use %s -S -o %s.s" % (b, cflags, b))
-        run("cp %s.s pypy/translator/goal/archive/%s-prof.s" % (b, filename))
-        run("gcc %s.s -fprofile-use %s -o %s" % (b, lflags, b))
-        run("cp %s pypy/translator/goal/%s-prof" % (b, filename))
-        
-def bc2x86_exe(revision, features, name_extra, llc_extra_options=''):
-    if features:
-        features = '-' + features
-    b   = "%spypy-llvm-%s%s-%s" % (tmpdir, revision, features, name_extra)
-
-    cmd = "~/bin/llc %spypy.bc %s -f -o %s.s" % (tmpdir, llc_extra_options, b)
-    run(cmd)
-
-    cmd = 'cp %s.s pypy/translator/goal/archive' % b
-    run(cmd)
-
-    cmd = "gcc %s.s %s -o %s" % (b, lflags, b)
-    run(cmd)
-
-    cmd = "cp %s pypy/translator/goal" % b
-    run(cmd)
-
-
 def compile(backend):
     try:
         backend, features = backend.split('--', 1)
@@ -105,10 +39,7 @@
         featureoptions = ''
         targetoptions  = ''
 
-    if backend == 'llvm':
-        translateoptions = ' --source --raisingop2direct_call'
-    else:
-        translateoptions = ''
+    translateoptions = ''
 
     def normalize(f):
         if f.startswith('_'):
@@ -120,8 +51,6 @@
 
     os.chdir(homedir + '/projects/pypy-dist/pypy/translator/goal')
     run('/usr/local/bin/python translate.py --backend=%(backend)s%(featureoptions)s%(translateoptions)s --batch targetpypystandalone.py %(targetoptions)s 2>&1' % locals())
-    if backend == 'llvm':
-        run('mv %s/entry_point.ll %s/pypy.ll' % (tmpdir, tmpdir))
 
     os.chdir(homedir + '/projects/pypy-dist')
     try:
@@ -133,9 +62,7 @@
     if features:
         realname += "-" + features
 
-    if backend == 'llvm':   #create llvm exectutable from the current source
-        compile_llvm_variants(revision, features)
-    elif os.path.exists(basename):                   #copy executable
+    if os.path.exists(basename):                   #copy executable
         run("mv %s %s" % (basename, realname))
         if backend == 'cli':
             basename_dir = basename + '-data'
@@ -192,10 +119,6 @@
             jvm--inline-threshold=0--opt=3--_no-allworkingmodules
             """.split('\n') if backend.strip() and not backend.strip().startswith('#')]
     print time.ctime()
-    for backend in backends:
-        if backend.startswith('llvm'):
-            update_llvm()
-            break
     update_pypy()
     for backend in backends:
         try:

Modified: pypy/trunk/pypy/translator/interactive.py
==============================================================================
--- pypy/trunk/pypy/translator/interactive.py	(original)
+++ pypy/trunk/pypy/translator/interactive.py	Fri Apr 17 11:15:18 2009
@@ -132,11 +132,6 @@
         self.ensure_backend('c')
         self.driver.source_c()
 
-    def source_llvm(self, argtypes=None, **kwds):
-        self.update_options(argtypes, kwds)
-        self.ensure_backend('llvm')
-        self.driver.source_llvm()
-
     def source_js(self, argtypes=None, **kwds):
         self.update_options(argtypes, kwds)
         self.ensure_backend('js')
@@ -159,12 +154,6 @@
         self.ensure_backend('c')
         self.driver.compile_c()
         return self.driver.c_entryp
-
-    def compile_llvm(self, argtypes=None, **kwds):
-        self.update_options(argtypes, kwds)
-        self.ensure_backend('llvm')
-        self.driver.compile_llvm()
-        return self.driver.c_entryp
   
     def compile_cli(self, argtypes=None, **kwds):
         self.update_options(argtypes, kwds)

Modified: pypy/trunk/pypy/translator/test/test_driver.py
==============================================================================
--- pypy/trunk/pypy/translator/test/test_driver.py	(original)
+++ pypy/trunk/pypy/translator/test/test_driver.py	Fri Apr 17 11:15:18 2009
@@ -30,11 +30,10 @@
     expected = ['annotate', 'backendopt_lltype',
                  'backendopt_ootype',
                  'llinterpret_lltype',
-                 'rtype_ootype', 'rtype_lltype', 'source_js',
-                 'source_cli', 'source_c', 'source_llvm',
+                 'rtype_ootype', 'rtype_lltype',
+                 'source_cli', 'source_c',
                  'compile_cli', 'compile_c',
-                 'compile_llvm', 'compile_js',
-                 'run_llvm', 'run_c', 'run_js', 'run_cli',
+                 'run_c', 'run_cli',
                  'compile_jvm', 'source_jvm', 'run_jvm',
                  'prejitbackendopt_lltype', 'pyjitpl_lltype']
     assert set(td.exposed) == set(expected)                             
@@ -50,7 +49,6 @@
         'backendopt_lltype']
 
     expected = ['annotate', 'backendopt', 'llinterpret', 'rtype', 'source_c',
-                'source_llvm', 'compile_c', 'compile_llvm', 'run_llvm',
-                'run_c', 'prejitbackendopt', 'pyjitpl']
+                'compile_c', 'run_c', 'prejitbackendopt', 'pyjitpl']
 
     assert set(td.exposed) == set(expected)

Modified: pypy/trunk/pypy/translator/test/test_interactive.py
==============================================================================
--- pypy/trunk/pypy/translator/test/test_interactive.py	(original)
+++ pypy/trunk/pypy/translator/test/test_interactive.py	Fri Apr 17 11:15:18 2009
@@ -71,22 +71,6 @@
 
     t = Translation(f, [int, int])
     py.test.raises(Exception, "t.source()")
-
-def test_simple_source_llvm():
-    py.test.skip("we have no more llvm backend for now")
-    from pypy.translator.llvm.test.runtest import llvm_test
-    llvm_test()
-
-    def f(x,y):
-        return x+y
-
-    t = Translation(f, [int, int], backend='llvm')
-    t.source(gc='boehm')
-    assert 'source_llvm' in t.driver.done
-    
-    t = Translation(f, [int, int])
-    t.source_llvm()
-    assert 'source_llvm' in t.driver.done
     
 def test_disable_logic():
 



More information about the Pypy-commit mailing list