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 )
| 184 | Node old_def = _inputs.removeLast(); |
| 185 | if( old_def != null && // If it exists and |
| 186 | old_def.delUse(this) ) // If we removed the last use, the old def is now dead |
| 187 | old_def.kill(); // Kill old def |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * Kill a Node with no <em>uses</em>, by setting all of its <em>defs</em> |
| 193 | * to null. This may recursively kill more Nodes, and is basically dead |
| 194 | * code elimination. |
| 195 | */ |
| 196 | public void kill( ) { |
| 197 | unlock(); |
| 198 | assert isUnused(); // Has no uses, so it is dead |
| 199 | _type=null; // Flag as dead |
| 200 | while( nIns()>0 ) { // Set all inputs to null, recursively killing unused Nodes |
| 201 | Node old_def = _inputs.removeLast(); |
| 202 | if( old_def != null ) { |
| 203 | IterPeeps.add(old_def);// Revisit neighbor because removed use |
| 204 | if( old_def.delUse(this) ) // If we removed the last use, the old def is now dead |
| 205 | old_def.kill(); // Kill old def |
no test coverage detected