[pypy-commit] pypy libgccjit-backend: Add initial comment to IR. WIP on emit methods

dmalcolm noreply at buildbot.pypy.org
Wed Dec 17 17:48:35 CET 2014


Author: David Malcolm <dmalcolm at redhat.com>
Branch: libgccjit-backend
Changeset: r74981:f58bfe1daf4d
Date: 2014-12-16 11:49 -0500
http://bitbucket.org/pypy/pypy/changeset/f58bfe1daf4d/

Log:	Add initial comment to IR. WIP on emit methods

diff --git a/rpython/jit/backend/libgccjit/assembler.py b/rpython/jit/backend/libgccjit/assembler.py
--- a/rpython/jit/backend/libgccjit/assembler.py
+++ b/rpython/jit/backend/libgccjit/assembler.py
@@ -173,6 +173,16 @@
 
         self.b_current = self.fn.new_block()
 
+        # Add an initial comment summarizing the loop
+        text = '\n\tinputargs: %s\n\n' % inputargs
+        for op in operations:
+            print(op)
+            print(type(op))
+            print(dir(op))
+            print(repr(op.getopname()))
+            text += '\t%s\n' % op
+        self.b_current.add_comment(str(text))
+    
         # Get initial values from input args:
         for idx, arg in enumerate(inputargs):
             self.b_current.add_comment("inputargs[%i]: %s" % (idx, arg))
@@ -189,7 +199,7 @@
             self.b_current.add_comment(str(op))
 
             # Compile the operation itself...
-            methname = '_emit_%s' % op.getopname()
+            methname = 'emit_%s' % op.getopname()
             getattr(self, methname) (op)
 
         
@@ -250,7 +260,7 @@
 
     # Handling of specific ResOperation subclasses
 
-    def _emit_int_add(self, op):
+    def emit_int_add(self, op):
         """
         print(op._arg0)
         print(op._arg1)
@@ -267,7 +277,25 @@
                                     rval0, rval1))
         self.b_current.add_assignment(lvalres, op_add)
 
-    def _emit_finish(self, op):
+    """
+    def emit_label(self, op):
+        print(op)
+        print(op.__dict__)
+
+    def emit_int_le(self, op):
+        print(op)
+        print(op.__dict__)
+
+    def emit_int_ge(self, op):
+        print(op)
+        print(op.__dict__)
+
+    def emit_guard_true(self, op):
+        print(op)
+        print(op.__dict__)
+    """
+
+    def emit_finish(self, op):
         # Write outputs back:
         for idx, arg in enumerate(op._args):
             #self.b_current.add_comment("  op._args[%i]: %s" % (idx, arg))


More information about the pypy-commit mailing list