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

Method kill

chapter24/src/main/java/com/seaofnodes/simple/node/Node.java:259–271  ·  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

257 * code elimination.
258 */
259 public void kill( ) {
260 assert isUnused(); // Has no uses, so it is dead
261 unlock();
262 moveDepsToWorklist();
263 _type=null; // Flag as dead
264 while( nIns()>0 ) { // Set all inputs to null, recursively killing unused Nodes
265 Node old_def = _inputs.removeLast();
266 // Revisit neighbor because removed use
267 if( old_def != null && CODE.add(old_def).delUse(this) )
268 old_def.kill(); // If we removed the last use, the old def is now dead
269 }
270 assert isDead(); // Really dead now
271 }
272
273 // Preserve CFG use-ordering when killing
274 public void killOrdered() {

Callers 14

functionCallMethod · 0.95
iterateMethod · 0.95
drop_same_opMethod · 0.95
setDefMethod · 0.95
delDefMethod · 0.95
popUntilMethod · 0.95
killOrderedMethod · 0.95
unkillMethod · 0.95
isKillMethod · 0.95
subsumeMethod · 0.95
deadCodeElimMethod · 0.95
widenMethod · 0.95

Calls 8

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

Tested by

no test coverage detected