[pypy-svn] r17715 - in pypy/dist/pypy/translator/llvm: . module
ericvrp at codespeak.net
ericvrp at codespeak.net
Wed Sep 21 14:59:17 CEST 2005
Author: ericvrp
Date: Wed Sep 21 14:59:16 2005
New Revision: 17715
Modified:
pypy/dist/pypy/translator/llvm/build_llvm_module.py
pypy/dist/pypy/translator/llvm/exception.py
pypy/dist/pypy/translator/llvm/funcnode.py
pypy/dist/pypy/translator/llvm/genllvm.py
pypy/dist/pypy/translator/llvm/module/support.py
Log:
remaning files for exceptionpolicy
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 Sep 21 14:59:16 2005
@@ -95,7 +95,7 @@
cmds.append("llc %s %s.bc -march=c -f -o %s.c" % (genllvm.exceptionpolicy.llc_options(), b, b))
if exe_name:
#XXX TODO: use CFLAGS when available
- cmds.append("gcc %s.c -c -O2 -fomit-frame-pointer -pipe" % (b,))
+ cmds.append("gcc %s.c -c -O2 -fomit-frame-pointer -march=pentium4 -ffast-math -pipe" % (b,))
cmds.append("gcc %s.o %s -lm -ldl -pipe -o %s" % (b, gc_libs, exe_name))
source_files.append("%s.c" % b)
Modified: pypy/dist/pypy/translator/llvm/exception.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/exception.py (original)
+++ pypy/dist/pypy/translator/llvm/exception.py Wed Sep 21 14:59:16 2005
@@ -29,7 +29,7 @@
def new(exceptionpolicy=None): #factory
if exceptionpolicy is None:
- exceptionpolicy = 'cpython'
+ exceptionpolicy = 'fast'
if exceptionpolicy == 'cpython':
from pypy.translator.llvm.exception import CPythonExceptionPolicy
exceptionpolicy = CPythonExceptionPolicy()
Modified: pypy/dist/pypy/translator/llvm/funcnode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/funcnode.py (original)
+++ pypy/dist/pypy/translator/llvm/funcnode.py Wed Sep 21 14:59:16 2005
@@ -2,10 +2,10 @@
from pypy.objspace.flow.model import Block, Constant, Variable, Link
from pypy.objspace.flow.model import flatten, mkentrymap, traverse, last_exception
from pypy.rpython import lltype
-from pypy.translator.unsimplify import remove_double_links
from pypy.translator.llvm.node import LLVMNode, ConstantLLVMNode
from pypy.translator.llvm.opwriter import OpWriter
from pypy.translator.llvm.log import log
+from pypy.translator.unsimplify import remove_double_links
log = log.funcnode
class FuncTypeNode(LLVMNode):
@@ -16,7 +16,7 @@
assert isinstance(type_, lltype.FuncType)
self.type_ = type_
self.ref = self.make_ref('%functiontype', '')
-
+
def __str__(self):
return "<FuncTypeNode %r>" % self.ref
@@ -37,9 +37,7 @@
self.value = value
self.ref = self.make_ref('%pypy_', value.graph.name)
self.graph = value.graph
- # XXX the following needs to be done in advance (e.g. for inlining)
- #backend_optimizations(self.graph, opt_SSI_to_SSA=False)
- remove_double_links(self.db.translator, self.graph)
+ remove_double_links(self.db.translator, self.graph)
def __str__(self):
return "<FuncNode %r>" %(self.ref,)
@@ -207,33 +205,5 @@
inputarg = self.db.repr_arg(block.inputargs[0])
codewriter.ret(inputargtype, inputarg)
- def _is_raise_new_exception(self, block):
- is_raise_new = False
- entrylinks = mkentrymap(self.graph)[block]
- entrylinks = [x for x in entrylinks if x.prevblock is not None]
- inputargs = self.db.repr_arg_multi(block.inputargs)
- for i, arg in enumerate(inputargs):
- names = self.db.repr_arg_multi([link.args[i] for link in entrylinks])
- for name in names: #These tests-by-name are a bit yikes, but I don't see a better way right now
- if not name.startswith('%last_exception_') and not name.startswith('%last_exc_value_'):
- is_raise_new = True
- return is_raise_new
-
def write_exceptblock(self, codewriter, block):
- assert len(block.inputargs) == 2
-
- if self._is_raise_new_exception(block):
- self.write_block_phi_nodes(codewriter, block)
-
- inputargs = self.db.repr_arg_multi(block.inputargs)
- inputargtypes = self.db.repr_arg_type_multi(block.inputargs)
-
- codewriter.store(inputargtypes[0], inputargs[0], '%last_exception_type')
- codewriter.store(inputargtypes[1], inputargs[1], '%last_exception_value')
- else:
- codewriter.comment('reraise last exception')
- #Reraising last_exception.
- #Which is already stored in the global variables.
- #So nothing needs to happen here!
-
- codewriter.unwind()
+ codewriter.genllvm.exceptionpolicy.write_exceptblock(self, codewriter, block)
Modified: pypy/dist/pypy/translator/llvm/genllvm.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/genllvm.py (original)
+++ pypy/dist/pypy/translator/llvm/genllvm.py Wed Sep 21 14:59:16 2005
@@ -22,7 +22,6 @@
from pypy.translator.llvm.externs2ll import post_setup_externs, generate_llfile
from pypy.translator.llvm.gc import GcPolicy
from pypy.translator.llvm.exception import ExceptionPolicy
-
from pypy.translator.translator import Translator
@@ -40,11 +39,11 @@
self.translator = translator
self.gcpolicy = gcpolicy
self.exceptionpolicy = exceptionpolicy
- translator.checkgraphs()
extfuncnode.ExternalFuncNode.used_external_functions = {}
-
- # for debug we create comments of every operation that may be executed
- self.debug = debug
+ self.debug = debug # for debug we create comments of every operation that may be executed
+ exceptionpolicy.transform(translator)
+ if debug:
+ translator.checkgraphs()
def _checkpoint(self, msg=None):
if self.debug:
@@ -256,8 +255,7 @@
a.simplify()
t.specialize()
t.backend_optimizations(ssa_form=False)
- t.checkgraphs()
- if view:
+ if view: #note: this is without policy transforms
t.view()
return genllvm(t, **kwds)
Modified: pypy/dist/pypy/translator/llvm/module/support.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/module/support.py (original)
+++ pypy/dist/pypy/translator/llvm/module/support.py Wed Sep 21 14:59:16 2005
@@ -97,7 +97,7 @@
%%exception_type = load %%RPYTHON_EXCEPTION_VTABLE** %%tmp
store %%RPYTHON_EXCEPTION_VTABLE* %%exception_type, %%RPYTHON_EXCEPTION_VTABLE** %%last_exception_type
store %%RPYTHON_EXCEPTION* %%exception_value, %%RPYTHON_EXCEPTION** %%last_exception_value
- unwind
+ ret void ; XXX unwind ; (1)
}
""" % locals())
@@ -109,7 +109,7 @@
br bool %%cond, label %%is_0, label %%is_not_0
is_0:
call fastcc void %%prepare_ZeroDivisionError()
- unwind
+ br label %%is_not_0 ; XXX unwind ; (2)
is_not_0:
"""
@@ -132,7 +132,7 @@
; br bool %cond3, label %return_block, label %ovf3
;ovf3:
call fastcc void %prepare_OverflowError()
- unwind
+ ret int 0 ; XXX unwind ; (3)
"""
More information about the Pypy-commit
mailing list