Search in sources :

Example 6 with Fields

use of org.graalvm.compiler.core.common.Fields in project graal by oracle.

the class CanonicalStringGraphPrinter method writeCanonicalGraphExpressionString.

protected static void writeCanonicalGraphExpressionString(ValueNode node, boolean checkConstants, boolean removeIdentities, PrintWriter writer) {
    writer.print(node.getClass().getSimpleName());
    writer.print("(");
    Fields properties = node.getNodeClass().getData();
    for (int i = 0; i < properties.getCount(); i++) {
        String dataStr = String.valueOf(properties.get(node, i));
        if (removeIdentities) {
            dataStr = removeIdentities(dataStr);
        }
        writer.print(dataStr);
        if (i + 1 < properties.getCount() || node.inputPositions().iterator().hasNext()) {
            writer.print(", ");
        }
    }
    Iterator<Position> iterator = node.inputPositions().iterator();
    while (iterator.hasNext()) {
        Position position = iterator.next();
        Node input = position.get(node);
        if (checkConstants && input instanceof ConstantNode) {
            ConstantNode constantNode = (ConstantNode) input;
            String valueString = constantNode.getValue().toValueString();
            if (removeIdentities) {
                valueString = removeIdentities(valueString);
            }
            writer.print(valueString);
        } else if (input instanceof ValueNode && !(input instanceof PhiNode) && !(input instanceof FixedNode)) {
            writeCanonicalGraphExpressionString((ValueNode) input, checkConstants, removeIdentities, writer);
        } else if (input == null) {
            writer.print("null");
        } else {
            writer.print(input.getClass().getSimpleName());
        }
        if (iterator.hasNext()) {
            writer.print(", ");
        }
    }
    writer.print(")");
}
Also used : Fields(org.graalvm.compiler.core.common.Fields) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) PhiNode(org.graalvm.compiler.nodes.PhiNode) Position(org.graalvm.compiler.graph.Position) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) FixedNode(org.graalvm.compiler.nodes.FixedNode) VirtualObjectNode(org.graalvm.compiler.nodes.virtual.VirtualObjectNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) Node(org.graalvm.compiler.graph.Node) FullInfopointNode(org.graalvm.compiler.nodes.FullInfopointNode) FixedWithNextNode(org.graalvm.compiler.nodes.FixedWithNextNode) PhiNode(org.graalvm.compiler.nodes.PhiNode) ProxyNode(org.graalvm.compiler.nodes.ProxyNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) FixedNode(org.graalvm.compiler.nodes.FixedNode)

Aggregations

Fields (org.graalvm.compiler.core.common.Fields)6 CompilationAccessImpl (com.oracle.svm.hosted.FeatureImpl.CompilationAccessImpl)1 HostedMetaAccess (com.oracle.svm.hosted.meta.HostedMetaAccess)1 Field (java.lang.reflect.Field)1 ResolvedJavaField (jdk.vm.ci.meta.ResolvedJavaField)1 Edges (org.graalvm.compiler.graph.Edges)1 Node (org.graalvm.compiler.graph.Node)1 NodeClass (org.graalvm.compiler.graph.NodeClass)1 NodeSourcePosition (org.graalvm.compiler.graph.NodeSourcePosition)1 Position (org.graalvm.compiler.graph.Position)1 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)1 FixedNode (org.graalvm.compiler.nodes.FixedNode)1 FixedWithNextNode (org.graalvm.compiler.nodes.FixedWithNextNode)1 FullInfopointNode (org.graalvm.compiler.nodes.FullInfopointNode)1 PhiNode (org.graalvm.compiler.nodes.PhiNode)1 ProxyNode (org.graalvm.compiler.nodes.ProxyNode)1 ValueNode (org.graalvm.compiler.nodes.ValueNode)1 VirtualObjectNode (org.graalvm.compiler.nodes.virtual.VirtualObjectNode)1