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

Method kill

chapter16/src/main/java/com/seaofnodes/simple/node/Node.java:241–255  ·  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

239 // ------------------------------------------------------------------------
240 // Graph-based optimizations
241
242 /**
243 * Try to peephole at this node and return a better replacement Node.
244 * Always returns some not-null Node (often this).
245 */
246 public final Node peephole() {
247 var obs = IterPeeps.midAssert() ? null : Parser.PARSER == null ? null : Parser.PARSER._obs;
248 if( obs != null ) obs.before(this);
249 Node n = peepholeOpt();
250 Node rez = n == null ? this : deadCodeElim(n.peephole());
251 if( obs != null ) obs.after(this, n == null ? null : rez, false);
252 return rez;
253 }
254
255 /**
256 * Try to peephole at this node and return a better replacement Node if
257 * possible. We compute a {@link Type} and then check and replace:
258 * <ul>

Callers 11

iterateMethod · 0.95
setDefMethod · 0.95
delDefMethod · 0.95
popUntilMethod · 0.95
subsumeMethod · 0.95
deadCodeElimMethod · 0.95
widenMethod · 0.95
parseMethod · 0.45
parseWhileMethod · 0.45
mergeScopesMethod · 0.45
endLoopMethod · 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