[pypy-svn] r21691 - in pypy/dist/pypy/translator: goal llvm
ericvrp at codespeak.net
ericvrp at codespeak.net
Wed Jan 4 11:47:54 CET 2006
Author: ericvrp
Date: Wed Jan 4 11:47:52 2006
New Revision: 21691
Modified:
pypy/dist/pypy/translator/goal/bench-cronjob.py
pypy/dist/pypy/translator/goal/bench-unix.py
pypy/dist/pypy/translator/llvm/build_llvm_module.py
Log:
Modified nightly benchmark to generate four executables with genllvm.
* llvm1.6 with -march=c
* llvm1.6 with -march=x86
* llvm1.7 with -march=c
* llvm1.7 with -march=x86
Added some llvm optimization option as suggested by Chris Lattner (mr. llvm)
Modified: pypy/dist/pypy/translator/goal/bench-cronjob.py
==============================================================================
--- pypy/dist/pypy/translator/goal/bench-cronjob.py (original)
+++ pypy/dist/pypy/translator/goal/bench-cronjob.py Wed Jan 4 11:47:52 2006
@@ -1,9 +1,10 @@
#! /usr/bin/env python
+import autopath
+import py
import time, os, sys, stat
homedir = os.getenv('HOME')
-os.putenv('PATH','~/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3.6')
def update_pypy():
os.chdir(homedir + '/projects/pypy-dist')
@@ -15,6 +16,80 @@
os.system('make clean 2>&1')
os.system('make -j3 tools-only 2>&1')
+def compile_llvm_variants(revision):
+ tmpdir = py.std.tempfile.gettempdir() + '/usession-' + os.environ['USER'] + '/'
+
+ cmd = 'cp %sentry_point.ll pypy/translator/goal/entry_point-%s.ll' % (tmpdir, revision)
+ print cmd
+ os.system(cmd)
+
+ #this assumes entry_point.bc is created with llvm 1.6 and pypy-llvm-<revision> is already created with the llvm c backend
+ b = "pypy/translator/goal/pypy-llvm-%s" % revision
+ cmd = "mv %s %s-llvm1_6_c" % (b, b)
+ print cmd
+ os.system(cmd)
+
+ #
+ b = "%spypy-llvm-%s-llvm1_6_x86" % (tmpdir, revision)
+
+ cmd = "llc %sentry_point.bc -f -o %s.s" % (tmpdir, b)
+ print cmd
+ os.system(cmd)
+
+ cmd = "as %s.s -o %s.o" % (b, b)
+ print cmd
+ os.system(cmd)
+
+ cmd = "gcc %s.o -static -lgc -lm -lpthread -pipe -o %s" % (b, b)
+ print cmd
+ os.system(cmd)
+
+ cmd = "cp %s pypy/translator/goal" % b
+ print cmd
+ os.system(cmd)
+
+
+ #
+ b = "%spypy-llvm-%s-llvm1_7_c" % (tmpdir, revision)
+
+ cmd = '~/bin/llvm-as < %sentry_point.ll | ~/bin/opt -verify -lowersetjmp -funcresolve -raiseallocs -simplifycfg -mem2reg -globalopt -globaldce -ipconstprop -deadargelim -instcombine -simplifycfg -basiccg -prune-eh -inline -simplify-libcalls -basiccg -argpromotion -raise -tailduplicate -simplifycfg -scalarrepl -instcombine -break-crit-edges -condprop -tailcallelim -simplifycfg -reassociate -loopsimplify -licm -instcombine -indvars -loop-unroll -instcombine -load-vn -gcse -sccp -instcombine -break-crit-edges -condprop -dse -mergereturn -adce -simplifycfg -deadtypeelim -constmerge -verify -globalopt -constmerge -ipsccp -deadargelim -inline -instcombine -scalarrepl -globalsmodref-aa -licm -load-vn -gcse -instcombine -simplifycfg -globaldce -f -o %sentry_point_llvm1_7.bc' % (tmpdir, tmpdir)
+ print cmd
+ os.system(cmd)
+
+ cmd = "~/bin/llc %sentry_point_llvm1_7.bc -march=c -f -o %s.c" % (tmpdir, b)
+ print cmd
+ os.system(cmd)
+
+ cmd = "gcc %s.c -O2 -fomit-frame-pointer -static -lgc -lm -lpthread -pipe -o %s" % (b, b)
+ print cmd
+ os.system(cmd)
+
+ cmd = "cp %s pypy/translator/goal" % b
+ print cmd
+ os.system(cmd)
+
+
+ #
+ b = "%spypy-llvm-%s-llvm1_7_x86" % (tmpdir, revision)
+ os.system('~/bin/llc -version 2>&1')
+
+ cmd = "~/bin/llc %sentry_point_llvm1_7.bc -f -o %s.s" % (tmpdir, b)
+ print cmd
+ os.system(cmd)
+
+ cmd = "as %s.s -o %s.o" % (b, b)
+ print cmd
+ os.system(cmd)
+
+ cmd = "gcc %s.o -static -lgc -lm -lpthread -pipe -o %s" % (b, b)
+ print cmd
+ os.system(cmd)
+
+ cmd = "cp %s pypy/translator/goal" % b
+ print cmd
+ os.system(cmd)
+
+
def compile(backend):
os.chdir(homedir + '/projects/pypy-dist')
os.system('rm `find . -name *.pyc`')
@@ -23,7 +98,7 @@
os.system('rm *')
os.chdir(homedir + '/projects/pypy-dist/pypy/translator/goal')
- os.system('python translate_pypy.py --backend=%(backend)s --text --batch targetpypystandalone 2>&1' % locals())
+ os.system('/usr/local/bin/python translate_pypy.py --backend=%(backend)s --text --batch targetpypystandalone.py 2>&1' % locals())
os.chdir(homedir + '/projects/pypy-dist')
try:
@@ -39,11 +114,14 @@
os.chmod(realname, stat.S_IRWXU)
os.unlink(basename)
+ if backend == 'llvm':
+ compile_llvm_variants(revision)
+
def benchmark():
os.system('cat /proc/cpuinfo')
os.system('free')
os.chdir(homedir + '/projects/pypy-dist/pypy/translator/goal')
- os.system('python bench-unix.py 2>&1 | tee benchmark.txt' % locals())
+ os.system('/usr/local/bin/python bench-unix.py 2>&1 | tee benchmark.txt' % locals())
os.system('echo "<html><body><pre>" > benchmark.html')
os.system('cat benchmark.txt >> benchmark.html')
os.system('echo "</pre></body></html>" >> benchmark.html')
Modified: pypy/dist/pypy/translator/goal/bench-unix.py
==============================================================================
--- pypy/dist/pypy/translator/goal/bench-unix.py (original)
+++ pypy/dist/pypy/translator/goal/bench-unix.py Wed Jan 4 11:47:52 2006
@@ -24,12 +24,12 @@
pipe = os.popen(cmd + ' 2>&1')
return pipe.read()
-def run_pystone(executable='python', n=0):
+def run_pystone(executable='/usr/local/bin/python', n=0):
argstr = PYSTONE_CMD % (str(n) and n or '')
txt = run_cmd('%s -c "%s"' % (executable, argstr))
return get_result(txt, PYSTONE_PATTERN)
-def run_richards(executable='python', n=10):
+def run_richards(executable='/usr/local/bin/python', n=10):
argstr = RICHARDS_CMD % n
txt = run_cmd('%s -c "%s"' % (executable, argstr))
return get_result(txt, RICHARDS_PATTERN)
Modified: pypy/dist/pypy/translator/llvm/build_llvm_module.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/build_llvm_module.py (original)
+++ pypy/dist/pypy/translator/llvm/build_llvm_module.py Wed Jan 4 11:47:52 2006
@@ -32,10 +32,7 @@
]))
flags = os.popen("gccas /dev/null -o /dev/null -debug-pass=Arguments 2>&1").read()[17:-1].split()
-
-#if int(os.popen("opt --help 2>&1").read().find('-heap2stack')) >= 0:
-# flags.insert(flags.index("-inline")+1, "-heap2stack -debug")
-
+flags += "-globalopt -constmerge -ipsccp -deadargelim -inline -instcombine -scalarrepl -globalsmodref-aa -licm -load-vn -gcse -instcombine -simplifycfg -globaldce".split()
OPTIMIZATION_SWITCHES = " ".join(flags)
def compile_module(module, source_files, object_files, library_files):
More information about the Pypy-commit
mailing list