3621 // Check that the current operands/operations match |
3621 // Check that the current operands/operations match |
3622 assert( _opType, "Must have _opType"); |
3622 assert( _opType, "Must have _opType"); |
3623 assert( mNode2->_opType, "Must have _opType"); |
3623 assert( mNode2->_opType, "Must have _opType"); |
3624 const Form *form = globals[_opType]; |
3624 const Form *form = globals[_opType]; |
3625 const Form *form2 = globals[mNode2->_opType]; |
3625 const Form *form2 = globals[mNode2->_opType]; |
3626 return (form == form2); |
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; |
3627 } |
3647 } |
3628 |
3648 |
3629 //-------------------------- has_commutative_op ------------------------------- |
3649 //-------------------------- has_commutative_op ------------------------------- |
3630 // Recursively check for commutative operations with subtree operands |
3650 // Recursively check for commutative operations with subtree operands |
3631 // which could be swapped. |
3651 // which could be swapped. |