Search in sources :

Example 1 with MatchStatement

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;
                        }
                    }
                }
            }
        }
    }
}
Also used : MatchStatement(org.graalvm.compiler.core.match.MatchStatement) ValuePhiNode(org.graalvm.compiler.nodes.ValuePhiNode) AbstractMergeNode(org.graalvm.compiler.nodes.AbstractMergeNode) IfNode(org.graalvm.compiler.nodes.IfNode) VirtualObjectNode(org.graalvm.compiler.nodes.virtual.VirtualObjectNode) AbstractBeginNode(org.graalvm.compiler.nodes.AbstractBeginNode) DeoptimizingNode(org.graalvm.compiler.nodes.DeoptimizingNode) LogicNode(org.graalvm.compiler.nodes.LogicNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) DirectCallTargetNode(org.graalvm.compiler.nodes.DirectCallTargetNode) IsNullNode(org.graalvm.compiler.nodes.calc.IsNullNode) IntegerTestNode(org.graalvm.compiler.nodes.calc.IntegerTestNode) FullInfopointNode(org.graalvm.compiler.nodes.FullInfopointNode) CompareNode(org.graalvm.compiler.nodes.calc.CompareNode) IntegerSwitchNode(org.graalvm.compiler.nodes.extended.IntegerSwitchNode) LogicConstantNode(org.graalvm.compiler.nodes.LogicConstantNode) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) InvokeWithExceptionNode(org.graalvm.compiler.nodes.InvokeWithExceptionNode) SwitchNode(org.graalvm.compiler.nodes.extended.SwitchNode) LoweredCallTargetNode(org.graalvm.compiler.nodes.LoweredCallTargetNode) ParameterNode(org.graalvm.compiler.nodes.ParameterNode) ConditionalNode(org.graalvm.compiler.nodes.calc.ConditionalNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) IndirectCallTargetNode(org.graalvm.compiler.nodes.IndirectCallTargetNode) AbstractEndNode(org.graalvm.compiler.nodes.AbstractEndNode) LoopEndNode(org.graalvm.compiler.nodes.LoopEndNode) Node(org.graalvm.compiler.graph.Node) PhiNode(org.graalvm.compiler.nodes.PhiNode) LIRGenerationDebugContext(org.graalvm.compiler.lir.debug.LIRGenerationDebugContext) DebugContext(org.graalvm.compiler.debug.DebugContext)

Aggregations

MatchStatement (org.graalvm.compiler.core.match.MatchStatement)1 DebugContext (org.graalvm.compiler.debug.DebugContext)1 Node (org.graalvm.compiler.graph.Node)1 LIRGenerationDebugContext (org.graalvm.compiler.lir.debug.LIRGenerationDebugContext)1 AbstractBeginNode (org.graalvm.compiler.nodes.AbstractBeginNode)1 AbstractEndNode (org.graalvm.compiler.nodes.AbstractEndNode)1 AbstractMergeNode (org.graalvm.compiler.nodes.AbstractMergeNode)1 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)1 DeoptimizingNode (org.graalvm.compiler.nodes.DeoptimizingNode)1 DirectCallTargetNode (org.graalvm.compiler.nodes.DirectCallTargetNode)1 FixedNode (org.graalvm.compiler.nodes.FixedNode)1 FullInfopointNode (org.graalvm.compiler.nodes.FullInfopointNode)1 IfNode (org.graalvm.compiler.nodes.IfNode)1 IndirectCallTargetNode (org.graalvm.compiler.nodes.IndirectCallTargetNode)1 InvokeWithExceptionNode (org.graalvm.compiler.nodes.InvokeWithExceptionNode)1 LogicConstantNode (org.graalvm.compiler.nodes.LogicConstantNode)1 LogicNode (org.graalvm.compiler.nodes.LogicNode)1 LoopEndNode (org.graalvm.compiler.nodes.LoopEndNode)1 LoweredCallTargetNode (org.graalvm.compiler.nodes.LoweredCallTargetNode)1 ParameterNode (org.graalvm.compiler.nodes.ParameterNode)1