Add a node to the list o dependencies. Only add it if its not an input or output of this node, that is, it is at least one step away. The node being added must benefit from this node being peepholed.
( Node dep )
| 483 | // Swap inputs without letting either input go dead during the swap. |
| 484 | Node swap12() { |
| 485 | unlock(); // Hash is order dependent |
| 486 | Node tmp = in(1); |
| 487 | _inputs.set(1,in(2)); |
| 488 | _inputs.set(2,tmp); |
| 489 | return this; |
| 490 | } |
| 491 | |
| 492 | /** |
| 493 | * Does this node contain all constants? |
| 494 | * Ignores in(0), as is usually control. |
| 495 | * In an input is not a constant, we add dep as |
| 496 | * a dependency to it, because dep can make progress |
| 497 | * if the input becomes a constant later. |
| 498 | * It is sufficient for one of the non-const |