[pypy-svn] r17940 - in pypy/dist/pypy/translator: backendopt backendopt/test llvm

ericvrp at codespeak.net ericvrp at codespeak.net
Wed Sep 28 13:18:00 CEST 2005


Author: ericvrp
Date: Wed Sep 28 13:17:58 2005
New Revision: 17940

Removed:
   pypy/dist/pypy/translator/backendopt/removezerobytemalloc.py
   pypy/dist/pypy/translator/backendopt/test/test_removezerobytemalloc.py
Modified:
   pypy/dist/pypy/translator/backendopt/all.py
   pypy/dist/pypy/translator/llvm/build_llvm_module.py
   pypy/dist/pypy/translator/llvm/genllvm.py
   pypy/dist/pypy/translator/llvm/opwriter.py
Log:
removal of unused code like remove zero byte malloc transformation


Modified: pypy/dist/pypy/translator/backendopt/all.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/all.py	(original)
+++ pypy/dist/pypy/translator/backendopt/all.py	Wed Sep 28 13:17:58 2005
@@ -4,26 +4,19 @@
 from pypy.translator.backendopt.malloc import remove_simple_mallocs
 from pypy.translator.backendopt.ssa import SSI_to_SSA
 from pypy.translator.backendopt.propagate import propagate_all
-from pypy.translator.backendopt.removezerobytemalloc import remove_zero_byte_mallocs
 from pypy.translator import simplify
 
 
 def backend_optimizations(translator, inline_threshold=1,
                                       mallocs=True,
                                       ssa_form=True,
-                                      propagate=False,
-                                      removezerobytemallocs=False):
+                                      propagate=False):
     # remove obvious no-ops
     for graph in translator.flowgraphs.values():
         remove_same_as(graph)
         simplify.eliminate_empty_blocks(graph)
         simplify.transform_dead_op_vars(graph, translator)
 
-    # remove allocation of empty structs
-    if removezerobytemallocs:
-        for graph in translator.flowgraphs.values():
-            remove_zero_byte_mallocs(graph)
-
     # ...
     if propagate:
         propagate_all(translator)

Modified: pypy/dist/pypy/translator/llvm/build_llvm_module.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/build_llvm_module.py	(original)
+++ pypy/dist/pypy/translator/llvm/build_llvm_module.py	Wed Sep 28 13:17:58 2005
@@ -88,6 +88,9 @@
     if not use_gcc:
         cmds.append("llc %s %s.bc -f -o %s.s" % (genllvm.exceptionpolicy.llc_options(), b, b))
         cmds.append("as %s.s -o %s.o" % (b, b))
+        if exe_name:
+            cmd = "gcc %s.o %s -lm -ldl -pipe -o %s" % (b, gc_libs, exe_name)
+            cmds.append(cmd)
         object_files.append("%s.o" % b)
     else:
         cmds.append("llc %s %s.bc -march=c -f -o %s.c" % (genllvm.exceptionpolicy.llc_options(), b, b))

Modified: pypy/dist/pypy/translator/llvm/genllvm.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/genllvm.py	(original)
+++ pypy/dist/pypy/translator/llvm/genllvm.py	Wed Sep 28 13:17:58 2005
@@ -253,7 +253,7 @@
     a = t.annotate(annotation)
     a.simplify()
     t.specialize()
-    t.backend_optimizations(ssa_form=False, propagate=False, removezerobytemallocs=False)
+    t.backend_optimizations(ssa_form=False)
     if view:    #note: this is without policy transforms
         t.view()
     return genllvm(t, **kwds)

Modified: pypy/dist/pypy/translator/llvm/opwriter.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/opwriter.py	(original)
+++ pypy/dist/pypy/translator/llvm/opwriter.py	Wed Sep 28 13:17:58 2005
@@ -390,11 +390,6 @@
     def malloc(self, op): 
         arg_type = op.args[0].value
         targetvar = self.db.repr_arg(op.result) 
-        if isinstance(arg_type, lltype.Struct) and arg_type._names_without_voids() == []:
-            t = self.db.repr_arg_type(op.result)
-            self.codewriter.cast(targetvar, t, 'null', t)
-            self.codewriter.comment('removed malloc(%s) from previous line' % t)
-            return
         type_ = self.db.repr_type(arg_type)
         self.codewriter.malloc(targetvar, type_, atomic=arg_type._is_atomic())
 



More information about the Pypy-commit mailing list