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

Method kill

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

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

Callers 13

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
subsumeMethod · 0.95
deadCodeElimMethod · 0.95
widenMethod · 0.95
parseMethod · 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