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