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(")");
}
Aggregations