< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/PhiNode.java

Print this page




 115      * @return the number of inputs in this phi
 116      */
 117     public int valueCount() {
 118         return values().size();
 119     }
 120 
 121     public void clearValues() {
 122         values().clear();
 123     }
 124 
 125     @Override
 126     public String toString(Verbosity verbosity) {
 127         if (verbosity == Verbosity.Name) {
 128             StringBuilder str = new StringBuilder();
 129             for (int i = 0; i < valueCount(); ++i) {
 130                 if (i != 0) {
 131                     str.append(' ');
 132                 }
 133                 str.append(valueAt(i) == null ? "-" : valueAt(i).toString(Verbosity.Id));
 134             }




 135             return super.toString(Verbosity.Name) + "(" + str + ")";
 136         } else {
 137             return super.toString(verbosity);
 138         }








 139     }
 140 
 141     public void addInput(ValueNode x) {
 142         assert !(x instanceof ValuePhiNode) || ((ValuePhiNode) x).merge() instanceof LoopBeginNode || ((ValuePhiNode) x).merge() != this.merge();
 143         assert !(this instanceof ValuePhiNode) || x.stamp().isCompatible(stamp());
 144         values().add(x);
 145     }
 146 
 147     public void removeInput(int index) {
 148         values().remove(index);
 149     }
 150 
 151     public NodeIterable<ValueNode> backValues() {
 152         return values().subList(merge().forwardEndCount());
 153     }
 154 
 155     /**
 156      * If all inputs are the same value, this value is returned, otherwise {@code this}. Note that
 157      * {@code null} is a valid return value, since {@link GuardPhiNode}s can have {@code null}
 158      * inputs.




 115      * @return the number of inputs in this phi
 116      */
 117     public int valueCount() {
 118         return values().size();
 119     }
 120 
 121     public void clearValues() {
 122         values().clear();
 123     }
 124 
 125     @Override
 126     public String toString(Verbosity verbosity) {
 127         if (verbosity == Verbosity.Name) {
 128             StringBuilder str = new StringBuilder();
 129             for (int i = 0; i < valueCount(); ++i) {
 130                 if (i != 0) {
 131                     str.append(' ');
 132                 }
 133                 str.append(valueAt(i) == null ? "-" : valueAt(i).toString(Verbosity.Id));
 134             }
 135             String description = valueDescription();
 136             if (description.length() > 0) {
 137                 str.append(", ").append(description);
 138             }
 139             return super.toString(Verbosity.Name) + "(" + str + ")";
 140         } else {
 141             return super.toString(verbosity);
 142         }
 143     }
 144 
 145     /**
 146      * String describing the kind of value this Phi merges. Used by {@link #toString(Verbosity)} and
 147      * dumping.
 148      */
 149     protected String valueDescription() {
 150         return "";
 151     }
 152 
 153     public void addInput(ValueNode x) {
 154         assert !(x instanceof ValuePhiNode) || ((ValuePhiNode) x).merge() instanceof LoopBeginNode || ((ValuePhiNode) x).merge() != this.merge();
 155         assert !(this instanceof ValuePhiNode) || x.stamp().isCompatible(stamp());
 156         values().add(x);
 157     }
 158 
 159     public void removeInput(int index) {
 160         values().remove(index);
 161     }
 162 
 163     public NodeIterable<ValueNode> backValues() {
 164         return values().subList(merge().forwardEndCount());
 165     }
 166 
 167     /**
 168      * If all inputs are the same value, this value is returned, otherwise {@code this}. Note that
 169      * {@code null} is a valid return value, since {@link GuardPhiNode}s can have {@code null}
 170      * inputs.


< prev index next >