public abstract class BinaryArithmeticNode<OP> extends BinaryNode implements ArithmeticLIRLowerable, Canonicalizable.Binary<ValueNode>
Modifier and Type | Class and Description |
---|---|
private static class |
BinaryArithmeticNode.ReassociateMatch |
protected static interface |
BinaryArithmeticNode.SerializableBinaryFunction<T> |
Node.ConstantNodeParameter, Node.InjectedNodeParameter, Node.Input, Node.NodeIntrinsic, Node.OptionalInput, Node.Successor, Node.ValueNumberable
Canonicalizable.Binary<T extends Node>, Canonicalizable.BinaryCommutative<T extends Node>, Canonicalizable.Unary<T extends Node>
Modifier and Type | Field and Description |
---|---|
protected BinaryArithmeticNode.SerializableBinaryFunction<OP> |
getOp |
static NodeClass<BinaryArithmeticNode> |
TYPE |
x, y
NODE_LIST, NOT_ITERABLE, USE_UNSAFE_TO_CLONE, WithAllEdges, WithNoEdges, WithOnlyInputEdges, WithOnlySucessorEdges
Modifier | Constructor and Description |
---|---|
protected |
BinaryArithmeticNode(NodeClass<? extends BinaryArithmeticNode<OP>> c,
BinaryArithmeticNode.SerializableBinaryFunction<OP> getOp,
ValueNode x,
ValueNode y) |
Modifier and Type | Method and Description |
---|---|
static AddNode |
add(StructuredGraph graph,
ValueNode v1,
ValueNode v2) |
static AddNode |
add(ValueNode v1,
ValueNode v2) |
ValueNode |
canonical(CanonicalizerTool tool,
ValueNode forX,
ValueNode 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. |
private static BinaryArithmeticNode.ReassociateMatch |
findReassociate(BinaryNode binary,
NodePredicate criterion) |
protected ArithmeticOpTable.BinaryOp<OP> |
getOp(ValueNode forX,
ValueNode forY) |
boolean |
inferStamp()
This method can be overridden by subclasses of
ValueNode if they need to recompute
their stamp if their inputs change. |
boolean |
isAssociative() |
protected static boolean |
livesLonger(ValueNode after,
ValueNode value,
NodeValueMap nodeValueMap) |
BinaryNode |
maybeCommuteInputs()
Ensure a canonical ordering of inputs for commutative nodes to improve GVN results.
|
static MulNode |
mul(StructuredGraph graph,
ValueNode v1,
ValueNode v2) |
static MulNode |
mul(ValueNode v1,
ValueNode v2) |
static BinaryArithmeticNode<?> |
reassociate(BinaryArithmeticNode<?> node,
NodePredicate criterion,
ValueNode forX,
ValueNode forY)
Tries to re-associate values which satisfy the criterion.
|
static SubNode |
sub(StructuredGraph graph,
ValueNode v1,
ValueNode v2) |
static SubNode |
sub(ValueNode v1,
ValueNode v2) |
static <OP> ConstantNode |
tryConstantFold(ArithmeticOpTable.BinaryOp<OP> op,
ValueNode forX,
ValueNode forY,
Stamp stamp) |
getX, getY, setX, setY
asNode
asConstant, asJavaConstant, getKind, graph, isAllowedUsageType, isConstant, isConstantPredicate, isNullConstant, setStamp, stamp, updateStamp
acceptInputs, acceptSuccessors, afterClone, assertFalse, assertTrue, cfgPredecessors, cfgSuccessors, clearInputs, clearSuccessors, copyWithInputs, copyWithInputs, equals, fail, formatTo, getDebugProperties, getDebugProperties, getId, getNodeClass, getUsageAt, getUsageCount, hashCode, hasNoUsages, hasUsages, inputs, isAlive, isDeleted, markDeleted, modCount, newIdentityMap, newIdentityMap, newIdentityMap, newMap, newMap, newMap, newSet, newSet, predecessor, pushInputs, removeUsage, replaceAndDelete, replaceAtMatchingUsages, replaceAtPredecessor, replaceAtUsages, replaceAtUsages, replaceAtUsages, replaceFirstInput, replaceFirstSuccessor, safeDelete, simplify, successors, toString, toString, updatePredecessor, updateUsages, updateUsagesInterface, usages, valueEquals, verify, verifyEdges, verifyInputs
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
generate
canonical, getX, getY
public static final NodeClass<BinaryArithmeticNode> TYPE
protected final BinaryArithmeticNode.SerializableBinaryFunction<OP> getOp
protected BinaryArithmeticNode(NodeClass<? extends BinaryArithmeticNode<OP>> c, BinaryArithmeticNode.SerializableBinaryFunction<OP> getOp, ValueNode x, ValueNode y)
protected final ArithmeticOpTable.BinaryOp<OP> getOp(ValueNode forX, ValueNode forY)
public boolean isAssociative()
public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY)
Canonicalizable.Binary
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.canonical
in interface Canonicalizable.Binary<ValueNode>
public static <OP> ConstantNode tryConstantFold(ArithmeticOpTable.BinaryOp<OP> op, ValueNode forX, ValueNode forY, Stamp stamp)
public boolean inferStamp()
ValueNode
ValueNode
if they need to recompute
their stamp if their inputs change. A typical implementation will compute the stamp and pass
it to ValueNode.updateStamp(Stamp)
, whose return value can be used as the result of this
method.inferStamp
in class ValueNode
public static AddNode add(StructuredGraph graph, ValueNode v1, ValueNode v2)
public static MulNode mul(StructuredGraph graph, ValueNode v1, ValueNode v2)
public static SubNode sub(StructuredGraph graph, ValueNode v1, ValueNode v2)
private static BinaryArithmeticNode.ReassociateMatch findReassociate(BinaryNode binary, NodePredicate criterion)
public static BinaryArithmeticNode<?> reassociate(BinaryArithmeticNode<?> node, NodePredicate criterion, ValueNode forX, ValueNode forY)
(a + 2) + 1 => a + (1 + 2)
This method accepts only associative operations such as +, -, *, &, | and ^
forY
- forX
- protected static boolean livesLonger(ValueNode after, ValueNode value, NodeValueMap nodeValueMap)
public BinaryNode maybeCommuteInputs()
Node.id
and call Graph.findDuplicate(Node)
on the node
if it's currently in a graph. It's assumed that if there was a constant on the left it's been
moved to the right by other code and that ordering is left alone.