/** * Adds a node with a non-void kind to the graph, pushes it to the stack. If the returned node * is a {@link StateSplit} with a null {@linkplain StateSplit#stateAfter() frame state}, the * frame state is initialized. * * @param kind the kind to use when type checking this operation * @param value the value to add to the graph and push to the stack * @return a node equivalent to {@code value} in the graph */ default <T extends ValueNode> T addPush(JavaKind kind, T value) { T equivalentValue = value.graph() != null ? value : append(value); push(kind, equivalentValue); return GraphBuilderContextUtil.setStateAfterIfNecessary(this, equivalentValue); }
/** * Adds a node to the graph. If the node is in the graph, returns immediately. If the node is a * {@link StateSplit} with a null {@linkplain StateSplit#stateAfter() frame state}, the frame * state is initialized. * * @param value the value to add to the graph and push to the stack. The * {@code value.getJavaKind()} kind is used when type checking this operation. * @return a node equivalent to {@code value} in the graph */ default <T extends ValueNode> T add(T value) { if (value.graph() != null) { assert !(value instanceof StateSplit) || ((StateSplit) value).stateAfter() != null; return value; } return GraphBuilderContextUtil.setStateAfterIfNecessary(this, append(value)); }
/** * Adds a node and its inputs to the graph. If the node is in the graph, returns immediately. If * the node is a {@link StateSplit} with a null {@linkplain StateSplit#stateAfter() frame state} * , the frame state is initialized. * * @param value the value to add to the graph and push to the stack. The * {@code value.getJavaKind()} kind is used when type checking this operation. * @return a node equivalent to {@code value} in the graph */ default <T extends ValueNode> T addWithInputs(T value) { if (value.graph() != null) { assert !(value instanceof StateSplit) || ((StateSplit) value).stateAfter() != null; return value; } return GraphBuilderContextUtil.setStateAfterIfNecessary(this, append(value)); }