652 }
653 }
654
655 for ( uint i = 0; i < n->len(); i++ ) {
656 if ( n->in(i) ) {
657 if (!visited.test_set(n->in(i)->_idx)) {
658 nodeStack.push(n->in(i));
659 }
660 }
661 }
662 }
663 }
664
665 void IdealGraphPrinter::print_method(Compile* compile, const char *name, int level, bool clear_nodes) {
666 print(compile, name, (Node *)compile->root(), level, clear_nodes);
667 }
668
669 // Print current ideal graph
670 void IdealGraphPrinter::print(Compile* compile, const char *name, Node *node, int level, bool clear_nodes) {
671
672 if (!_current_method || !_should_send_method || !should_print(_current_method, level)) return;
673
674 this->C = compile;
675
676 // Warning, unsafe cast?
677 _chaitin = (PhaseChaitin *)C->regalloc();
678
679 begin_head(GRAPH_ELEMENT);
680 print_attr(GRAPH_NAME_PROPERTY, (const char *)name);
681 end_head();
682
683 VectorSet temp_set(Thread::current()->resource_area());
684
685 head(NODES_ELEMENT);
686 walk_nodes(node, false, &temp_set);
687 tail(NODES_ELEMENT);
688
689 head(EDGES_ELEMENT);
690 walk_nodes(node, true, &temp_set);
691 tail(EDGES_ELEMENT);
692 if (C->cfg() != NULL) {
705 }
706 tail(SUCCESSORS_ELEMENT);
707
708 head(NODES_ELEMENT);
709 for (uint s = 0; s < block->number_of_nodes(); s++) {
710 begin_elem(NODE_ELEMENT);
711 print_attr(NODE_ID_PROPERTY, block->get_node(s)->_idx);
712 end_elem();
713 }
714 tail(NODES_ELEMENT);
715
716 tail(BLOCK_ELEMENT);
717 }
718 tail(CONTROL_FLOW_ELEMENT);
719 }
720 tail(GRAPH_ELEMENT);
721 _xml->flush();
722 }
723
724 // Should method be printed?
725 bool IdealGraphPrinter::should_print(ciMethod* method, int level) {
726 intx ideal_graph_level = PrintIdealGraphLevel;
727 method->has_option_value("PrintIdealGraphLevel", ideal_graph_level); // update value with per-method value (if available)
728 return ideal_graph_level >= level;
729 }
730
731 extern const char *NodeClassNames[];
732
733 #endif
|
652 }
653 }
654
655 for ( uint i = 0; i < n->len(); i++ ) {
656 if ( n->in(i) ) {
657 if (!visited.test_set(n->in(i)->_idx)) {
658 nodeStack.push(n->in(i));
659 }
660 }
661 }
662 }
663 }
664
665 void IdealGraphPrinter::print_method(Compile* compile, const char *name, int level, bool clear_nodes) {
666 print(compile, name, (Node *)compile->root(), level, clear_nodes);
667 }
668
669 // Print current ideal graph
670 void IdealGraphPrinter::print(Compile* compile, const char *name, Node *node, int level, bool clear_nodes) {
671
672 if (!_current_method || !_should_send_method || !should_print(level)) return;
673
674 this->C = compile;
675
676 // Warning, unsafe cast?
677 _chaitin = (PhaseChaitin *)C->regalloc();
678
679 begin_head(GRAPH_ELEMENT);
680 print_attr(GRAPH_NAME_PROPERTY, (const char *)name);
681 end_head();
682
683 VectorSet temp_set(Thread::current()->resource_area());
684
685 head(NODES_ELEMENT);
686 walk_nodes(node, false, &temp_set);
687 tail(NODES_ELEMENT);
688
689 head(EDGES_ELEMENT);
690 walk_nodes(node, true, &temp_set);
691 tail(EDGES_ELEMENT);
692 if (C->cfg() != NULL) {
705 }
706 tail(SUCCESSORS_ELEMENT);
707
708 head(NODES_ELEMENT);
709 for (uint s = 0; s < block->number_of_nodes(); s++) {
710 begin_elem(NODE_ELEMENT);
711 print_attr(NODE_ID_PROPERTY, block->get_node(s)->_idx);
712 end_elem();
713 }
714 tail(NODES_ELEMENT);
715
716 tail(BLOCK_ELEMENT);
717 }
718 tail(CONTROL_FLOW_ELEMENT);
719 }
720 tail(GRAPH_ELEMENT);
721 _xml->flush();
722 }
723
724 // Should method be printed?
725 bool IdealGraphPrinter::should_print(int level) {
726 return C->env()->dirset()->IGVPrintLevelOption >= level;
727 }
728
729 extern const char *NodeClassNames[];
730
731 #endif
|