[pypy-svn] r38058 - in pypy/branch/jit-virtual-world/pypy/jit/codegen: . dump i386 llgraph

arigo at codespeak.net arigo at codespeak.net
Wed Feb 7 13:29:53 CET 2007


Author: arigo
Date: Wed Feb  7 13:29:43 2007
New Revision: 38058

Modified:
   pypy/branch/jit-virtual-world/pypy/jit/codegen/dump/rgenop.py
   pypy/branch/jit-virtual-world/pypy/jit/codegen/i386/operation.py
   pypy/branch/jit-virtual-world/pypy/jit/codegen/i386/rgenop.py
   pypy/branch/jit-virtual-world/pypy/jit/codegen/llgraph/rgenop.py
   pypy/branch/jit-virtual-world/pypy/jit/codegen/model.py
Log:
(pedronis, arre, arigo)

Allow places with no initial value, to avoid a pointless store.


Modified: pypy/branch/jit-virtual-world/pypy/jit/codegen/dump/rgenop.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/codegen/dump/rgenop.py	(original)
+++ pypy/branch/jit-virtual-world/pypy/jit/codegen/dump/rgenop.py	Wed Feb  7 13:29:43 2007
@@ -293,13 +293,13 @@
             self.rgenop.vlistname(vars_gv)))
         return info
 
-    def alloc_frame_place(self, kind, gv_initial_value):
+    def alloc_frame_place(self, kind, gv_initial_value=None):
         place = self.llbuilder.alloc_frame_place(kind, gv_initial_value)
         self.dump("%s = %s.alloc_frame_place(%s, %s)" % (
             place,
             self.name,
             self.rgenop.kindtokenname(kind),
-            self.rgenop.vname(gv_initial_value)))
+            gv_initial_value and self.rgenop.vname(gv_initial_value)))
         return place
 
     def genop_absorb_place(self, kind, place):

Modified: pypy/branch/jit-virtual-world/pypy/jit/codegen/i386/operation.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/codegen/i386/operation.py	(original)
+++ pypy/branch/jit-virtual-world/pypy/jit/codegen/i386/operation.py	Wed Feb  7 13:29:43 2007
@@ -35,6 +35,11 @@
     def generate(self, allocator):
         raise NotImplementedError
 
+class OpWhatever(Operation):
+    clobbers_cc = False
+    def generate(self, allocator):
+        pass
+
 class Op1(Operation):
     def __init__(self, x):
         self.x = x
@@ -46,7 +51,7 @@
         except KeyError:
             return    # result not used
         srcop = allocator.get_operand(self.x)
-        return self.generate2(allocator.mc, dstop, srcop)
+        self.generate2(allocator.mc, dstop, srcop)
     def generate2(self, mc, dstop, srcop):
         raise NotImplementedError
 

Modified: pypy/branch/jit-virtual-world/pypy/jit/codegen/i386/rgenop.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/codegen/i386/rgenop.py	(original)
+++ pypy/branch/jit-virtual-world/pypy/jit/codegen/i386/rgenop.py	Wed Feb  7 13:29:43 2007
@@ -518,10 +518,13 @@
             result.append(v)
         return result
 
-    def alloc_frame_place(self, kind, gv_initial_value):
+    def alloc_frame_place(self, kind, gv_initial_value=None):
         if self.force_in_stack is None:
             self.force_in_stack = []
-        v = OpSameAs(gv_initial_value)
+        if gv_initial_value is None:
+            v = OpWhatever()
+        else:
+            v = OpSameAs(gv_initial_value)
         self.operations.append(v)
         place = Place()
         place.stackvar = v

Modified: pypy/branch/jit-virtual-world/pypy/jit/codegen/llgraph/rgenop.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/codegen/llgraph/rgenop.py	(original)
+++ pypy/branch/jit-virtual-world/pypy/jit/codegen/llgraph/rgenop.py	Wed Feb  7 13:29:43 2007
@@ -326,9 +326,11 @@
                      "get_frame_info: bad currently_writing")
         return llimpl.get_frame_info(self.b, vars)
 
-    def alloc_frame_place(self, gv_TYPE, gv_initial_value):
+    def alloc_frame_place(self, gv_TYPE, gv_initial_value=None):
         debug_assert(self.rgenop.currently_writing is self,
                      "alloc_frame_place: bad currently_writing")
+        if gv_initial_value is None:
+            gv_initial_value = self.rgenop.genzeroconst(gv_TYPE)
         gv_initial_value = llimpl.cast(self.b, gv_TYPE.v, gv_initial_value.v)
         v = LLVar(llimpl.genop(self.b, 'same_as', [gv_initial_value],
                                gv_TYPE.v))

Modified: pypy/branch/jit-virtual-world/pypy/jit/codegen/model.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/codegen/model.py	(original)
+++ pypy/branch/jit-virtual-world/pypy/jit/codegen/model.py	Wed Feb  7 13:29:43 2007
@@ -196,7 +196,7 @@
         '''
         raise NotImplementedError
 
-    def alloc_frame_place(self, kind, gv_initial_value):
+    def alloc_frame_place(self, kind, gv_initial_value=None):
         '''Reserve a "place" in the frame stack where called functions
         can write to, with write_frame_place().  The place is not valid
         any more after the current basic block.
@@ -481,7 +481,7 @@
     def get_frame_info(self, vars_gv):
         return None
 
-    def alloc_frame_place(self, kind, gv_initial_value):
+    def alloc_frame_place(self, kind, gv_initial_value=None):
         return None
 
     def genop_absorb_place(self, kind, place):



More information about the Pypy-commit mailing list