package org.graalvm.compiler.nodes.calc;
import org.graalvm.compiler.core.common.type.ArithmeticOpTable;
import org.graalvm.compiler.core.common.type.ArithmeticOpTable.BinaryOp.Rem;
import org.graalvm.compiler.graph.NodeClass;
import org.graalvm.compiler.lir.gen.ArithmeticLIRGeneratorTool;
import org.graalvm.compiler.nodeinfo.NodeCycles;
import org.graalvm.compiler.nodeinfo.NodeInfo;
import org.graalvm.compiler.nodes.ValueNode;
import org.graalvm.compiler.nodes.spi.Lowerable;
import org.graalvm.compiler.nodes.spi.LoweringTool;
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
@NodeInfo(shortName = "%", cycles = NodeCycles.CYCLES_30)
public class RemNode extends BinaryArithmeticNode<Rem> implements Lowerable {
public static final NodeClass<RemNode> TYPE = NodeClass.create(RemNode.class);
public RemNode(ValueNode x, ValueNode y) {
this(TYPE, x, y);
}
protected RemNode(NodeClass<? extends RemNode> c, ValueNode x, ValueNode y) {
super(c, ArithmeticOpTable::getRem, x, y);
}
@Override
public void lower(LoweringTool tool) {
tool.getLowerer().lower(this, tool);
}
@Override
public void generate(NodeLIRBuilderTool nodeValueMap, ArithmeticLIRGeneratorTool gen) {
nodeValueMap.setResult(this, gen.emitRem(nodeValueMap.operand(getX()), nodeValueMap.operand(getY()), null));
}
}