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)
| 224 | * @return new_def for flow coding |
| 225 | */ |
| 226 | Node addDef(Node new_def) { |
| 227 | unlock(); |
| 228 | // Add use->def edge |
| 229 | _inputs.add(new_def); |
| 230 | // If new def is not null, add the corresponding def->use edge |
| 231 | if( new_def != null ) |
| 232 | new_def.addUse(this); |
| 233 | return new_def; |
| 234 | } |
| 235 | |
| 236 | // Breaks the edge invariants, used temporarily |
| 237 | protected <N extends Node> void addUse(N n) { _outputs.add(n); } |