package org.graalvm.compiler.nodes.memory;
import org.graalvm.compiler.core.common.LIRKind;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.graph.spi.CanonicalizerTool;
import org.graalvm.compiler.nodeinfo.NodeInfo;
import org.graalvm.compiler.nodes.NodeView;
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.memory.address.AddressNode;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
import jdk.internal.vm.compiler.word.LocationIdentity;
@NodeInfo(nameTemplate = "VolatileWrite#{p#location/s}")
public class VolatileWriteNode extends WriteNode implements Lowerable {
public static final NodeClass<VolatileWriteNode> TYPE = NodeClass.create(VolatileWriteNode.class);
public VolatileWriteNode(AddressNode address, LocationIdentity location, ValueNode value, BarrierType barrierType) {
super(TYPE, address, location, value, barrierType);
}
@Override
public void generate(NodeLIRBuilderTool gen) {
LIRKind writeKind = gen.getLIRGeneratorTool().getLIRKind(value().stamp(NodeView.DEFAULT));
gen.getLIRGeneratorTool().getArithmetic().emitVolatileStore(writeKind, gen.operand(address), gen.operand(value()), gen.state(this));
}
@Override
public boolean canNullCheck() {
return false;
}
@Override
public Node canonical(CanonicalizerTool tool) {
return this;
}
@Override
public LocationIdentity getKilledLocationIdentity() {
return LocationIdentity.any();
}
}