[pypy-commit] pypy libgccjit-backend: WIP: Add comments describing each ResOperation into the libgccjit IR

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


Author: David Malcolm <dmalcolm at redhat.com>
Branch: libgccjit-backend
Changeset: r74976:f6a3bd3f6dbb
Date: 2014-12-15 12:56 -0500
http://bitbucket.org/pypy/pypy/changeset/f6a3bd3f6dbb/

Log:	WIP: Add comments describing each ResOperation into the libgccjit IR

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
@@ -93,11 +93,19 @@
 
         self.b_current = self.lib.gcc_jit_function_new_block(self.fn, NULL)
 
-        for op in operations:
+        for op in operations:       
             print(op)
             print(type(op))
             print(dir(op))
             print(repr(op.getopname()))
+            # Add a comment describing this ResOperation
+            comment_text = str2charp(str(op))
+            self.lib.gcc_jit_block_add_comment(self.b_current,
+                                               self.lib.null_location_ptr,
+                                               comment_text)
+            free_charp(comment_text)
+
+            # Compile the operation itself...
             methname = '_on_%s' % op.getopname()
             getattr(self, methname) (op)
 
diff --git a/rpython/jit/backend/libgccjit/rffi_bindings.py b/rpython/jit/backend/libgccjit/rffi_bindings.py
--- a/rpython/jit/backend/libgccjit/rffi_bindings.py
+++ b/rpython/jit/backend/libgccjit/rffi_bindings.py
@@ -175,6 +175,10 @@
                                                   self.GCC_JIT_LVALUE_P,
                                                   self.GCC_JIT_RVALUE_P]),
                 (lltype.Void,
+                 'gcc_jit_block_add_comment', [self.GCC_JIT_BLOCK_P,
+                                               self.GCC_JIT_LOCATION_P,
+                                               CCHARP]),
+                (lltype.Void,
                  'gcc_jit_block_end_with_return', [self.GCC_JIT_BLOCK_P,
                                                    self.GCC_JIT_LOCATION_P,
                                                    self.GCC_JIT_RVALUE_P]),


More information about the pypy-commit mailing list