927 limit = _igvn.intcon(final_int);
928 } else {
929 // Create new LoopLimit node to get exact limit (final iv value).
930 limit = new LoopLimitNode(C, cl->init_trip(), cl->limit(), cl->stride());
931 register_new_node(limit, cl->in(LoopNode::EntryControl));
932 }
933 assert(limit != NULL, "sanity");
934 return limit;
935 }
936
937 //------------------------------Ideal------------------------------------------
938 // Return a node which is more "ideal" than the current node.
939 // Attempt to convert into a counted-loop.
940 Node *LoopNode::Ideal(PhaseGVN *phase, bool can_reshape) {
941 if (!can_be_counted_loop(phase) && !is_OuterStripMinedLoop()) {
942 phase->C->set_major_progress();
943 }
944 return RegionNode::Ideal(phase, can_reshape);
945 }
946
947 void LoopNode::verify_strip_mined(int expect_skeleton) const {
948 #ifdef ASSERT
949 const OuterStripMinedLoopNode* outer = NULL;
950 const CountedLoopNode* inner = NULL;
951 if (is_strip_mined()) {
952 assert(is_CountedLoop(), "no Loop should be marked strip mined");
953 inner = as_CountedLoop();
954 outer = inner->in(LoopNode::EntryControl)->as_OuterStripMinedLoop();
955 } else if (is_OuterStripMinedLoop()) {
956 outer = this->as_OuterStripMinedLoop();
957 inner = outer->unique_ctrl_out()->as_CountedLoop();
958 assert(!is_strip_mined(), "outer loop shouldn't be marked strip mined");
959 }
960 if (inner != NULL || outer != NULL) {
961 assert(inner != NULL && outer != NULL, "missing loop in strip mined nest");
962 Node* outer_tail = outer->in(LoopNode::LoopBackControl);
963 Node* outer_le = outer_tail->in(0);
964 assert(outer_le->Opcode() == Op_OuterStripMinedLoopEnd, "tail of outer loop should be an If");
965 Node* sfpt = outer_le->in(0);
966 assert(sfpt->Opcode() == Op_SafePoint, "where's the safepoint?");
967 Node* inner_out = sfpt->in(0);
968 if (inner_out->outcnt() != 1) {
969 ResourceMark rm;
970 Unique_Node_List wq;
971
972 for (DUIterator_Fast imax, i = inner_out->fast_outs(imax); i < imax; i++) {
973 Node* u = inner_out->fast_out(i);
974 if (u == sfpt) {
975 continue;
976 }
977 wq.clear();
1007 if (u->is_Phi()) {
1008 phis++;
1009 }
1010 }
1011 for (DUIterator_Fast imax, i = outer->fast_outs(imax); i < imax; i++) {
1012 Node* u = outer->fast_out(i);
1013 assert(u == outer || u == inner || u->is_Phi(), "nothing between inner and outer loop");
1014 }
1015 uint stores = 0;
1016 for (DUIterator_Fast imax, i = inner_out->fast_outs(imax); i < imax; i++) {
1017 Node* u = inner_out->fast_out(i);
1018 if (u->is_Store()) {
1019 stores++;
1020 }
1021 }
1022 assert(outer->outcnt() >= phis + 2 && outer->outcnt() <= phis + 2 + stores + 1, "only phis");
1023 }
1024 assert(sfpt->outcnt() == 1, "no data node");
1025 assert(outer_tail->outcnt() == 1 || !has_skeleton, "no data node");
1026 }
1027 #endif
1028 }
1029
1030 //=============================================================================
1031 //------------------------------Ideal------------------------------------------
1032 // Return a node which is more "ideal" than the current node.
1033 // Attempt to convert into a counted-loop.
1034 Node *CountedLoopNode::Ideal(PhaseGVN *phase, bool can_reshape) {
1035 return RegionNode::Ideal(phase, can_reshape);
1036 }
1037
1038 //------------------------------dump_spec--------------------------------------
1039 // Dump special per-node info
1040 #ifndef PRODUCT
1041 void CountedLoopNode::dump_spec(outputStream *st) const {
1042 LoopNode::dump_spec(st);
1043 if (stride_is_con()) {
1044 st->print("stride: %d ",stride_con());
1045 }
1046 if (is_pre_loop ()) st->print("pre of N%d" , _main_idx);
1047 if (is_main_loop()) st->print("main of N%d", _idx);
1048 if (is_post_loop()) st->print("post of N%d", _main_idx);
|
927 limit = _igvn.intcon(final_int);
928 } else {
929 // Create new LoopLimit node to get exact limit (final iv value).
930 limit = new LoopLimitNode(C, cl->init_trip(), cl->limit(), cl->stride());
931 register_new_node(limit, cl->in(LoopNode::EntryControl));
932 }
933 assert(limit != NULL, "sanity");
934 return limit;
935 }
936
937 //------------------------------Ideal------------------------------------------
938 // Return a node which is more "ideal" than the current node.
939 // Attempt to convert into a counted-loop.
940 Node *LoopNode::Ideal(PhaseGVN *phase, bool can_reshape) {
941 if (!can_be_counted_loop(phase) && !is_OuterStripMinedLoop()) {
942 phase->C->set_major_progress();
943 }
944 return RegionNode::Ideal(phase, can_reshape);
945 }
946
947 #ifdef ASSERT
948 void LoopNode::verify_strip_mined(int expect_skeleton) const {
949 if (!is_valid_counted_loop()) {
950 return; // Skip malformed counted loop
951 }
952 const OuterStripMinedLoopNode* outer = NULL;
953 const CountedLoopNode* inner = NULL;
954 if (is_strip_mined()) {
955 assert(is_CountedLoop(), "no Loop should be marked strip mined");
956 inner = as_CountedLoop();
957 outer = inner->in(LoopNode::EntryControl)->as_OuterStripMinedLoop();
958 } else if (is_OuterStripMinedLoop()) {
959 outer = this->as_OuterStripMinedLoop();
960 inner = outer->unique_ctrl_out()->as_CountedLoop();
961 assert(inner->is_valid_counted_loop(), "OuterStripMinedLoop should have been removed");
962 assert(!is_strip_mined(), "outer loop shouldn't be marked strip mined");
963 }
964 if (inner != NULL || outer != NULL) {
965 assert(inner != NULL && outer != NULL, "missing loop in strip mined nest");
966 Node* outer_tail = outer->in(LoopNode::LoopBackControl);
967 Node* outer_le = outer_tail->in(0);
968 assert(outer_le->Opcode() == Op_OuterStripMinedLoopEnd, "tail of outer loop should be an If");
969 Node* sfpt = outer_le->in(0);
970 assert(sfpt->Opcode() == Op_SafePoint, "where's the safepoint?");
971 Node* inner_out = sfpt->in(0);
972 if (inner_out->outcnt() != 1) {
973 ResourceMark rm;
974 Unique_Node_List wq;
975
976 for (DUIterator_Fast imax, i = inner_out->fast_outs(imax); i < imax; i++) {
977 Node* u = inner_out->fast_out(i);
978 if (u == sfpt) {
979 continue;
980 }
981 wq.clear();
1011 if (u->is_Phi()) {
1012 phis++;
1013 }
1014 }
1015 for (DUIterator_Fast imax, i = outer->fast_outs(imax); i < imax; i++) {
1016 Node* u = outer->fast_out(i);
1017 assert(u == outer || u == inner || u->is_Phi(), "nothing between inner and outer loop");
1018 }
1019 uint stores = 0;
1020 for (DUIterator_Fast imax, i = inner_out->fast_outs(imax); i < imax; i++) {
1021 Node* u = inner_out->fast_out(i);
1022 if (u->is_Store()) {
1023 stores++;
1024 }
1025 }
1026 assert(outer->outcnt() >= phis + 2 && outer->outcnt() <= phis + 2 + stores + 1, "only phis");
1027 }
1028 assert(sfpt->outcnt() == 1, "no data node");
1029 assert(outer_tail->outcnt() == 1 || !has_skeleton, "no data node");
1030 }
1031 }
1032 #endif
1033
1034 //=============================================================================
1035 //------------------------------Ideal------------------------------------------
1036 // Return a node which is more "ideal" than the current node.
1037 // Attempt to convert into a counted-loop.
1038 Node *CountedLoopNode::Ideal(PhaseGVN *phase, bool can_reshape) {
1039 return RegionNode::Ideal(phase, can_reshape);
1040 }
1041
1042 //------------------------------dump_spec--------------------------------------
1043 // Dump special per-node info
1044 #ifndef PRODUCT
1045 void CountedLoopNode::dump_spec(outputStream *st) const {
1046 LoopNode::dump_spec(st);
1047 if (stride_is_con()) {
1048 st->print("stride: %d ",stride_con());
1049 }
1050 if (is_pre_loop ()) st->print("pre of N%d" , _main_idx);
1051 if (is_main_loop()) st->print("main of N%d", _idx);
1052 if (is_post_loop()) st->print("post of N%d", _main_idx);
|