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

Method kill

chapter19/src/main/java/com/seaofnodes/simple/node/Node.java:251–263  ·  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.

( )

Source from the content-addressed store, hash-verified

249 * code elimination.
250 */
251 public void kill( ) {
252 unlock();
253 moveDepsToWorklist();
254 assert isUnused(); // Has no uses, so it is dead
255 _type=null; // Flag as dead
256 while( nIns()>0 ) { // Set all inputs to null, recursively killing unused Nodes
257 Node old_def = _inputs.removeLast();
258 // Revisit neighbor because removed use
259 if( old_def != null && CODE.add(old_def).delUse(this) )
260 old_def.kill(); // If we removed the last use, the old def is now dead
261 }
262 assert isDead(); // Really dead now
263 }
264
265 // Mostly used for asserts and printing.
266 public boolean isDead() { return isUnused() && nIns()==0 && _type==null; }

Callers 12

functionCallMethod · 0.95
iterateMethod · 0.95
idealizeMethod · 0.95
setDefMethod · 0.95
delDefMethod · 0.95
popUntilMethod · 0.95
unkillMethod · 0.95
subsumeMethod · 0.95
deadCodeElimMethod · 0.95
widenMethod · 0.95
parseMethod · 0.45
parseLoopingMethod · 0.45

Calls 8

unlockMethod · 0.95
moveDepsToWorklistMethod · 0.95
isUnusedMethod · 0.95
nInsMethod · 0.95
isDeadMethod · 0.95
removeLastMethod · 0.45
delUseMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected