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

Method kill

chapter18/src/main/java/com/seaofnodes/simple/node/Node.java:242–256  ·  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

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

Callers 11

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
addMethod · 0.95
delUseMethod · 0.95
isDeadMethod · 0.95
removeLastMethod · 0.45

Tested by

no test coverage detected