changeset 47:961d8bf9b00c

Added a debug switch.
author Janus Dam Nielsen <janus.nielsen@alexandra.dk>
date Tue, 26 May 2009 16:14:45 +0200
parents 53d7060adc77
children 61c65f00b8ef
files pysmcl/range_analysis.py
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/range_analysis.py	Tue May 26 16:13:42 2009 +0200
+++ b/pysmcl/range_analysis.py	Tue May 26 16:14:45 2009 +0200
@@ -3,6 +3,8 @@
 
 from pysmcl import flow
 
+debug = False
+
 class Bottom(object):
     
     def __eq__(self, other):
@@ -22,16 +24,19 @@
         flow.analyze(function, self.join, self.combine, self.key, lambda : {})
 
     def join(self, in_nodes):
-        print "Join"
+        if debug:
+            print "Join"
         env = {}
         for n in in_nodes:
-            print "Joining: %s" % n
+            if debug:
+                print "Joining: %s" % n
             env = combine_env(env, n.out_values[self.key])
         return env
 
     def combine(self, node, env):
-        print "========= Combining ==========="
-        print "Node, env", node, env
+        if debug:
+            print "========= Combining ==========="
+            print "Node, env", node, env
 
         class Visitor(ast.NodeVisitor):
 
@@ -55,8 +60,9 @@
                 return env
 
         r = Visitor(self.prime).visit(node)
-        print "Result of combination", r
-        print ""
+        if debug:
+            print "Result of combination", r
+            print ""
         return r