966 // sharing there may be other users of the old Nodes relying on their current |
966 // sharing there may be other users of the old Nodes relying on their current |
967 // semantics. Modifying them will break the other users. |
967 // semantics. Modifying them will break the other users. |
968 // Example: when reshape "(X+3)+4" into "X+7" you must leave the Node for |
968 // Example: when reshape "(X+3)+4" into "X+7" you must leave the Node for |
969 // "X+3" unchanged in case it is shared. |
969 // "X+3" unchanged in case it is shared. |
970 // |
970 // |
971 // If you modify the 'this' pointer's inputs, you must use 'set_req' with |
971 // If you modify the 'this' pointer's inputs, you should use |
972 // def-use info. If you are making a new Node (either as the new root or |
972 // 'set_req'. If you are making a new Node (either as the new root or |
973 // some new internal piece) you must NOT use set_req with def-use info. |
973 // some new internal piece) you may use 'init_req' to set the initial |
974 // You can make a new Node with either 'new' or 'clone'. In either case, |
974 // value. You can make a new Node with either 'new' or 'clone'. In |
975 // def-use info is (correctly) not generated. |
975 // either case, def-use info is correctly maintained. |
|
976 // |
976 // Example: reshape "(X+3)+4" into "X+7": |
977 // Example: reshape "(X+3)+4" into "X+7": |
977 // set_req(1,in(1)->in(1) /* grab X */, du /* must use DU on 'this' */); |
978 // set_req(1, in(1)->in(1)); |
978 // set_req(2,phase->intcon(7),du); |
979 // set_req(2, phase->intcon(7)); |
979 // return this; |
980 // return this; |
980 // Example: reshape "X*4" into "X<<1" |
981 // Example: reshape "X*4" into "X<<2" |
981 // return new (C,3) LShiftINode( in(1), phase->intcon(1) ); |
982 // return new (C,3) LShiftINode(in(1), phase->intcon(2)); |
982 // |
983 // |
983 // You must call 'phase->transform(X)' on any new Nodes X you make, except |
984 // You must call 'phase->transform(X)' on any new Nodes X you make, except |
984 // for the returned root node. Example: reshape "X*31" with "(X<<5)-1". |
985 // for the returned root node. Example: reshape "X*31" with "(X<<5)-X". |
985 // Node *shift=phase->transform(new(C,3)LShiftINode(in(1),phase->intcon(5))); |
986 // Node *shift=phase->transform(new(C,3)LShiftINode(in(1),phase->intcon(5))); |
986 // return new (C,3) AddINode(shift, phase->intcon(-1)); |
987 // return new (C,3) AddINode(shift, in(1)); |
987 // |
988 // |
988 // When making a Node for a constant use 'phase->makecon' or 'phase->intcon'. |
989 // When making a Node for a constant use 'phase->makecon' or 'phase->intcon'. |
989 // These forms are faster than 'phase->transform(new (C,1) ConNode())' and Do |
990 // These forms are faster than 'phase->transform(new (C,1) ConNode())' and Do |
990 // The Right Thing with def-use info. |
991 // The Right Thing with def-use info. |
991 // |
992 // |
1677 |
1678 |
1678 // Recursive termination test |
1679 // Recursive termination test |
1679 if (visited.member(this)) return; |
1680 if (visited.member(this)) return; |
1680 visited.push(this); |
1681 visited.push(this); |
1681 |
1682 |
1682 // Walk over all input edges, checking for correspondance |
1683 // Walk over all input edges, checking for correspondence |
1683 for( i = 0; i < len(); i++ ) { |
1684 for( i = 0; i < len(); i++ ) { |
1684 n = in(i); |
1685 n = in(i); |
1685 if (n != NULL && !n->is_top()) { |
1686 if (n != NULL && !n->is_top()) { |
1686 // Count instances of (Node *)this |
1687 // Count instances of (Node *)this |
1687 cnt = 0; |
1688 cnt = 0; |
1721 Compile* C = Compile::current(); |
1722 Compile* C = Compile::current(); |
1722 |
1723 |
1723 // Contained in new_space or old_space? |
1724 // Contained in new_space or old_space? |
1724 VectorSet *v = C->node_arena()->contains(n) ? &new_space : &old_space; |
1725 VectorSet *v = C->node_arena()->contains(n) ? &new_space : &old_space; |
1725 // Check for visited in the proper space. Numberings are not unique |
1726 // Check for visited in the proper space. Numberings are not unique |
1726 // across spaces so we need a seperate VectorSet for each space. |
1727 // across spaces so we need a separate VectorSet for each space. |
1727 if( v->test_set(n->_idx) ) return; |
1728 if( v->test_set(n->_idx) ) return; |
1728 |
1729 |
1729 if (n->is_Con() && n->bottom_type() == Type::TOP) { |
1730 if (n->is_Con() && n->bottom_type() == Type::TOP) { |
1730 if (C->cached_top_node() == NULL) |
1731 if (C->cached_top_node() == NULL) |
1731 C->set_cached_top_node((Node*)n); |
1732 C->set_cached_top_node((Node*)n); |