Mercurial > octave-nkf
diff libinterp/interp-core/jit-ir.cc @ 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 | 4f1a4923a19e |
children | 44272909d926 |
line wrap: on
line diff
--- a/libinterp/interp-core/jit-ir.cc Mon Nov 05 01:48:23 2012 +0000 +++ b/libinterp/interp-core/jit-ir.cc Sun Nov 04 20:09:23 2012 -0700 @@ -80,6 +80,16 @@ insert_before (loc->location (), ablock); } +void +jit_block_list::label (void) +{ + if (mlist.size ()) + { + jit_block *block = mlist.back (); + block->label (); + } +} + std::ostream& jit_block_list::print (std::ostream& os, const std::string& header) const { @@ -469,6 +479,21 @@ } void +jit_block::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 jit_block::pop_all (void) { for (iterator iter = begin (); iter != end (); ++iter) @@ -478,6 +503,28 @@ } } +std::ostream& +jit_block::print (std::ostream& os, size_t indent) 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; +} + jit_block * jit_block::maybe_split (jit_factory& factory, jit_block_list& blocks, jit_block *asuccessor)