Add a new def to an existing Node. Keep the edges correct by adding the corresponding def->use edge. @param new_def the new definition, appended to the end of existing definitions @return new_def for flow coding
(Node new_def)
| 213 | * @return new_def for flow coding |
| 214 | */ |
| 215 | Node addDef(Node new_def) { |
| 216 | // Add use->def edge |
| 217 | _inputs.add(new_def); |
| 218 | // If new def is not null, add the corresponding def->use edge |
| 219 | if( new_def != null ) |
| 220 | new_def.addUse(this); |
| 221 | return new_def; |
| 222 | } |
| 223 | |
| 224 | // Breaks the edge invariants, used temporarily |
| 225 | protected <N extends Node> void addUse(N n) { _outputs.add(n); } |