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

Method kill

chapter04/src/main/java/com/seaofnodes/simple/node/Node.java:197–202  ·  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 #popN.

( )

Source from the content-addressed store, hash-verified

195 if( obs != null ) obs.after(this, n == null && old == _type ? null : rez, false);
196 return rez;
197 }
198
199 private Node peepholeOpt() {
200 // Compute initial or improved Type
201 Type type = _type = compute();
202
203 // Replace constant computations from non-constants with a constant node
204 if (!(this instanceof ConstantNode) && type.isConstant())
205 return deadCodeElim(new ConstantNode(type).peephole());

Callers 3

setDefMethod · 0.95
popNMethod · 0.95
deadCodeElimMethod · 0.95

Calls 4

isUnusedMethod · 0.95
popNMethod · 0.95
nInsMethod · 0.95
isDeadMethod · 0.95

Tested by

no test coverage detected