[pypy-svn] r40182 - pypy/dist/pypy/translator/backendopt
xoraxax at codespeak.net
xoraxax at codespeak.net
Sat Mar 10 20:19:19 CET 2007
Author: xoraxax
Date: Sat Mar 10 20:19:15 2007
New Revision: 40182
Modified:
pypy/dist/pypy/translator/backendopt/all.py
pypy/dist/pypy/translator/backendopt/inline.py
pypy/dist/pypy/translator/backendopt/malloc.py
pypy/dist/pypy/translator/backendopt/merge_if_blocks.py
pypy/dist/pypy/translator/backendopt/removeassert.py
pypy/dist/pypy/translator/backendopt/removenoops.py
pypy/dist/pypy/translator/backendopt/support.py
Log:
Make backendopts less chatty if verbose is false.
Modified: pypy/dist/pypy/translator/backendopt/all.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/all.py (original)
+++ pypy/dist/pypy/translator/backendopt/all.py Sat Mar 10 20:19:15 2007
@@ -116,7 +116,7 @@
if config.merge_if_blocks:
for graph in graphs:
- merge_if_blocks(graph)
+ merge_if_blocks(graph, translator.config.translation.verbose)
if config.print_statistics:
print "after if-to-switch:"
@@ -151,6 +151,7 @@
# vaporize mallocs
if config.mallocs:
+ log.malloc("starting malloc removal")
remove_mallocs(translator, graphs, type_system)
if config.print_statistics:
Modified: pypy/dist/pypy/translator/backendopt/inline.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/inline.py (original)
+++ pypy/dist/pypy/translator/backendopt/inline.py Sat Mar 10 20:19:15 2007
@@ -704,7 +704,10 @@
heappop(heap)
if callers[graph]:
- log.inlining('%7.2f %50s' % (weight, graph.name))
+ if translator.config.translation.verbose:
+ log.inlining('%7.2f %50s' % (weight, graph.name))
+ else:
+ log.dot()
for parentgraph in callers[graph]:
if parentgraph == graph:
continue
Modified: pypy/dist/pypy/translator/backendopt/malloc.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/malloc.py (original)
+++ pypy/dist/pypy/translator/backendopt/malloc.py Sat Mar 10 20:19:15 2007
@@ -29,6 +29,9 @@
SUBSTRUCT_ACCESS = {}
CHECK_ARRAY_INDEX = {}
+ def __init__(self, verbose=True):
+ self.verbose = verbose
+
def get_STRUCT(self, TYPE):
raise NotImplementedError
@@ -301,7 +304,10 @@
while True:
count = self.remove_mallocs_once(graph)
if count:
- log.malloc('%d simple mallocs removed in %r' % (count, graph.name))
+ if self.verbose:
+ log.malloc('%d simple mallocs removed in %r' % (count, graph.name))
+ else:
+ log.dot()
tot += count
else:
break
@@ -597,11 +603,11 @@
def insert_keepalives(self, newvars):
pass
-def remove_simple_mallocs(graph, type_system='lltypesystem'):
+def remove_simple_mallocs(graph, type_system='lltypesystem', verbose=True):
if type_system == 'lltypesystem':
- remover = LLTypeMallocRemover()
+ remover = LLTypeMallocRemover(verbose)
else:
- remover = OOTypeMallocRemover()
+ remover = OOTypeMallocRemover(verbose)
return remover.remove_simple_mallocs(graph)
@@ -610,7 +616,7 @@
graphs = translator.graphs
tot = 0
for graph in graphs:
- count = remove_simple_mallocs(graph, type_system=type_system)
+ count = remove_simple_mallocs(graph, type_system=type_system, verbose=translator.config.translation.verbose)
if count:
# remove typical leftovers from malloc removal
removenoops.remove_same_as(graph)
Modified: pypy/dist/pypy/translator/backendopt/merge_if_blocks.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/merge_if_blocks.py (original)
+++ pypy/dist/pypy/translator/backendopt/merge_if_blocks.py Sat Mar 10 20:19:15 2007
@@ -105,9 +105,12 @@
checkgraph(graph)
return True
-def merge_if_blocks(graph):
+def merge_if_blocks(graph, verbose=True):
merge = False
while merge_if_blocks_once(graph):
merge = True
if merge:
- log("merging blocks in %s" % (graph.name, ))
+ if verbose:
+ log("merging blocks in %s" % (graph.name, ))
+ else:
+ log.dot()
Modified: pypy/dist/pypy/translator/backendopt/removeassert.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/removeassert.py (original)
+++ pypy/dist/pypy/translator/backendopt/removeassert.py Sat Mar 10 20:19:15 2007
@@ -32,7 +32,8 @@
if count:
# now melt away the (hopefully) dead operation that compute
# the condition
- log.removeassert("removed %d asserts in %s" % (count, graph.name))
+ if translator.config.translation.verbose:
+ log.removeassert("removed %d asserts in %s" % (count, graph.name))
checkgraph(graph)
transform_dead_op_vars(graph, translator)
Modified: pypy/dist/pypy/translator/backendopt/removenoops.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/removenoops.py (original)
+++ pypy/dist/pypy/translator/backendopt/removenoops.py Sat Mar 10 20:19:15 2007
@@ -96,8 +96,9 @@
else:
for arg in op.args:
used[arg] = True
- log.removecasts(
- "removed %s cast_pointers in %s" % (num_removed, graph.name))
+ if translator.config.translation.verbose:
+ log.removecasts(
+ "removed %s cast_pointers in %s" % (num_removed, graph.name))
return num_removed
def remove_superfluous_keep_alive(graph):
Modified: pypy/dist/pypy/translator/backendopt/support.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/support.py (original)
+++ pypy/dist/pypy/translator/backendopt/support.py Sat Mar 10 20:19:15 2007
@@ -8,9 +8,11 @@
from pypy.objspace.flow.model import Constant, Variable, SpaceOperation, c_last_exception
from pypy.rpython.lltypesystem import lltype
+
log = py.log.Producer("backendopt")
py.log.setconsumer("backendopt", ansi_log)
+
def graph_operations(graph):
for block in graph.iterblocks():
for op in block.operations:
More information about the Pypy-commit
mailing list