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)
| 159 | * @return new_def for flow coding |
| 160 | */ |
| 161 | Node addDef(Node new_def) { |
| 162 | // Add use->def edge |
| 163 | _inputs.add(new_def); |
| 164 | // If new def is not null, add the corresponding def->use edge |
| 165 | if( new_def != null ) |
| 166 | new_def.addUse(this); |
| 167 | return new_def; |
| 168 | } |
| 169 | |
| 170 | // Breaks the edge invariants, used temporarily |
| 171 | protected <N extends Node> void addUse(N n) { _outputs.add(n); } |