(int n)
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * Try to peephole at this node and return a better replacement Node if |
| 251 | * possible. We compute a {@link Type} and then check and replace: |
| 252 | * <ul> |
| 253 | * <li>if the Type {@link Type#isConstant}, we replace with a {@link ConstantNode}</li> |
| 254 | * <li>in a future chapter we will look for a |
| 255 | * <a href="https://en.wikipedia.org/wiki/Common_subexpression_elimination">Common Subexpression</a> |
| 256 | * to eliminate.</li> |
| 257 | * <li>we ask the Node for a better replacement. The "better replacement" |
| 258 | * is things like {@code (1+2)} becomes {@code 3} and {@code (1+(x+2))} becomes |
| 259 | * {@code (x+(1+2))}. By canonicalizing expressions we fold common addressing |
| 260 | * math constants, remove algebraic identities and generally simplify the |
no test coverage detected