public abstract class SwitchNode extends ControlSplitNode
SwitchNode
class is the base of both lookup and table switches.Node.ConstantNodeParameter, Node.InjectedNodeParameter, Node.Input, Node.NodeIntrinsic, Node.OptionalInput, Node.Successor, Node.ValueNumberable
Modifier and Type | Field and Description |
---|---|
protected double[] |
keyProbabilities |
protected int[] |
keySuccessors |
protected NodeSuccessorList<AbstractBeginNode> |
successors |
static NodeClass<SwitchNode> |
TYPE |
protected ValueNode |
value |
NODE_LIST, NOT_ITERABLE, USE_UNSAFE_TO_CLONE, WithAllEdges, WithNoEdges, WithOnlyInputEdges, WithOnlySucessorEdges
Modifier | Constructor and Description |
---|---|
protected |
SwitchNode(NodeClass<? extends SwitchNode> c,
ValueNode value,
AbstractBeginNode[] successors,
int[] keySuccessors,
double[] keyProbabilities)
Constructs a new Switch.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
assertProbabilities() |
AbstractBeginNode |
blockSuccessor(int i) |
int |
blockSuccessorCount() |
AbstractBeginNode |
defaultSuccessor()
Gets the successor corresponding to the default (fall through) case.
|
int |
defaultSuccessorIndex()
Returns the index of the default (fall through) successor of this switch.
|
abstract boolean |
equalKeys(SwitchNode switchNode)
Returns true if the switch has the same keys in the same order as this switch.
|
AbstractBeginNode |
getPrimarySuccessor()
Primary successor of the control split.
|
abstract boolean |
isSorted() |
abstract JavaConstant |
keyAt(int i)
The key at the specified position, encoded in a Constant.
|
abstract int |
keyCount()
The number of distinct keys in this switch.
|
double |
keyProbability(int i)
Returns the probability of the key at the given index.
|
AbstractBeginNode |
keySuccessor(int i)
Returns the successor for the key at the given index.
|
int |
keySuccessorIndex(int i)
Returns the index of the successor belonging to the key at the specified index.
|
protected void |
killOtherSuccessors(SimplifierTool tool,
int survivingEdge)
Delete all other successors except for the one reached by
survivingEdge . |
double |
probability(AbstractBeginNode successor) |
void |
setBlockSuccessor(int i,
AbstractBeginNode s) |
boolean |
structureEquals(SwitchNode switchNode) |
ValueNode |
value() |
asConstant, asJavaConstant, getKind, graph, inferStamp, isAllowedUsageType, isConstant, isConstantPredicate, isNullConstant, setStamp, stamp, updateStamp
acceptInputs, acceptSuccessors, afterClone, assertFalse, assertTrue, cfgPredecessors, cfgSuccessors, clearInputs, clearSuccessors, copyWithInputs, copyWithInputs, equals, fail, formatTo, getDebugProperties, getDebugProperties, getId, getNodeClass, getUsageAt, getUsageCount, hashCode, hasNoUsages, hasUsages, inputs, isAlive, isDeleted, markDeleted, modCount, newIdentityMap, newIdentityMap, newIdentityMap, newMap, newMap, newMap, newSet, newSet, predecessor, pushInputs, removeUsage, replaceAndDelete, replaceAtMatchingUsages, replaceAtPredecessor, replaceAtUsages, replaceAtUsages, replaceAtUsages, replaceFirstInput, replaceFirstSuccessor, safeDelete, simplify, successors, toString, toString, updatePredecessor, updateUsages, updateUsagesInterface, usages, valueEquals, verifyEdges, verifyInputs
public static final NodeClass<SwitchNode> TYPE
protected NodeSuccessorList<AbstractBeginNode> successors
protected final double[] keyProbabilities
protected final int[] keySuccessors
protected SwitchNode(NodeClass<? extends SwitchNode> c, ValueNode value, AbstractBeginNode[] successors, int[] keySuccessors, double[] keyProbabilities)
value
- the instruction that provides the value to be switched oversuccessors
- the list of successors of this switchprivate boolean assertProbabilities()
public double probability(AbstractBeginNode successor)
probability
in class ControlSplitNode
public abstract boolean isSorted()
public abstract int keyCount()
public abstract JavaConstant keyAt(int i)
public boolean structureEquals(SwitchNode switchNode)
public abstract boolean equalKeys(SwitchNode switchNode)
public int keySuccessorIndex(int i)
public AbstractBeginNode keySuccessor(int i)
public double keyProbability(int i)
public int defaultSuccessorIndex()
public AbstractBeginNode blockSuccessor(int i)
public void setBlockSuccessor(int i, AbstractBeginNode s)
public int blockSuccessorCount()
public AbstractBeginNode defaultSuccessor()
public AbstractBeginNode getPrimarySuccessor()
ControlSplitNode
getPrimarySuccessor
in class ControlSplitNode
protected void killOtherSuccessors(SimplifierTool tool, int survivingEdge)
survivingEdge
.tool
- survivingEdge
- index of the edge in the successors
list