comparison graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java @ 19396:7e2c87dae93e

Create static final NodeClass field named TYPE in Node subclasses.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 16 Feb 2015 15:43:03 +0100
parents 480bd3b1adcd
children 61d3cb8e1280
comparison
equal deleted inserted replaced
19395:a306749d3e86 19396:7e2c87dae93e
1 /* 1 /*
2 * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
24 24
25 import java.util.*; 25 import java.util.*;
26 26
27 import com.oracle.graal.api.meta.*; 27 import com.oracle.graal.api.meta.*;
28 import com.oracle.graal.compiler.common.type.*; 28 import com.oracle.graal.compiler.common.type.*;
29 import com.oracle.graal.graph.*;
29 import com.oracle.graal.graph.spi.*; 30 import com.oracle.graal.graph.spi.*;
30 import com.oracle.graal.nodeinfo.*; 31 import com.oracle.graal.nodeinfo.*;
31 import com.oracle.graal.nodes.*; 32 import com.oracle.graal.nodes.*;
32 import com.oracle.graal.nodes.spi.*; 33 import com.oracle.graal.nodes.spi.*;
33 import com.oracle.graal.nodes.util.*; 34 import com.oracle.graal.nodes.util.*;
35 /** 36 /**
36 * The {@code IntegerSwitchNode} represents a switch on integer keys, with a sorted array of key 37 * The {@code IntegerSwitchNode} represents a switch on integer keys, with a sorted array of key
37 * values. The actual implementation of the switch will be decided by the backend. 38 * values. The actual implementation of the switch will be decided by the backend.
38 */ 39 */
39 @NodeInfo 40 @NodeInfo
40 public class IntegerSwitchNode extends SwitchNode implements LIRLowerable, Simplifiable { 41 public final class IntegerSwitchNode extends SwitchNode implements LIRLowerable, Simplifiable {
42 public static final NodeClass TYPE = NodeClass.get(IntegerSwitchNode.class);
41 43
42 protected final int[] keys; 44 protected final int[] keys;
43 45
44 public IntegerSwitchNode(ValueNode value, AbstractBeginNode[] successors, int[] keys, double[] keyProbabilities, int[] keySuccessors) { 46 public IntegerSwitchNode(ValueNode value, AbstractBeginNode[] successors, int[] keys, double[] keyProbabilities, int[] keySuccessors) {
45 super(value, successors, keySuccessors, keyProbabilities); 47 super(TYPE, value, successors, keySuccessors, keyProbabilities);
46 assert keySuccessors.length == keys.length + 1; 48 assert keySuccessors.length == keys.length + 1;
47 assert keySuccessors.length == keyProbabilities.length; 49 assert keySuccessors.length == keyProbabilities.length;
48 this.keys = keys; 50 this.keys = keys;
49 assert value.stamp() instanceof PrimitiveStamp && value.stamp().getStackKind().isNumericInteger(); 51 assert value.stamp() instanceof PrimitiveStamp && value.stamp().getStackKind().isNumericInteger();
50 assert assertSorted(); 52 assert assertSorted();