@@ -3212,6 +3212,12 @@ void LinearScan::print_reg_num(outputStream* out, int reg_num) {
32123212 return ;
32133213 }
32143214
3215+ LIR_Opr opr = get_operand (reg_num);
3216+ assert (opr->is_valid (), " unknown register" );
3217+ opr->print (out);
3218+ }
3219+
3220+ LIR_Opr LinearScan::get_operand (int reg_num) {
32153221 LIR_Opr opr = LIR_OprFact::illegal ();
32163222
32173223#ifdef X86
@@ -3231,9 +3237,9 @@ void LinearScan::print_reg_num(outputStream* out, int reg_num) {
32313237 opr = LIR_OprFact::single_xmm (reg_num - pd_first_xmm_reg);
32323238#endif
32333239 } else {
3234- assert ( false , " unknown register" );
3240+ // reg_num == -1 or a virtual register, return the illegal operand
32353241 }
3236- opr-> print (out) ;
3242+ return opr;
32373243}
32383244
32393245Interval* LinearScan::find_interval_at (int reg_num) const {
@@ -4598,7 +4604,7 @@ bool Interval::intersects_any_children_of(Interval* interval) const {
45984604
45994605
46004606#ifndef PRODUCT
4601- void Interval::print_on (outputStream* out) const {
4607+ void Interval::print_on (outputStream* out, bool is_cfg_printer ) const {
46024608 const char * SpillState2Name[] = { " no definition" , " no spill store" , " one spill store" , " store at definition" , " start in memory" , " no optimization" };
46034609 const char * UseKind2Name[] = { " N" , " L" , " S" , " M" };
46044610
@@ -4608,18 +4614,29 @@ void Interval::print_on(outputStream* out) const {
46084614 } else {
46094615 type_name = type2name (type ());
46104616 }
4611-
46124617 out->print (" %d %s " , reg_num (), type_name);
4613- if (reg_num () < LIR_OprDesc::vreg_base) {
4614- LinearScan::print_reg_num (out, assigned_reg ());
4615- } else if (assigned_reg () != -1 && (LinearScan::num_physical_regs (type ()) == 1 || assigned_regHi () != -1 )) {
4616- LinearScan::calc_operand_for_interval (this )->print (out);
4618+
4619+ if (is_cfg_printer) {
4620+ // Special version for compatibility with C1 Visualizer.
4621+ LIR_Opr opr = LinearScan::get_operand (reg_num ());
4622+ if (opr->is_valid ()) {
4623+ out->print (" \" " );
4624+ opr->print (out);
4625+ out->print (" \" " );
4626+ }
46174627 } else {
4618- // Virtual register that has no assigned register yet.
4619- out->print (" [ANY]" );
4628+ // Improved output for normal debugging.
4629+ if (reg_num () < LIR_OprDesc::vreg_base) {
4630+ LinearScan::print_reg_num (out, assigned_reg ());
4631+ } else if (assigned_reg () != -1 && (LinearScan::num_physical_regs (type ()) == 1 || assigned_regHi () != -1 )) {
4632+ LinearScan::calc_operand_for_interval (this )->print (out);
4633+ } else {
4634+ // Virtual register that has no assigned register yet.
4635+ out->print (" [ANY]" );
4636+ }
4637+ out->print (" " );
46204638 }
4621-
4622- out->print (" %d %d " , split_parent ()->reg_num (), (register_hint (false ) != NULL ? register_hint (false )->reg_num () : -1 ));
4639+ out->print (" %d %d " , split_parent ()->reg_num (), (register_hint (false ) != NULL ? register_hint (false )->reg_num () : -1 ));
46234640
46244641 // print ranges
46254642 Range* cur = _first;
0 commit comments