[pypy-svn] r15467 - pypy/dist/pypy/translator/llvm2

rxe at codespeak.net rxe at codespeak.net
Sun Jul 31 14:51:04 CEST 2005


Author: rxe
Date: Sun Jul 31 14:51:02 2005
New Revision: 15467

Modified:
   pypy/dist/pypy/translator/llvm2/codewriter.py
   pypy/dist/pypy/translator/llvm2/funcnode.py
   pypy/dist/pypy/translator/llvm2/genllvm.py
   pypy/dist/pypy/translator/llvm2/structnode.py
Log:
Mostly cosmetic stuff, either in python code or in generated llvm code.
Disabled line counting for now, as misleading with multiline constantvalue().



Modified: pypy/dist/pypy/translator/llvm2/codewriter.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/codewriter.py	(original)
+++ pypy/dist/pypy/translator/llvm2/codewriter.py	Sun Jul 31 14:51:02 2005
@@ -3,7 +3,7 @@
 from pypy.translator.llvm2.log import log 
 
 log = log.codewriter 
-show_line_numbers = True # False
+show_line_numbers = False # True
 count = count().next
 
 class CodeWriter(object): 
@@ -14,7 +14,8 @@
         if show_line_numbers:
             line = "%-75s; %d" % (line, len(self._lines) + 1)
         self._lines.append(line) 
-        log(line) 
+        #XXXlog(line) 
+        print line
 
     def comment(self, line, indent=True):
         line = ";; " + line

Modified: pypy/dist/pypy/translator/llvm2/funcnode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/funcnode.py	(original)
+++ pypy/dist/pypy/translator/llvm2/funcnode.py	Sun Jul 31 14:51:02 2005
@@ -150,7 +150,8 @@
         for op_index, op in enumerate(block.operations):
 
             # print out debug string
-            codewriter.comment(str(op))
+            codewriter.newline()
+            codewriter.comment("** %s **" % str(op))
             info = self.db.get_op2comment(op)
             if info is not None:
                 lenofopstr, opstrname = info

Modified: pypy/dist/pypy/translator/llvm2/genllvm.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/genllvm.py	(original)
+++ pypy/dist/pypy/translator/llvm2/genllvm.py	Sun Jul 31 14:51:02 2005
@@ -12,8 +12,6 @@
 from pypy.tool.udir import udir
 from pypy.translator.llvm2.codewriter import CodeWriter
 from pypy.translator.llvm2.extfuncnode import ExternalFuncNode
-from pypy.translator.backendoptimization import remove_void
-#from pypy.translator.backendoptimization import rename_extfunc_calls
 from pypy.translator.llvm2.module.extfunction import extdeclarations, \
      extfunctions, gc_boehm, gc_disabled, dependencies
 from pypy.translator.llvm2.node import LLVMNode
@@ -25,17 +23,15 @@
 class GenLLVM(object):
 
     def __init__(self, translator, debug=False, embedexterns=True):
-        LLVMNode.nodename_count = {}    #reset counters
+        # reset counters
+        LLVMNode.nodename_count = {}    
         self.db = Database(translator)
         self.translator = translator
         self.embedexterns = embedexterns
-        # transformations
-        #remove_void(translator)
-        #rename_extfunc_calls(translator)
         translator.checkgraphs()
         ExternalFuncNode.used_external_functions = {}
 
-        # For debug we create comments of every operation that may be executed
+        # for debug we create comments of every operation that may be executed
         self.debug = debug
         
     def compile(self, func=None):
@@ -43,7 +39,7 @@
             func = self.translator.entrypoint
         self.entrypoint = func
 
-        #make sure exception matching and exception type are available
+        # make sure exception matching and exception type are available
         e = self.translator.rtyper.getexceptiondata()
         for ll_helper in (e.ll_exception_match,):
             ptr = getfunctionptr(self.translator, ll_helper)
@@ -58,7 +54,6 @@
 
         self.db.setup_all()
         self.db.dump_pbcs()
-        #assert False
 
         self.entrynode = self.db.obj2node[c]
         codewriter = CodeWriter()
@@ -89,7 +84,6 @@
         for typ_decl in self.db.getnodes():
             typ_decl.writedecl(codewriter)
 
-        #import pdb ; pdb.set_trace()
         nl(); comment("Function Implementation") 
         codewriter.startimpl()
         if use_boehm_gc:
@@ -149,7 +143,7 @@
         
 def genllvm(translator, embedexterns=True):
     gen = GenLLVM(translator, embedexterns=embedexterns)
-    log.source(gen.compile())
+    gen.compile()
     return gen.create_module()
 
 def llvm_is_on_path():

Modified: pypy/dist/pypy/translator/llvm2/structnode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/structnode.py	(original)
+++ pypy/dist/pypy/translator/llvm2/structnode.py	Sun Jul 31 14:51:02 2005
@@ -143,7 +143,7 @@
         """ Returns the constant representation for this node. """
         values = self._getvalues()
         all_values = ",\n  ".join(values)
-        return "%s {\n  %s\n  }\n\n" % (self.get_typerepr(), all_values)
+        return "%s {\n  %s\n  }\n" % (self.get_typerepr(), all_values)
                 
     # ______________________________________________________________________
     # main entry points from genllvm 
@@ -201,7 +201,6 @@
         return "{%s}" % ", ".join(types_repr)
          
     def get_ref(self):
-        #XXX Is this right?
         ref = super(StructVarsizeNode, self).get_ref()
         typeval = self.db.repr_arg_type(lltype.typeOf(self.value))
         ref = "cast (%s* %s to %s*)" % (self.get_typerepr(),



More information about the Pypy-commit mailing list