public final class IfNode extends ControlSplitNode implements Simplifiable, LIRLowerable, IterableNodeType, SwitchFoldable
IfNode
represents a branch that can go one of two directions depending on the outcome
of a comparison.Modifier and Type | Class and Description |
---|---|
static class |
IfNode.NodeColor |
Node.ConstantNodeParameter, Node.EdgeVisitor, Node.IndirectCanonicalization, Node.InjectedNodeParameter, Node.Input, Node.NodeInsertionStackTrace, Node.NodeIntrinsic, Node.NodeIntrinsicFactory, Node.OptionalInput, Node.Successor, Node.ValueNumberable
SwitchFoldable.Helper, SwitchFoldable.KeyData, SwitchFoldable.QuickQueryKeyData, SwitchFoldable.QuickQueryList<T>
Modifier and Type | Field and Description |
---|---|
protected ProfileData.BranchProbabilityData |
profileData |
static NodeClass<IfNode> |
TYPE |
EMPTY_ARRAY, stamp
NODE_LIST, NOT_ITERABLE, TRACK_CREATION_POSITION, WithAllEdges, WithNoEdges, WithOnlyInputEdges, WithOnlySucessorEdges
SORTER
Constructor and Description |
---|
IfNode(LogicNode condition,
AbstractBeginNode trueSuccessor,
AbstractBeginNode falseSuccessor,
ProfileData.BranchProbabilityData profileData) |
IfNode(LogicNode condition,
FixedNode trueSuccessor,
FixedNode falseSuccessor,
ProfileData.BranchProbabilityData profileData) |
Modifier and Type | Method and Description |
---|---|
LogicNode |
condition() |
static Constant[] |
constantValues(ValueNode node,
AbstractMergeNode merge,
boolean allowNull)
Gets an array of constants derived from a node that is either a
ConstantNode or a
PhiNode whose input values are all constants. |
void |
cutOffCascadeNode()
Removes the successors of this node, while keeping it linked to the rest of the cascade.
|
void |
cutOffLowestCascadeNode()
Completely removes all successors from this node.
|
double |
defaultProbability()
Returns the probability of going to the default branch.
|
void |
eliminateNegation() |
AbstractBeginNode |
falseSuccessor()
Gets the false successor.
|
void |
generate(NodeLIRBuilderTool gen) |
AbstractBeginNode |
getDefault()
Returns the branch that will close this switch folding, assuming this is called on the lowest
node of the cascade.
|
Node |
getNextSwitchFoldableBranch()
Returns the direct successor in the branch to check for SwitchFoldability.
|
AbstractBeginNode |
getPrimarySuccessor()
Primary successor of the control split.
|
ProfileData.BranchProbabilityData |
getProfileData()
Returns the source of this node's knowledge about its successor probabilities.
|
AbstractBeginNode |
getSuccessor(boolean result) |
int |
getSuccessorCount()
Returns the number of successors.
|
double |
getTrueSuccessorProbability() |
int |
intKeyAt(int i)
Returns the value of the i-th key of this node.
|
boolean |
isInSwitch(ValueNode switchValue)
Determines whether the node should be folded in the current folding attempt.
|
boolean |
isNonInitializedProfile()
Heuristics that tries to determine whether or not a foldable node was profiled.
|
static boolean |
isWorthPerformingSplit(LogicNode newCondition,
LogicNode originalCondition) |
double |
keyProbability(int i)
Returns the probability of seeing the i-th key of this node.
|
AbstractBeginNode |
keySuccessor(int i)
Returns the branch to follow when seeing the i-th key of this node.
|
double |
probability(AbstractBeginNode successor) |
ProfileData.ProfileSource |
profileSource()
Returns the source of the information about branch probabilities of this node.
|
protected void |
removeThroughFalseBranch(SimplifierTool tool,
AbstractMergeNode merge) |
static boolean |
sameDestination(AbstractBeginNode succ1,
AbstractBeginNode succ2)
Check it these two blocks end up at the same place.
|
void |
setCondition(LogicNode x) |
void |
setFalseSuccessor(AbstractBeginNode node) |
boolean |
setProbability(AbstractBeginNode successor,
ProfileData.BranchProbabilityData profileData)
Attempts to set the probability for the given successor to the passed value (which has to be
in the range of 0.0 and 1.0).
|
void |
setTrueSuccessor(AbstractBeginNode node) |
void |
setTrueSuccessorProbability(ProfileData.BranchProbabilityData profileData) |
void |
simplify(SimplifierTool tool) |
AbstractBeginNode |
successor(boolean istrue)
Gets the node corresponding to the specified outcome of the branch.
|
ValueNode |
switchValue()
Returns the value that will be used as the switch input.
|
AbstractBeginNode |
trueSuccessor()
Gets the true successor.
|
protected ProfileData.BranchProbabilityData |
trueSuccessorProfile() |
boolean |
verify() |
boolean |
verifySourcePosition() |
successorProbabilities
asFixedNode
asConstant, asJavaConstant, asNode, asSerializableConstant, checkReplaceAtUsagesInvariants, getStackKind, graph, hasUsagesOtherThan, inferStamp, isAllowedUsageType, isConstant, isConstantPredicate, isDefaultConstant, isIllegalConstant, isJavaConstant, isNullConstant, isSerializableConstant, recursivelyDataFlowEqualsUpTo, setStamp, stamp, updateStamp, updateUsagesInterface
afterClone, applyInputs, applySuccessors, assertFalse, assertTrue, cfgPredecessors, cfgSuccessors, clearInputs, clearNodeSourcePosition, clearSuccessors, copyWithInputs, copyWithInputs, dataFlowEquals, dynamicNodeSizeEstimate, estimatedNodeCycles, estimatedNodeSize, fail, formatTo, getCreationPosition, getDebug, getDebugProperties, getDebugProperties, getInsertionPosition, getNodeClass, getNodeSourcePosition, getOptions, getUsageCount, hasExactlyOneUsage, hasExactlyOneUsageOfType, hashCode, hasMoreThanOneUsage, hasNoUsages, hasOnlyUsagesOfType, hasUsages, hasUsagesOfType, inputPositions, inputs, isAlive, isDeleted, isUnregistered, markDeleted, maybeNotifyZeroUsages, modCount, predecessor, pushInputs, removeUsage, replaceAllInputs, replaceAndDelete, replaceAtAllUsages, replaceAtMatchingUsages, replaceAtPredecessor, replaceAtUsages, replaceAtUsages, replaceAtUsages, replaceAtUsages, replaceAtUsages, replaceAtUsagesAndDelete, replaceAtUsagesAndDelete, replaceFirstInput, replaceFirstSuccessor, safeDelete, setCreationPosition, setInsertionPosition, setNodeSourcePosition, singleUsage, successorPositions, successors, toString, toString, updateNodeSourcePosition, updatePredecessor, updateUsages, usages, valueEquals, verifyEdges, verifyInputs, withNodeSourcePosition
clone, equals, getClass, notify, notifyAll, wait, wait, wait
isDefaultSuccessor, keyCount, maybeIsInSwitch, sameSwitchValue, switchTransformationOptimization
asNode
protected ProfileData.BranchProbabilityData profileData
public IfNode(LogicNode condition, FixedNode trueSuccessor, FixedNode falseSuccessor, ProfileData.BranchProbabilityData profileData)
public IfNode(LogicNode condition, AbstractBeginNode trueSuccessor, AbstractBeginNode falseSuccessor, ProfileData.BranchProbabilityData profileData)
public LogicNode condition()
public void setCondition(LogicNode x)
public AbstractBeginNode trueSuccessor()
public AbstractBeginNode falseSuccessor()
public double getTrueSuccessorProbability()
public void setTrueSuccessor(AbstractBeginNode node)
public void setFalseSuccessor(AbstractBeginNode node)
public AbstractBeginNode successor(boolean istrue)
istrue
- true
if the true successor is requested, false
otherwisepublic void setTrueSuccessorProbability(ProfileData.BranchProbabilityData profileData)
protected ProfileData.BranchProbabilityData trueSuccessorProfile()
public double probability(AbstractBeginNode successor)
probability
in class ControlSplitNode
public void generate(NodeLIRBuilderTool gen)
generate
in interface LIRLowerable
public boolean verifySourcePosition()
verifySourcePosition
in class Node
public void eliminateNegation()
public void simplify(SimplifierTool tool)
simplify
in interface Simplifiable
public static boolean isWorthPerformingSplit(LogicNode newCondition, LogicNode originalCondition)
public Node getNextSwitchFoldableBranch()
SwitchFoldable
getNextSwitchFoldableBranch
in interface SwitchFoldable
public boolean isInSwitch(ValueNode switchValue)
SwitchFoldable
isInSwitch
in interface SwitchFoldable
switchValue
- the value of the switch that will spawn through this folding attempt.SwitchFoldable.maybeIsInSwitch(LogicNode)
,
SwitchFoldable.sameSwitchValue(LogicNode, ValueNode)
public void cutOffCascadeNode()
SwitchFoldable
cutOffCascadeNode
in interface SwitchFoldable
public void cutOffLowestCascadeNode()
SwitchFoldable
cutOffLowestCascadeNode
in interface SwitchFoldable
public AbstractBeginNode getDefault()
SwitchFoldable
getDefault
in interface SwitchFoldable
public ValueNode switchValue()
SwitchFoldable
switchValue
in interface SwitchFoldable
public boolean isNonInitializedProfile()
SwitchFoldable
isNonInitializedProfile
in interface SwitchFoldable
public ProfileData.ProfileSource profileSource()
SwitchFoldable
profileSource
in interface SwitchFoldable
public ProfileData.BranchProbabilityData getProfileData()
ControlSplitNode
getProfileData
in class ControlSplitNode
public int intKeyAt(int i)
SwitchFoldable
intKeyAt
in interface SwitchFoldable
public double keyProbability(int i)
SwitchFoldable
keyProbability
in interface SwitchFoldable
public AbstractBeginNode keySuccessor(int i)
SwitchFoldable
keySuccessor
in interface SwitchFoldable
public double defaultProbability()
SwitchFoldable
defaultProbability
in interface SwitchFoldable
public static boolean sameDestination(AbstractBeginNode succ1, AbstractBeginNode succ2)
protected void removeThroughFalseBranch(SimplifierTool tool, AbstractMergeNode merge)
public static Constant[] constantValues(ValueNode node, AbstractMergeNode merge, boolean allowNull)
ConstantNode
or a
PhiNode
whose input values are all constants. The length of the returned array is
equal to the number of ends terminating in a given merge node.node
is neither a ConstantNode
nor a PhiNode
whose
input values are all constantspublic AbstractBeginNode getPrimarySuccessor()
ControlSplitNode
getPrimarySuccessor
in class ControlSplitNode
public AbstractBeginNode getSuccessor(boolean result)
public boolean setProbability(AbstractBeginNode successor, ProfileData.BranchProbabilityData profileData)
ControlSplitNode
profileData
's profile source.setProbability
in class ControlSplitNode
public int getSuccessorCount()
ControlSplitNode
getSuccessorCount
in class ControlSplitNode