Change a def into a Node. Keeps the edges correct, by removing the corresponding use->def edge. This may make the original def go dead. This function is co-recursive with #kill. This method is the normal path for altering a Node, because it does the proper d
(int idx, Node new_def )
| 145 | // If new def is not null, add the corresponding def->use edge |
| 146 | if( new_def != null ) |
| 147 | new_def.addUse(this); |
| 148 | return new_def; |
| 149 | } |
| 150 | |
| 151 | // Breaks the edge invariants, used temporarily |
| 152 | protected <N extends Node> void addUse(N n) { _outputs.add(n); } |
| 153 | |
| 154 | // Remove node 'use' from 'def's (i.e. our) output list, by compressing the list in-place. |
| 155 | // Return true if the output list is empty afterward. |
| 156 | // Error is 'use' does not exist; ok for 'use' to be null. |
| 157 | protected boolean delUse( Node use ) { |
| 158 | Utils.del(_outputs, Utils.find(_outputs, use)); |
| 159 | return _outputs.isEmpty(); |
| 160 | } |
| 161 | |
| 162 | // Shortcut for "popping" n nodes. A "pop" is basically a |
| 163 | // setDef(last,null) followed by lowering the nIns() count. |
| 164 | void popN(int n) { |
| 165 | for( int i=0; i<n; i++ ) { |