Mercurial > hg > graal-compiler
comparison graal/GraalCompiler/src/com/sun/c1x/ir/IfOp.java @ 2587:51ebe5f0516f
changed NegateOp, more Op2 changes (generic inputValuesDo impl)
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 05 May 2011 15:01:34 +0200 |
parents | 421da5f53b5e |
children | 092e628ddd5d |
comparison
equal
deleted
inserted
replaced
2586:421da5f53b5e | 2587:51ebe5f0516f |
---|---|
86 * @param trueValue the value produced if the condition is true | 86 * @param trueValue the value produced if the condition is true |
87 * @param falseValue the value produced if the condition is false | 87 * @param falseValue the value produced if the condition is false |
88 */ | 88 */ |
89 public IfOp(Value x, Condition cond, Value y, Value trueValue, Value falseValue, Graph graph) { | 89 public IfOp(Value x, Condition cond, Value y, Value trueValue, Value falseValue, Graph graph) { |
90 // TODO: return the appropriate bytecode IF_ICMPEQ, etc | 90 // TODO: return the appropriate bytecode IF_ICMPEQ, etc |
91 super(trueValue.kind.meet(falseValue.kind), Bytecodes.ILLEGAL, x, y, graph); | 91 super(trueValue.kind.meet(falseValue.kind), Bytecodes.ILLEGAL, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); |
92 this.cond = cond; | 92 this.cond = cond; |
93 setTrueValue(trueValue); | 93 setTrueValue(trueValue); |
94 setFalseValue(falseValue); | 94 setFalseValue(falseValue); |
95 } | 95 } |
96 | 96 |
106 * Checks whether this comparison operator is commutative (i.e. it is either == or !=). | 106 * Checks whether this comparison operator is commutative (i.e. it is either == or !=). |
107 * @return {@code true} if this comparison is commutative | 107 * @return {@code true} if this comparison is commutative |
108 */ | 108 */ |
109 public boolean isCommutative() { | 109 public boolean isCommutative() { |
110 return cond == Condition.EQ || cond == Condition.NE; | 110 return cond == Condition.EQ || cond == Condition.NE; |
111 } | |
112 | |
113 @Override | |
114 public void inputValuesDo(ValueClosure closure) { | |
115 super.inputValuesDo(closure); | |
116 setTrueValue(closure.apply(trueValue())); | |
117 setFalseValue(closure.apply(falseValue())); | |
118 } | 111 } |
119 | 112 |
120 @Override | 113 @Override |
121 public void accept(ValueVisitor v) { | 114 public void accept(ValueVisitor v) { |
122 v.visitIfOp(this); | 115 v.visitIfOp(this); |