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 )
| 135 | protected boolean delUse( Node use ) { |
| 136 | Utils.del(_outputs, Utils.find(_outputs, use)); |
| 137 | return _outputs.isEmpty(); |
| 138 | } |
| 139 | |
| 140 | // Shortcut for "popping" n nodes. A "pop" is basically a |
| 141 | // setDef(last,null) followed by lowering the nIns() count. |
| 142 | void popN(int n) { |
| 143 | for( int i=0; i<n; i++ ) { |
| 144 | Node old_def = _inputs.removeLast(); |
| 145 | if( old_def != null && // If it exists and |
| 146 | old_def.delUse(this) ) // If we removed the last use, the old def is now dead |
| 147 | old_def.kill(); // Kill old def |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * Kill a Node with no <em>uses</em>, by setting all of its <em>defs</em> |
| 153 | * to null. This may recursively kill more Nodes and is basically dead |
| 154 | * code elimination. This function is co-recursive with {@link #popN}. |
| 155 | */ |