src/share/vm/adlc/formssel.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7063628 Sdiff src/share/vm/adlc

src/share/vm/adlc/formssel.cpp

Print this page




3606   } else if (mRule2->_rChild) {
3607     return false; // I have NULL right child, mRule2 has non-NULL right child.
3608   }
3609 
3610   // We've made it through the gauntlet.
3611   return true;
3612 }
3613 
3614 //----------------------------- equivalent ------------------------------------
3615 // Recursively check to see if two match rules are equivalent.
3616 // This rule handles the operands.
3617 bool MatchNode::equivalent(FormDict &globals, MatchNode *mNode2) {
3618   if( !mNode2 )
3619     return false;
3620 
3621   // Check that the current operands/operations match
3622   assert( _opType, "Must have _opType");
3623   assert( mNode2->_opType, "Must have _opType");
3624   const Form *form  = globals[_opType];
3625   const Form *form2 = globals[mNode2->_opType];
3626   return (form == form2);




















3627 }
3628 
3629 //-------------------------- has_commutative_op -------------------------------
3630 // Recursively check for commutative operations with subtree operands
3631 // which could be swapped.
3632 void MatchNode::count_commutative_op(int& count) {
3633   static const char *commut_op_list[] = {
3634     "AddI","AddL","AddF","AddD",
3635     "AndI","AndL",
3636     "MaxI","MinI",
3637     "MulI","MulL","MulF","MulD",
3638     "OrI" ,"OrL" ,
3639     "XorI","XorL"
3640   };
3641   int cnt = sizeof(commut_op_list)/sizeof(char*);
3642 
3643   if( _lChild && _rChild && (_lChild->_lChild || _rChild->_lChild) ) {
3644     // Don't swap if right operand is an immediate constant.
3645     bool is_const = false;
3646     if( _rChild->_lChild == NULL && _rChild->_rChild == NULL ) {




3606   } else if (mRule2->_rChild) {
3607     return false; // I have NULL right child, mRule2 has non-NULL right child.
3608   }
3609 
3610   // We've made it through the gauntlet.
3611   return true;
3612 }
3613 
3614 //----------------------------- equivalent ------------------------------------
3615 // Recursively check to see if two match rules are equivalent.
3616 // This rule handles the operands.
3617 bool MatchNode::equivalent(FormDict &globals, MatchNode *mNode2) {
3618   if( !mNode2 )
3619     return false;
3620 
3621   // Check that the current operands/operations match
3622   assert( _opType, "Must have _opType");
3623   assert( mNode2->_opType, "Must have _opType");
3624   const Form *form  = globals[_opType];
3625   const Form *form2 = globals[mNode2->_opType];
3626   if( form != form2 ) {
3627     return false;
3628   }
3629 
3630   // Check that their children also match
3631   if (_lChild ) {
3632     if( !_lChild->equivalent(globals, mNode2->_lChild) )
3633       return false;
3634   } else if (mNode2->_lChild) {
3635     return false; // I have NULL left child, mNode2 has non-NULL left child.
3636   }
3637 
3638   if (_rChild ) {
3639     if( !_rChild->equivalent(globals, mNode2->_rChild) )
3640       return false;
3641   } else if (mNode2->_rChild) {
3642     return false; // I have NULL right child, mNode2 has non-NULL right child.
3643   }
3644 
3645   // We've made it through the gauntlet.
3646   return true;
3647 }
3648 
3649 //-------------------------- has_commutative_op -------------------------------
3650 // Recursively check for commutative operations with subtree operands
3651 // which could be swapped.
3652 void MatchNode::count_commutative_op(int& count) {
3653   static const char *commut_op_list[] = {
3654     "AddI","AddL","AddF","AddD",
3655     "AndI","AndL",
3656     "MaxI","MinI",
3657     "MulI","MulL","MulF","MulD",
3658     "OrI" ,"OrL" ,
3659     "XorI","XorL"
3660   };
3661   int cnt = sizeof(commut_op_list)/sizeof(char*);
3662 
3663   if( _lChild && _rChild && (_lChild->_lChild || _rChild->_lChild) ) {
3664     // Don't swap if right operand is an immediate constant.
3665     bool is_const = false;
3666     if( _rChild->_lChild == NULL && _rChild->_rChild == NULL ) {


src/share/vm/adlc/formssel.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File