26 import static org.graalvm.compiler.graph.Edges.Type.Successors;
27 import static org.graalvm.compiler.graph.Graph.isModificationCountsEnabled;
28 import static org.graalvm.compiler.graph.UnsafeAccess.UNSAFE;
29
30 import java.lang.annotation.ElementType;
31 import java.lang.annotation.RetentionPolicy;
32 import java.util.Collections;
33 import java.util.EnumSet;
34 import java.util.Formattable;
35 import java.util.FormattableFlags;
36 import java.util.Formatter;
37 import java.util.HashMap;
38 import java.util.Map;
39 import java.util.Objects;
40 import java.util.function.Predicate;
41
42 import org.graalvm.compiler.core.common.Fields;
43 import org.graalvm.compiler.core.common.type.AbstractPointerStamp;
44 import org.graalvm.compiler.core.common.type.Stamp;
45 import org.graalvm.compiler.debug.DebugCloseable;
46 import org.graalvm.compiler.graph.Graph.NodeEventListener;
47 import org.graalvm.compiler.graph.Graph.Options;
48 import org.graalvm.compiler.graph.iterators.NodeIterable;
49 import org.graalvm.compiler.graph.iterators.NodePredicate;
50 import org.graalvm.compiler.graph.spi.Simplifiable;
51 import org.graalvm.compiler.graph.spi.SimplifierTool;
52 import org.graalvm.compiler.nodeinfo.InputType;
53 import org.graalvm.compiler.nodeinfo.NodeCycles;
54 import org.graalvm.compiler.nodeinfo.NodeInfo;
55 import org.graalvm.compiler.nodeinfo.NodeSize;
56 import org.graalvm.compiler.nodeinfo.Verbosity;
57 import org.graalvm.compiler.options.OptionValues;
58
59 import sun.misc.Unsafe;
60
61 /**
62 * This class is the base class for all nodes. It represents a node that can be inserted in a
63 * {@link Graph}.
64 * <p>
65 * Once a node has been added to a graph, it has a graph-unique {@link #id()}. Edges in the
246 @Override
247 public Node asNode() {
248 return this;
249 }
250
251 /**
252 * Gets the graph context of this node.
253 */
254 public Graph graph() {
255 return graph;
256 }
257
258 /**
259 * Gets the option values associated with this node's graph.
260 */
261 public final OptionValues getOptions() {
262 return graph == null ? null : graph.getOptions();
263 }
264
265 /**
266 * Returns an {@link NodeIterable iterable} which can be used to traverse all non-null input
267 * edges of this node.
268 *
269 * @return an {@link NodeIterable iterable} for all non-null input edges.
270 */
271 public NodeIterable<Node> inputs() {
272 return nodeClass.getInputIterable(this);
273 }
274
275 /**
276 * Returns an {@link Iterable iterable} which can be used to traverse all non-null input edges
277 * of this node.
278 *
279 * @return an {@link Iterable iterable} for all non-null input edges.
280 */
281 public Iterable<Position> inputPositions() {
282 return nodeClass.getInputEdges().getPositionsIterable(this);
283 }
284
285 public abstract static class EdgeVisitor {
|
26 import static org.graalvm.compiler.graph.Edges.Type.Successors;
27 import static org.graalvm.compiler.graph.Graph.isModificationCountsEnabled;
28 import static org.graalvm.compiler.graph.UnsafeAccess.UNSAFE;
29
30 import java.lang.annotation.ElementType;
31 import java.lang.annotation.RetentionPolicy;
32 import java.util.Collections;
33 import java.util.EnumSet;
34 import java.util.Formattable;
35 import java.util.FormattableFlags;
36 import java.util.Formatter;
37 import java.util.HashMap;
38 import java.util.Map;
39 import java.util.Objects;
40 import java.util.function.Predicate;
41
42 import org.graalvm.compiler.core.common.Fields;
43 import org.graalvm.compiler.core.common.type.AbstractPointerStamp;
44 import org.graalvm.compiler.core.common.type.Stamp;
45 import org.graalvm.compiler.debug.DebugCloseable;
46 import org.graalvm.compiler.debug.DebugContext;
47 import org.graalvm.compiler.graph.Graph.NodeEventListener;
48 import org.graalvm.compiler.graph.Graph.Options;
49 import org.graalvm.compiler.graph.iterators.NodeIterable;
50 import org.graalvm.compiler.graph.iterators.NodePredicate;
51 import org.graalvm.compiler.graph.spi.Simplifiable;
52 import org.graalvm.compiler.graph.spi.SimplifierTool;
53 import org.graalvm.compiler.nodeinfo.InputType;
54 import org.graalvm.compiler.nodeinfo.NodeCycles;
55 import org.graalvm.compiler.nodeinfo.NodeInfo;
56 import org.graalvm.compiler.nodeinfo.NodeSize;
57 import org.graalvm.compiler.nodeinfo.Verbosity;
58 import org.graalvm.compiler.options.OptionValues;
59
60 import sun.misc.Unsafe;
61
62 /**
63 * This class is the base class for all nodes. It represents a node that can be inserted in a
64 * {@link Graph}.
65 * <p>
66 * Once a node has been added to a graph, it has a graph-unique {@link #id()}. Edges in the
247 @Override
248 public Node asNode() {
249 return this;
250 }
251
252 /**
253 * Gets the graph context of this node.
254 */
255 public Graph graph() {
256 return graph;
257 }
258
259 /**
260 * Gets the option values associated with this node's graph.
261 */
262 public final OptionValues getOptions() {
263 return graph == null ? null : graph.getOptions();
264 }
265
266 /**
267 * Gets the debug context associated with this node's graph.
268 */
269 public final DebugContext getDebug() {
270 return graph.getDebug();
271 }
272
273 /**
274 * Returns an {@link NodeIterable iterable} which can be used to traverse all non-null input
275 * edges of this node.
276 *
277 * @return an {@link NodeIterable iterable} for all non-null input edges.
278 */
279 public NodeIterable<Node> inputs() {
280 return nodeClass.getInputIterable(this);
281 }
282
283 /**
284 * Returns an {@link Iterable iterable} which can be used to traverse all non-null input edges
285 * of this node.
286 *
287 * @return an {@link Iterable iterable} for all non-null input edges.
288 */
289 public Iterable<Position> inputPositions() {
290 return nodeClass.getInputEdges().getPositionsIterable(this);
291 }
292
293 public abstract static class EdgeVisitor {
|