MCPcopy Create free account
hub / github.com/SeaOfNodes/Simple / kill

Method kill

chapter02/src/main/java/com/seaofnodes/simple/node/Node.java:171–178  ·  view source on GitHub ↗

Kill a Node with no uses , by setting all of its defs to null. This may recursively kill more Nodes and is basically dead code elimination. This function is co-recursive with #setDef.

( )

Source from the content-addressed store, hash-verified

169 * code elimination. This function is co-recursive with {@link #setDef}.
170 */
171 public void kill( ) {
172 assert isUnused(); // Has no uses, so it is dead
173 for( int i=0; i<nIns(); i++ )
174 setDef(i,null); // Set all inputs to null, recursively killing unused Nodes
175 _inputs.clear();
176 _type=null; // Flag as dead
177 assert isDead(); // Really dead now
178 }
179
180 // Mostly used for asserts and printing.
181 boolean isDead() { return isUnused() && nIns()==0 && _type==null; }

Callers 2

setDefMethod · 0.95
peepholeMethod · 0.95

Calls 5

isUnusedMethod · 0.95
nInsMethod · 0.95
setDefMethod · 0.95
isDeadMethod · 0.95
clearMethod · 0.45

Tested by

no test coverage detected