diff libinterp/interp-core/jit-ir.h @ 15602:f3e339aee38f

Fix block labeling in JIT debug output * jit-ir.cc (jit_block_list::label): New function. (jit_block::label, jit_block::print): Implementation moved to cc file. * jit-ir.h (jit_block_list::label): New function delcaration. (jit_block::label, jit_block::print): Implementation moved to cc file. (jit_block::print): Make it clear when a block has not been labeled. * pt-jit.cc (jit_inter::inter, jit_infer::construct_ssa, jit_function_info::jit_function_info, jit_info::compile): Use jit_block_list::label.
author Max Brister <max@2bass.com>
date Sun, 04 Nov 2012 20:09:23 -0700
parents a7b22144318a
children 44272909d926
line wrap: on
line diff
--- a/libinterp/interp-core/jit-ir.h	Mon Nov 05 01:48:23 2012 +0000
+++ b/libinterp/interp-core/jit-ir.h	Sun Nov 04 20:09:23 2012 -0700
@@ -169,6 +169,8 @@
 
   void insert_before (jit_block *loc, jit_block *ablock);
 
+  void label (void);
+
   std::ostream& print (std::ostream& os, const std::string& header) const;
 
   std::ostream& print_dom (std::ostream& os) const;
@@ -654,19 +656,7 @@
     label (mvisit_count, number);
   }
 
-  void label (size_t avisit_count, size_t& number)
-  {
-    if (visited (avisit_count))
-      return;
-
-    for (jit_use *use = first_use (); use; use = use->next ())
-      {
-        jit_block *pred = use->user_parent ();
-        pred->label (avisit_count, number);
-      }
-
-    mid = number++;
-  }
+  void label (size_t avisit_count, size_t& number);
 
   // See for idom computation algorithm
   // Cooper, Keith D.; Harvey, Timothy J; and Kennedy, Ken (2001).
@@ -704,26 +694,7 @@
   // call pop_varaible on all instructions
   void pop_all (void);
 
-  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const
-  {
-    print_indent (os, indent);
-    short_print (os) << ":        %pred = ";
-    for (jit_use *use = first_use (); use; use = use->next ())
-      {
-        jit_block *pred = use->user_parent ();
-        os << *pred;
-        if (use->next ())
-          os << ", ";
-      }
-    os << std::endl;
-
-    for (const_iterator iter = begin (); iter != end (); ++iter)
-      {
-        jit_instruction *instr = *iter;
-        instr->print (os, indent + 1) << std::endl;
-      }
-    return os;
-  }
+  virtual std::ostream& print (std::ostream& os, size_t indent = 0) const;
 
   jit_block *maybe_split (jit_factory& factory, jit_block_list& blocks,
                           jit_block *asuccessor);
@@ -742,6 +713,8 @@
     os << mname;
     if (mid != NO_ID)
       os << mid;
+    else
+      os << "!";
     return os;
   }