< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/match/MatchStatement.java
Print this page
*** 24,45 ****
package org.graalvm.compiler.core.match;
import static org.graalvm.compiler.debug.DebugOptions.LogVerbose;
- import java.util.List;
-
import org.graalvm.compiler.core.gen.NodeLIRBuilder;
import org.graalvm.compiler.core.match.MatchPattern.MatchResultCode;
import org.graalvm.compiler.core.match.MatchPattern.Result;
import org.graalvm.compiler.debug.CounterKey;
import org.graalvm.compiler.debug.DebugContext;
import org.graalvm.compiler.graph.GraalGraphError;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.nodeinfo.Verbosity;
import jdk.vm.ci.meta.Value;
/**
* A named {@link MatchPattern} along with a {@link MatchGenerator} that can be evaluated to replace
* one or more {@link Node}s with a single {@link Value}.
*/
--- 24,45 ----
package org.graalvm.compiler.core.match;
import static org.graalvm.compiler.debug.DebugOptions.LogVerbose;
import org.graalvm.compiler.core.gen.NodeLIRBuilder;
import org.graalvm.compiler.core.match.MatchPattern.MatchResultCode;
import org.graalvm.compiler.core.match.MatchPattern.Result;
import org.graalvm.compiler.debug.CounterKey;
import org.graalvm.compiler.debug.DebugContext;
import org.graalvm.compiler.graph.GraalGraphError;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.nodeinfo.Verbosity;
import jdk.vm.ci.meta.Value;
+ import org.graalvm.compiler.nodes.StructuredGraph;
+ import org.graalvm.compiler.nodes.cfg.Block;
/**
* A named {@link MatchPattern} along with a {@link MatchGenerator} that can be evaluated to replace
* one or more {@link Node}s with a single {@link Value}.
*/
*** 78,101 ****
/**
* Attempt to match the current statement against a Node.
*
* @param builder the current builder instance.
* @param node the node to be matched
! * @param nodes the nodes in the current block
* @return true if the statement matched something and set a {@link ComplexMatchResult} to be
* evaluated by the NodeLIRBuilder.
*/
! public boolean generate(NodeLIRBuilder builder, int index, Node node, List<Node> nodes) {
DebugContext debug = node.getDebug();
! assert index == nodes.indexOf(node);
// Check that the basic shape matches
Result result = pattern.matchShape(node, this);
if (result != Result.OK) {
return false;
}
// Now ensure that the other safety constraints are matched.
! MatchContext context = new MatchContext(builder, this, index, node, nodes);
result = pattern.matchUsage(node, context);
if (result == Result.OK) {
// Invoke the generator method and set the result if it's non null.
ComplexMatchResult value = generatorMethod.match(builder.getNodeMatchRules(), buildArgList(context));
if (value != null) {
--- 78,102 ----
/**
* Attempt to match the current statement against a Node.
*
* @param builder the current builder instance.
* @param node the node to be matched
! * @param block the current block
! * @param schedule the schedule that's being used
* @return true if the statement matched something and set a {@link ComplexMatchResult} to be
* evaluated by the NodeLIRBuilder.
*/
! public boolean generate(NodeLIRBuilder builder, int index, Node node, Block block, StructuredGraph.ScheduleResult schedule) {
DebugContext debug = node.getDebug();
! assert index == schedule.getBlockToNodesMap().get(block).indexOf(node);
// Check that the basic shape matches
Result result = pattern.matchShape(node, this);
if (result != Result.OK) {
return false;
}
// Now ensure that the other safety constraints are matched.
! MatchContext context = new MatchContext(builder, this, index, node, block, schedule);
result = pattern.matchUsage(node, context);
if (result == Result.OK) {
// Invoke the generator method and set the result if it's non null.
ComplexMatchResult value = generatorMethod.match(builder.getNodeMatchRules(), buildArgList(context));
if (value != null) {
< prev index next >