53 }
54 }
55
56 //=============================================================================
57 //------------------------------dump_spec--------------------------------------
58 // Dump special per-node info
59 #ifndef PRODUCT
60 void LoopNode::dump_spec(outputStream *st) const {
61 if (is_inner_loop()) st->print( "inner " );
62 if (is_partial_peel_loop()) st->print( "partial_peel " );
63 if (partial_peel_has_failed()) st->print( "partial_peel_failed " );
64 }
65 #endif
66
67 //------------------------------is_valid_counted_loop-------------------------
68 bool LoopNode::is_valid_counted_loop() const {
69 if (is_CountedLoop()) {
70 CountedLoopNode* l = as_CountedLoop();
71 CountedLoopEndNode* le = l->loopexit();
72 if (le != NULL &&
73 le->proj_out(1 /* true */) == l->in(LoopNode::LoopBackControl)) {
74 Node* phi = l->phi();
75 Node* exit = le->proj_out(0 /* false */);
76 if (exit != NULL && exit->Opcode() == Op_IfFalse &&
77 phi != NULL && phi->is_Phi() &&
78 phi->in(LoopNode::LoopBackControl) == l->incr() &&
79 le->loopnode() == l && le->stride_is_con()) {
80 return true;
81 }
82 }
83 }
84 return false;
85 }
86
87 //------------------------------get_early_ctrl---------------------------------
88 // Compute earliest legal control
89 Node *PhaseIdealLoop::get_early_ctrl( Node *n ) {
90 assert( !n->is_Phi() && !n->is_CFG(), "this code only handles data nodes" );
91 uint i;
92 Node *early;
93 if (n->in(0) && !n->is_expensive()) {
94 early = n->in(0);
95 if (!early->is_CFG()) // Might be a non-CFG multi-def
1199 Node* c = proj->in(0);
1200 if (c == NULL || c->is_top() || c->outcnt() != 2) {
1201 return NULL;
1202 }
1203 return c->as_OuterStripMinedLoopEnd();
1204 }
1205
1206 OuterStripMinedLoopEndNode* CountedLoopNode::outer_loop_end() const {
1207 LoopNode* l = outer_loop();
1208 if (l == NULL) {
1209 return NULL;
1210 }
1211 return l->outer_loop_end();
1212 }
1213
1214 IfFalseNode* OuterStripMinedLoopNode::outer_loop_exit() const {
1215 IfNode* le = outer_loop_end();
1216 if (le == NULL) {
1217 return NULL;
1218 }
1219 Node* c = le->proj_out(false);
1220 if (c == NULL) {
1221 return NULL;
1222 }
1223 return c->as_IfFalse();
1224 }
1225
1226 IfFalseNode* CountedLoopNode::outer_loop_exit() const {
1227 LoopNode* l = outer_loop();
1228 if (l == NULL) {
1229 return NULL;
1230 }
1231 return l->outer_loop_exit();
1232 }
1233
1234 SafePointNode* OuterStripMinedLoopNode::outer_safepoint() const {
1235 IfNode* le = outer_loop_end();
1236 if (le == NULL) {
1237 return NULL;
1238 }
1239 Node* c = le->in(0);
|
53 }
54 }
55
56 //=============================================================================
57 //------------------------------dump_spec--------------------------------------
58 // Dump special per-node info
59 #ifndef PRODUCT
60 void LoopNode::dump_spec(outputStream *st) const {
61 if (is_inner_loop()) st->print( "inner " );
62 if (is_partial_peel_loop()) st->print( "partial_peel " );
63 if (partial_peel_has_failed()) st->print( "partial_peel_failed " );
64 }
65 #endif
66
67 //------------------------------is_valid_counted_loop-------------------------
68 bool LoopNode::is_valid_counted_loop() const {
69 if (is_CountedLoop()) {
70 CountedLoopNode* l = as_CountedLoop();
71 CountedLoopEndNode* le = l->loopexit();
72 if (le != NULL &&
73 le->proj_out_or_null(1 /* true */) == l->in(LoopNode::LoopBackControl)) {
74 Node* phi = l->phi();
75 Node* exit = le->proj_out_or_null(0 /* false */);
76 if (exit != NULL && exit->Opcode() == Op_IfFalse &&
77 phi != NULL && phi->is_Phi() &&
78 phi->in(LoopNode::LoopBackControl) == l->incr() &&
79 le->loopnode() == l && le->stride_is_con()) {
80 return true;
81 }
82 }
83 }
84 return false;
85 }
86
87 //------------------------------get_early_ctrl---------------------------------
88 // Compute earliest legal control
89 Node *PhaseIdealLoop::get_early_ctrl( Node *n ) {
90 assert( !n->is_Phi() && !n->is_CFG(), "this code only handles data nodes" );
91 uint i;
92 Node *early;
93 if (n->in(0) && !n->is_expensive()) {
94 early = n->in(0);
95 if (!early->is_CFG()) // Might be a non-CFG multi-def
1199 Node* c = proj->in(0);
1200 if (c == NULL || c->is_top() || c->outcnt() != 2) {
1201 return NULL;
1202 }
1203 return c->as_OuterStripMinedLoopEnd();
1204 }
1205
1206 OuterStripMinedLoopEndNode* CountedLoopNode::outer_loop_end() const {
1207 LoopNode* l = outer_loop();
1208 if (l == NULL) {
1209 return NULL;
1210 }
1211 return l->outer_loop_end();
1212 }
1213
1214 IfFalseNode* OuterStripMinedLoopNode::outer_loop_exit() const {
1215 IfNode* le = outer_loop_end();
1216 if (le == NULL) {
1217 return NULL;
1218 }
1219 Node* c = le->proj_out_or_null(false);
1220 if (c == NULL) {
1221 return NULL;
1222 }
1223 return c->as_IfFalse();
1224 }
1225
1226 IfFalseNode* CountedLoopNode::outer_loop_exit() const {
1227 LoopNode* l = outer_loop();
1228 if (l == NULL) {
1229 return NULL;
1230 }
1231 return l->outer_loop_exit();
1232 }
1233
1234 SafePointNode* OuterStripMinedLoopNode::outer_safepoint() const {
1235 IfNode* le = outer_loop_end();
1236 if (le == NULL) {
1237 return NULL;
1238 }
1239 Node* c = le->in(0);
|