Mercurial > hg > graal-compiler
diff graal/GraalCompiler/src/com/sun/c1x/ir/IfOp.java @ 2827:bd17ac598c6e
Graph cloning, initial version (not completely working)
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Mon, 30 May 2011 18:46:57 +0200 |
parents | c3f64b66fc78 |
children | bfce42cd9c07 |
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/IfOp.java Mon May 30 17:05:06 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/IfOp.java Mon May 30 18:46:57 2011 +0200 @@ -26,6 +26,7 @@ import com.sun.c1x.debug.*; import com.sun.c1x.util.*; import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; /** * The {@code IfOp} class represents a comparison that yields one of two values. @@ -74,7 +75,7 @@ } - Condition cond; + Condition condition; /** * Constructs a new IfOp. @@ -87,17 +88,22 @@ public IfOp(Value x, Condition cond, Value y, Value trueValue, Value falseValue, Graph graph) { // TODO: return the appropriate bytecode IF_ICMPEQ, etc super(trueValue.kind.meet(falseValue.kind), Bytecodes.ILLEGAL, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); - this.cond = cond; + this.condition = cond; setTrueValue(trueValue); setFalseValue(falseValue); } + private IfOp(CiKind kind, Condition cond, Graph graph) { + super(kind, Bytecodes.ILLEGAL, null, null, INPUT_COUNT, SUCCESSOR_COUNT, graph); + this.condition = cond; + } + /** * Gets the condition of this if operation. * @return the condition */ public Condition condition() { - return cond; + return condition; } /** @@ -105,7 +111,7 @@ * @return {@code true} if this comparison is commutative */ public boolean isCommutative() { - return cond == Condition.EQ || cond == Condition.NE; + return condition == Condition.EQ || condition == Condition.NE; } @Override @@ -115,7 +121,7 @@ @Override public int valueNumber() { - return Util.hash4(cond.hashCode(), x(), y(), trueValue(), falseValue()); + return Util.hash4(condition.hashCode(), x(), y(), trueValue(), falseValue()); } @Override @@ -139,4 +145,11 @@ print(" : "). print(falseValue()); } + + @Override + public Node copy(Graph into) { + IfOp x = new IfOp(kind, condition, into); + x.setNonNull(isNonNull()); + return x; + } }