[pypy-svn] r10361 - pypy/dist/pypy/translator/llvm
cfbolz at codespeak.net
cfbolz at codespeak.net
Wed Apr 6 14:00:33 CEST 2005
Author: cfbolz
Date: Wed Apr 6 14:00:33 2005
New Revision: 10361
Modified:
pypy/dist/pypy/translator/llvm/classrepr.py
pypy/dist/pypy/translator/llvm/funcrepr.py
pypy/dist/pypy/translator/llvm/genllvm.py
Log:
Fixed a LLVM code creation bug + cosmetics.
Modified: pypy/dist/pypy/translator/llvm/classrepr.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/classrepr.py (original)
+++ pypy/dist/pypy/translator/llvm/classrepr.py Wed Apr 6 14:00:33 2005
@@ -194,6 +194,15 @@
raise CompileError, ("setattr called with unknown attribute %s" % \
args[1].value)
+ def t_op_type(self, l_target, args, lblock, l_func):
+ l_args0 = self.gen.get_repr(args[0])
+ l_func.dependencies.add(l_args0)
+ l_tmp = self.gen.get_local_tmp(
+ PointerTypeRepr("%std.class*", self.gen), l_func)
+ lblock.getelementptr(l_tmp, l_args0, [0, 0])
+ lblock.load(l_target, l_tmp)
+
+
def iter_subclasses(self):
for cls, classdef in self.classdef.subdefs.iteritems():
l_cls = self.gen.get_repr(classdef)
Modified: pypy/dist/pypy/translator/llvm/funcrepr.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/funcrepr.py (original)
+++ pypy/dist/pypy/translator/llvm/funcrepr.py Wed Apr 6 14:00:33 2005
@@ -13,7 +13,7 @@
from pypy.translator.llvm.representation import debug, LLVMRepr, CompileError
from pypy.translator.llvm.typerepr import TypeRepr, PointerTypeRepr
-debug = True
+debug = False
INTRINSIC_OPS = ["lt", "le", "eq", "ne", "gt", "ge", "is_", "is_true", "len",
"neg", "pos", "invert", "add", "sub", "mul", "truediv",
@@ -168,7 +168,8 @@
class BlockRepr(object):
def __init__(self, l_func, pyblock, gen):
- print "BlockRepr"
+ if debug:
+ print "BlockRepr"
self.l_func = l_func
self.pyblock = pyblock
self.gen = gen
@@ -225,7 +226,8 @@
raise CompileError, s
def create_terminator_instr(self):
- print "create_terminator_instr"
+ if debug:
+ print "create_terminator_instr"
pyblock = self.pyblock
l_func = self.l_func
l_link = LinkRepr.get_link(pyblock.exits[0], l_func, self.gen)
@@ -253,7 +255,8 @@
class TryBlockRepr(BlockRepr):
def __init__(self, l_func, pyblock, gen):
- print "TryBlockRepr"
+ if debug:
+ print "TryBlockRepr"
self.l_func = l_func
self.pyblock = pyblock
self.gen = gen
@@ -369,8 +372,8 @@
self.gen),
self.l_func)
self.l_func.dependencies.update([l_tmp1, l_tmp2])
- self.lblock.load(self.l_args[0], l_tmp1)
- self.lblock.load(self.l_args[1], l_tmp2)
+ self.lblock.load(l_tmp1, self.l_args[0])
+ self.lblock.load(l_tmp2, self.l_args[1])
self.l_args[0] = l_tmp1
self.l_args[1] = l_tmp2
for i, (l_a, l_ta) in enumerate(zip(self.l_args, self.l_targetargs)):
@@ -552,7 +555,8 @@
if clsdef.cls.__dict__.has_key(name):
l_method = self.gen.get_repr(clsdef.cls.__dict__[name])
args[0] = l_method
- print l_method.llvmname(), l_method
+ if debug:
+ print l_method.llvmname(), l_method
l_method.op_simple_call(l_target, args, lblock, l_func)
return
if l_args[1].llvmtype() != self.l_args[0].llvmtype():
Modified: pypy/dist/pypy/translator/llvm/genllvm.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/genllvm.py (original)
+++ pypy/dist/pypy/translator/llvm/genllvm.py Wed Apr 6 14:00:33 2005
@@ -175,4 +175,3 @@
yield l_dep1
yield l_repr
-
More information about the Pypy-commit
mailing list