T
- the common supertype of all inputs of this nodepublic static interface Canonicalizable.Binary<T extends Node> extends Canonicalizable
Canonicalizable
is intended for nodes that have exactly two
inputs. It has an additional canonical(CanonicalizerTool, Node, Node)
method that
looks at the given inputs instead of the current inputs of the node - which can be used to
ask "what if this input is changed to this node" - questions.Canonicalizable.Binary<T extends Node>, Canonicalizable.BinaryCommutative<T extends Node>, Canonicalizable.Unary<T extends Node>
Modifier and Type | Method and Description |
---|---|
default Node |
canonical(CanonicalizerTool tool)
Implementations of this method can provide local optimizations like constant folding and
strength reduction.
|
Node |
canonical(CanonicalizerTool tool,
T forX,
T forY)
Similar to
Canonicalizable.canonical(CanonicalizerTool) , except that
implementations should act as if the current input of the node was the given one, i.e.,
they should never look at the inputs via the this pointer. |
T |
getX()
Gets the current value of the input, so that calling
canonical(CanonicalizerTool, Node, Node) with the value returned from this
method should behave exactly like Canonicalizable.canonical(CanonicalizerTool) . |
T |
getY()
Gets the current value of the input, so that calling
canonical(CanonicalizerTool, Node, Node) with the value returned from this
method should behave exactly like Canonicalizable.canonical(CanonicalizerTool) . |
Node canonical(CanonicalizerTool tool, T forX, T forY)
Canonicalizable.canonical(CanonicalizerTool)
, except that
implementations should act as if the current input of the node was the given one, i.e.,
they should never look at the inputs via the this pointer.T getX()
canonical(CanonicalizerTool, Node, Node)
with the value returned from this
method should behave exactly like Canonicalizable.canonical(CanonicalizerTool)
.T getY()
canonical(CanonicalizerTool, Node, Node)
with the value returned from this
method should behave exactly like Canonicalizable.canonical(CanonicalizerTool)
.default Node canonical(CanonicalizerTool tool)
Canonicalizable
null
will delete the current node and replace it with null
at
all usages. Note that it is not necessary to delete floating nodes that have no more usages
this way - they will be deleted automatically.canonical
in interface Canonicalizable
tool
- provides access to runtime interfaces like MetaAccessProvider