T
- the common supertype of all inputs of this nodepublic static interface Canonicalizable.Unary<T extends Node> extends Canonicalizable
Canonicalizable
is intended for nodes that have exactly one
input. It has an additional canonical(CanonicalizerTool, Node)
method that looks at
the given input instead of the current input 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 forValue)
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 |
getValue()
Gets the current value of the input, so that calling
canonical(CanonicalizerTool, Node) with the value returned from this method
should behave exactly like Canonicalizable.canonical(CanonicalizerTool) . |
Node canonical(CanonicalizerTool tool, T forValue)
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 getValue()
canonical(CanonicalizerTool, 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