Skip to content

Commit

Permalink
Make OpaqueValueNode no longer LIRLowerable
Browse files Browse the repository at this point in the history
  • Loading branch information
c-refice committed Feb 27, 2024
1 parent 813d8d7 commit 240f142
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,21 @@
import jdk.graal.compiler.nodes.NodeView;
import jdk.graal.compiler.nodes.ValueNode;
import jdk.graal.compiler.nodes.spi.LIRLowerable;
import jdk.graal.compiler.nodes.spi.NodeLIRBuilderTool;
import jdk.graal.compiler.phases.common.RemoveOpaqueValuePhase;

/**
* This node type acts as an optimization barrier between its input node and its usages. For
* example, a MulNode with two ConstantNodes as input will be canonicalized to a ConstantNode. This
* optimization will be prevented if either of the two constants is wrapped by an OpaqueValueNode.
* <p>
* </p>
* This node is not {@link LIRLowerable}, so it should be removed from the graph before LIR
* generation.
*
* @see RemoveOpaqueValuePhase
*/
@NodeInfo(cycles = CYCLES_0, size = SIZE_0)
public final class OpaqueValueNode extends OpaqueNode implements NodeWithIdentity, LIRLowerable, GuardingNode, IterableNodeType {
public final class OpaqueValueNode extends OpaqueNode implements NodeWithIdentity, GuardingNode, IterableNodeType {
public static final NodeClass<OpaqueValueNode> TYPE = NodeClass.create(OpaqueValueNode.class);

@Input(InputType.Value) private ValueNode value;
Expand All @@ -58,9 +69,4 @@ public void setValue(ValueNode value) {
this.updateUsages(this.value, value);
this.value = value;
}

@Override
public void generate(NodeLIRBuilderTool gen) {
gen.setResult(this, gen.operand(getValue()));
}
}

0 comments on commit 240f142

Please sign in to comment.