3774 return false; // I have NULL left child, mNode2 has non-NULL left child.
3775 }
3776
3777 if (_rChild ) {
3778 if( !_rChild->equivalent(globals, mNode2->_rChild) )
3779 return false;
3780 } else if (mNode2->_rChild) {
3781 return false; // I have NULL right child, mNode2 has non-NULL right child.
3782 }
3783
3784 // We've made it through the gauntlet.
3785 return true;
3786 }
3787
3788 //-------------------------- has_commutative_op -------------------------------
3789 // Recursively check for commutative operations with subtree operands
3790 // which could be swapped.
3791 void MatchNode::count_commutative_op(int& count) {
3792 static const char *commut_op_list[] = {
3793 "AddI","AddL","AddF","AddD",
3794 "AndI","AndL",
3795 "MaxI","MinI",
3796 "MulI","MulL","MulF","MulD",
3797 "OrI" ,"OrL" ,
3798 "XorI","XorL"
3799 };
3800 int cnt = sizeof(commut_op_list)/sizeof(char*);
3801
3802 if( _lChild && _rChild && (_lChild->_lChild || _rChild->_lChild) ) {
3803 // Don't swap if right operand is an immediate constant.
3804 bool is_const = false;
3805 if( _rChild->_lChild == NULL && _rChild->_rChild == NULL ) {
3806 FormDict &globals = _AD.globalNames();
3807 const Form *form = globals[_rChild->_opType];
3808 if ( form ) {
3809 OperandForm *oper = form->is_operand();
3810 if( oper && oper->interface_type(globals) == Form::constant_interface )
3811 is_const = true;
3812 }
3813 }
|
3774 return false; // I have NULL left child, mNode2 has non-NULL left child.
3775 }
3776
3777 if (_rChild ) {
3778 if( !_rChild->equivalent(globals, mNode2->_rChild) )
3779 return false;
3780 } else if (mNode2->_rChild) {
3781 return false; // I have NULL right child, mNode2 has non-NULL right child.
3782 }
3783
3784 // We've made it through the gauntlet.
3785 return true;
3786 }
3787
3788 //-------------------------- has_commutative_op -------------------------------
3789 // Recursively check for commutative operations with subtree operands
3790 // which could be swapped.
3791 void MatchNode::count_commutative_op(int& count) {
3792 static const char *commut_op_list[] = {
3793 "AddI","AddL","AddF","AddD",
3794 "AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
3795 "AndI","AndL",
3796 "MaxI","MinI",
3797 "MulI","MulL","MulF","MulD",
3798 "OrI" ,"OrL" ,
3799 "XorI","XorL"
3800 };
3801 int cnt = sizeof(commut_op_list)/sizeof(char*);
3802
3803 if( _lChild && _rChild && (_lChild->_lChild || _rChild->_lChild) ) {
3804 // Don't swap if right operand is an immediate constant.
3805 bool is_const = false;
3806 if( _rChild->_lChild == NULL && _rChild->_rChild == NULL ) {
3807 FormDict &globals = _AD.globalNames();
3808 const Form *form = globals[_rChild->_opType];
3809 if ( form ) {
3810 OperandForm *oper = form->is_operand();
3811 if( oper && oper->interface_type(globals) == Form::constant_interface )
3812 is_const = true;
3813 }
3814 }
|