< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/gen/NodeLIRBuilder.java

Print this page

        

*** 46,55 **** --- 46,56 ---- import org.graalvm.compiler.core.common.type.Stamp; import org.graalvm.compiler.core.match.ComplexMatchValue; import org.graalvm.compiler.core.match.MatchPattern; import org.graalvm.compiler.core.match.MatchRuleRegistry; import org.graalvm.compiler.core.match.MatchStatement; + import org.graalvm.compiler.debug.DebugCloseable; import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.debug.GraalError; import org.graalvm.compiler.debug.TTY; import org.graalvm.compiler.graph.GraalGraphError; import org.graalvm.compiler.graph.Node;
*** 253,263 **** ValueNode node = phi.valueAt(i); Value value = getOperand(node); // get ValueKind for input final LIRKind valueKind; ! if (value != null) { valueKind = value.getValueKind(LIRKind.class); } else { assert isPhiInputFromBackedge(phi, i) : String.format("Input %s to phi node %s is not yet available although it is not coming from a loop back edge", node, phi); LIRKind kind = gen.getLIRKind(node.stamp(NodeView.DEFAULT)); valueKind = gen.toRegisterKind(kind); --- 254,264 ---- ValueNode node = phi.valueAt(i); Value value = getOperand(node); // get ValueKind for input final LIRKind valueKind; ! if (value != null && !(value instanceof ComplexMatchValue)) { valueKind = value.getValueKind(LIRKind.class); } else { assert isPhiInputFromBackedge(phi, i) : String.format("Input %s to phi node %s is not yet available although it is not coming from a loop back edge", node, phi); LIRKind kind = gen.getLIRKind(node.stamp(NodeView.DEFAULT)); valueKind = gen.toRegisterKind(kind);
*** 356,369 **** } doBlockPrologue(block, options); List<Node> nodes = blockMap.get(block); - // Allow NodeLIRBuilder subclass to specialize code generation of any interesting groups - // of instructions - matchComplexExpressions(nodes); - boolean trace = traceLIRGeneratorLevel >= 3; for (int i = 0; i < nodes.size(); i++) { Node node = nodes.get(i); if (node instanceof ValueNode) { setSourcePosition(node.getNodeSourcePosition()); --- 357,366 ----
*** 417,431 **** assert verifyBlock(gen.getResult().getLIR(), block); } } @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); } --- 414,440 ---- assert verifyBlock(gen.getResult().getLIR(), block); } } + @Override @SuppressWarnings("try") ! public void matchBlock(Block block, StructuredGraph graph, StructuredGraph.ScheduleResult schedule) { ! try (DebugCloseable matchScope = gen.getMatchScope(block)) { ! // Allow NodeLIRBuilder subclass to specialize code generation of any interesting groups ! // of instructions ! matchComplexExpressions(block, schedule); ! } ! } ! ! @SuppressWarnings("try") ! protected void matchComplexExpressions(Block block, StructuredGraph.ScheduleResult schedule) { ! if (matchRules != null) { DebugContext debug = gen.getResult().getLIR().getDebug(); try (DebugContext.Scope s = debug.scope("MatchComplexExpressions")) { + List<Node> nodes = schedule.getBlockToNodesMap().get(block); if (LogVerbose.getValue(nodeOperands.graph().getOptions())) { int i = 0; for (Node node : nodes) { debug.log("%d: (%s) %1S", i++, node.getUsageCount(), node); }
*** 439,449 **** } // 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; } } } --- 448,458 ---- } // 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, block, schedule)) { // Found a match so skip to the next break; } } }
< prev index next >