[pypy-svn] r68069 - pypy/branch/floats-via-sse2/pypy/jit/backend/x86

fijal at codespeak.net fijal at codespeak.net
Wed Sep 30 23:46:46 CEST 2009


Author: fijal
Date: Wed Sep 30 23:46:45 2009
New Revision: 68069

Modified:
   pypy/branch/floats-via-sse2/pypy/jit/backend/x86/assembler.py
Log:
Refactor calling style so it contains MOVs instead of PUSHes.
Gcc does that and besides, it makes it easier to put XMM regs there.


Modified: pypy/branch/floats-via-sse2/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/floats-via-sse2/pypy/jit/backend/x86/assembler.py	(original)
+++ pypy/branch/floats-via-sse2/pypy/jit/backend/x86/assembler.py	Wed Sep 30 23:46:45 2009
@@ -771,12 +771,24 @@
         size = sizeloc.value
         nargs = len(op.args)-1
         extra_on_stack = self.align_stack_for_call(nargs)
-        for i in range(nargs+1, 1, -1):
-            self.mc.PUSH(arglocs[i])
+        self.mc.SUB(esp, imm(WORD * extra_on_stack))
         if isinstance(op.args[0], Const):
             x = rel32(op.args[0].getint())
         else:
             x = arglocs[1]
+        if x is eax:
+            tmp = ecx
+        else:
+            tmp = eax
+        for i in range(2, nargs + 2):
+            loc = arglocs[i]
+            if isinstance(loc, REG):
+                self.mc.MOV(mem(esp, WORD * (i - 2)), loc)
+        for i in range(2, nargs + 2):
+            loc = arglocs[i]
+            if not isinstance(loc, REG):
+                self.mc.MOV(tmp, loc)
+                self.mc.MOV(mem(esp, WORD * (i - 2)), tmp)
         self.mc.CALL(x)
         self.mark_gc_roots()
         self.mc.ADD(esp, imm(WORD * extra_on_stack))



More information about the Pypy-commit mailing list