use of org.graalvm.compiler.core.match.MatchStatement in project graal by oracle.
the class NodeLIRBuilder method matchComplexExpressions.
@SuppressWarnings("try")
protected void matchComplexExpressions(List<Node> nodes) {
if (matchRules != null) {
DebugContext debug = gen.getResult().getLIR().getDebug();
try (DebugContext.Scope s = debug.scope("MatchComplexExpressions")) {
if (LogVerbose.getValue(nodeOperands.graph().getOptions())) {
int i = 0;
for (Node node : nodes) {
debug.log("%d: (%s) %1S", i++, node.getUsageCount(), node);
}
}
// Match the nodes in backwards order to encourage longer matches.
for (int index = nodes.size() - 1; index >= 0; index--) {
Node node = nodes.get(index);
if (getOperand(node) != null) {
continue;
}
// See if this node is the root of any MatchStatements
List<MatchStatement> statements = matchRules.get(node.getClass());
if (statements != null) {
for (MatchStatement statement : statements) {
if (statement.generate(this, index, node, nodes)) {
// Found a match so skip to the next
break;
}
}
}
}
}
}
}
Aggregations