# HG changeset patch # User Gilles Duboscq # Date 1307441427 -7200 # Node ID c6bdec623ef909438da48367e0f21a023d619c86 # Parent 14708c03abba98972432b697f5102925356e37ae Move TypeCHeck to floating nodes, rename Nodes to aboid using an *Op suffix diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java --- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Tue Jun 07 11:36:32 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Tue Jun 07 12:10:27 2011 +0200 @@ -425,7 +425,7 @@ } @Override - public void visitIfOp(IfOp i) { + public void visitIfOp(Conditional i) { Value x = i.x(); Value y = i.y(); CiKind xtype = x.kind; diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java --- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Tue Jun 07 11:36:32 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Tue Jun 07 12:10:27 2011 +0200 @@ -543,30 +543,30 @@ private void genArithmeticOp(CiKind result, int opcode, CiKind x, CiKind y, boolean canTrap) { Value yValue = frameState.pop(y); Value xValue = frameState.pop(x); - Value result1 = append(new ArithmeticOp(opcode, result, xValue, yValue, isStrict(method.accessFlags()), canTrap, graph)); + Value result1 = append(new Arithmetic(opcode, result, xValue, yValue, isStrict(method.accessFlags()), canTrap, graph)); frameState.push(result, result1); } private void genNegateOp(CiKind kind) { - frameState.push(kind, append(new NegateOp(frameState.pop(kind), graph))); + frameState.push(kind, append(new Negate(frameState.pop(kind), graph))); } private void genShiftOp(CiKind kind, int opcode) { Value s = frameState.ipop(); Value x = frameState.pop(kind); - frameState.push(kind, append(new ShiftOp(opcode, x, s, graph))); + frameState.push(kind, append(new Shift(opcode, x, s, graph))); } private void genLogicOp(CiKind kind, int opcode) { Value y = frameState.pop(kind); Value x = frameState.pop(kind); - frameState.push(kind, append(new LogicOp(opcode, x, y, graph))); + frameState.push(kind, append(new Logic(opcode, x, y, graph))); } private void genCompareOp(CiKind kind, int opcode, CiKind resultKind) { Value y = frameState.pop(kind); Value x = frameState.pop(kind); - Value value = append(new CompareOp(opcode, resultKind, x, y, graph)); + Value value = append(new Compare(opcode, resultKind, x, y, graph)); if (!resultKind.isVoid()) { frameState.ipush(value); } @@ -582,7 +582,7 @@ int delta = stream().readIncrement(); Value x = frameState.localAt(index); Value y = append(Constant.forInt(delta, graph)); - frameState.storeLocal(index, append(new ArithmeticOp(IADD, CiKind.Int, x, y, isStrict(method.accessFlags()), false, graph))); + frameState.storeLocal(index, append(new Arithmetic(IADD, CiKind.Int, x, y, isStrict(method.accessFlags()), false, graph))); } private void genGoto(int fromBCI, int toBCI) { diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/Arithmetic.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Arithmetic.java Tue Jun 07 12:10:27 2011 +0200 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.c1x.debug.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +/** + * The {@code ArithmeticOp} class represents arithmetic operations such as addition, subtraction, etc. + */ +public final class Arithmetic extends Binary { + + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + + private final boolean canTrap; + private final boolean isStrictFP; + + /** + * Creates a new arithmetic operation. + * @param opcode the bytecode opcode + * @param kind the result kind of the operation + * @param x the first input instruction + * @param y the second input instruction + * @param isStrictFP indicates this operation has strict rounding semantics + * @param stateBefore the state for instructions that may trap + */ + public Arithmetic(int opcode, CiKind kind, Value x, Value y, boolean isStrictFP, boolean canTrap, Graph graph) { + super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); + this.isStrictFP = isStrictFP; + this.canTrap = canTrap; + } + + /** + * Checks whether this instruction has strict fp semantics. + * @return {@code true} if this instruction has strict fp semantics + */ + public boolean isStrictFP() { + return isStrictFP; + } + + @Override + public void accept(ValueVisitor v) { + v.visitArithmetic(this); + } + + public boolean isCommutative() { + return Bytecodes.isCommutative(opcode); + } + + @Override + public void print(LogStream out) { + out.print(x()).print(' ').print(Bytecodes.operator(opcode)).print(' ').print(y()); + } + + @Override + public String shortName() { + return Bytecodes.operator(opcode); + } + + @Override + public Node copy(Graph into) { + Arithmetic x = new Arithmetic(opcode, kind, null, null, isStrictFP, canTrap, into); + return x; + } +} diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/ArithmeticOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ArithmeticOp.java Tue Jun 07 11:36:32 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x.ir; - -import com.oracle.graal.graph.*; -import com.sun.c1x.debug.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -/** - * The {@code ArithmeticOp} class represents arithmetic operations such as addition, subtraction, etc. - */ -public final class ArithmeticOp extends Op2 { - - private static final int INPUT_COUNT = 0; - private static final int SUCCESSOR_COUNT = 0; - - private final boolean canTrap; - private final boolean isStrictFP; - - /** - * Creates a new arithmetic operation. - * @param opcode the bytecode opcode - * @param kind the result kind of the operation - * @param x the first input instruction - * @param y the second input instruction - * @param isStrictFP indicates this operation has strict rounding semantics - * @param stateBefore the state for instructions that may trap - */ - public ArithmeticOp(int opcode, CiKind kind, Value x, Value y, boolean isStrictFP, boolean canTrap, Graph graph) { - super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); - this.isStrictFP = isStrictFP; - this.canTrap = canTrap; - } - - /** - * Checks whether this instruction has strict fp semantics. - * @return {@code true} if this instruction has strict fp semantics - */ - public boolean isStrictFP() { - return isStrictFP; - } - - @Override - public void accept(ValueVisitor v) { - v.visitArithmeticOp(this); - } - - public boolean isCommutative() { - return Bytecodes.isCommutative(opcode); - } - - @Override - public void print(LogStream out) { - out.print(x()).print(' ').print(Bytecodes.operator(opcode)).print(' ').print(y()); - } - - @Override - public String shortName() { - return Bytecodes.operator(opcode); - } - - @Override - public Node copy(Graph into) { - ArithmeticOp x = new ArithmeticOp(opcode, kind, null, null, isStrictFP, canTrap, into); - return x; - } -} diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/Binary.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Binary.java Tue Jun 07 12:10:27 2011 +0200 @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.c1x.util.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +/** + * The {@code Op2} class is the base of arithmetic and logic operations with two inputs. + */ +public abstract class Binary extends FloatingNode { + + private static final int INPUT_COUNT = 2; + private static final int INPUT_X = 0; + private static final int INPUT_Y = 1; + + private static final int SUCCESSOR_COUNT = 0; + + @Override + protected int inputCount() { + return super.inputCount() + INPUT_COUNT; + } + + @Override + protected int successorCount() { + return super.successorCount() + SUCCESSOR_COUNT; + } + + /** + * The first input to this instruction. + */ + public Value x() { + return (Value) inputs().get(super.inputCount() + INPUT_X); + } + + public Value setX(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_X, n); + } + + /** + * The second input to this instruction. + */ + public Value y() { + return (Value) inputs().get(super.inputCount() + INPUT_Y); + } + + public Value setY(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_Y, n); + } + + /** + * The opcode of this instruction. + */ + public final int opcode; + + /** + * Creates a new Op2 instance. + * @param kind the result type of this instruction + * @param opcode the bytecode opcode + * @param x the first input instruction + * @param y the second input instruction + */ + public Binary(CiKind kind, int opcode, Value x, Value y, int inputCount, int successorCount, Graph graph) { + super(kind, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); + this.opcode = opcode; + setX(x); + setY(y); + } + + /** + * Swaps the operands of this instruction. This is only legal for commutative operations. + */ + public void swapOperands() { + assert Bytecodes.isCommutative(opcode); + Value t = x(); + setX(y()); + setY(t); + } + + @Override + public int valueNumber() { + return Util.hash2(opcode, x(), y()); + } + + @Override + public boolean valueEqual(Node i) { + if (i instanceof Binary) { + Binary o = (Binary) i; + return opcode == o.opcode && x() == o.x() && y() == o.y(); + } + return false; + } +} diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/Compare.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Compare.java Tue Jun 07 12:10:27 2011 +0200 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.c1x.debug.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +/** + * The {@code CompareOp} instruction represents comparisons such as equals, not equal, etc. + */ +public final class Compare extends Binary { + + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + + /** + * Creates a new compare operation. + * @param opcode the bytecode opcode + * @param kind the result kind + * @param x the first input + * @param y the second input + */ + public Compare(int opcode, CiKind kind, Value x, Value y, Graph graph) { + super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); + } + + @Override + public void accept(ValueVisitor v) { + v.visitCompare(this); + } + + @Override + public void print(LogStream out) { + out.print(x()). + print(' '). + print(Bytecodes.operator(opcode)). + print(' '). + print(y()); + } + + @Override + public Node copy(Graph into) { + Compare x = new Compare(opcode, kind, null, null, into); + return x; + } +} diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/CompareOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/CompareOp.java Tue Jun 07 11:36:32 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x.ir; - -import com.oracle.graal.graph.*; -import com.sun.c1x.debug.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -/** - * The {@code CompareOp} instruction represents comparisons such as equals, not equal, etc. - */ -public final class CompareOp extends Op2 { - - private static final int INPUT_COUNT = 0; - private static final int SUCCESSOR_COUNT = 0; - - /** - * Creates a new compare operation. - * @param opcode the bytecode opcode - * @param kind the result kind - * @param x the first input - * @param y the second input - */ - public CompareOp(int opcode, CiKind kind, Value x, Value y, Graph graph) { - super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); - } - - @Override - public void accept(ValueVisitor v) { - v.visitCompareOp(this); - } - - @Override - public void print(LogStream out) { - out.print(x()). - print(' '). - print(Bytecodes.operator(opcode)). - print(' '). - print(y()); - } - - @Override - public Node copy(Graph into) { - CompareOp x = new CompareOp(opcode, kind, null, null, into); - return x; - } -} diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/Conditional.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Conditional.java Tue Jun 07 12:10:27 2011 +0200 @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.c1x.ir; + +import com.oracle.graal.graph.*; +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. + * Note that these nodes are not built directly from the bytecode but are introduced + * by conditional expression elimination. + */ +public final class Conditional extends Binary { + + private static final int INPUT_COUNT = 2; + private static final int INPUT_TRUE_VALUE = 0; + private static final int INPUT_FALSE_VALUE = 1; + + private static final int SUCCESSOR_COUNT = 0; + + @Override + protected int inputCount() { + return super.inputCount() + INPUT_COUNT; + } + + @Override + protected int successorCount() { + return super.successorCount() + SUCCESSOR_COUNT; + } + + + /** + * The instruction that produces the value if the comparison is true. + */ + public Value trueValue() { + return (Value) inputs().get(super.inputCount() + INPUT_TRUE_VALUE); + } + + public Value setTrueValue(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_TRUE_VALUE, n); + } + + /** + * The instruction that produces the value if the comparison is false. + */ + public Value falseValue() { + return (Value) inputs().get(super.inputCount() + INPUT_FALSE_VALUE); + } + + public Value setFalseValue(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_FALSE_VALUE, n); + } + + + Condition condition; + + /** + * Constructs a new IfOp. + * @param x the instruction producing the first value to be compared + * @param condition the condition of the comparison + * @param y the instruction producing the second value to be compared + * @param trueValue the value produced if the condition is true + * @param falseValue the value produced if the condition is false + */ + public Conditional(Value x, Condition condition, 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.condition = condition; + setTrueValue(trueValue); + setFalseValue(falseValue); + } + + // for copying + private Conditional(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 condition; + } + + /** + * Checks whether this comparison operator is commutative (i.e. it is either == or !=). + * @return {@code true} if this comparison is commutative + */ + public boolean isCommutative() { + return condition == Condition.EQ || condition == Condition.NE; + } + + @Override + public void accept(ValueVisitor v) { + v.visitIfOp(this); + } + + @Override + public int valueNumber() { + return Util.hash4(condition.hashCode(), x(), y(), trueValue(), falseValue()); + } + + @Override + public boolean valueEqual(Node i) { + if (i instanceof Conditional) { + Conditional o = (Conditional) i; + return opcode == o.opcode && x() == o.x() && y() == o.y() && trueValue() == o.trueValue() && falseValue() == o.falseValue(); + } + return false; + } + + @Override + public void print(LogStream out) { + out.print(x()). + print(' '). + print(condition().operator). + print(' '). + print(y()). + print(" ? "). + print(trueValue()). + print(" : "). + print(falseValue()); + } + + @Override + public Node copy(Graph into) { + Conditional x = new Conditional(kind, condition, into); + return x; + } +} diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/IfOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/IfOp.java Tue Jun 07 11:36:32 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x.ir; - -import com.oracle.graal.graph.*; -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. - * Note that these nodes are not built directly from the bytecode but are introduced - * by conditional expression elimination. - */ -public final class IfOp extends Op2 { - - private static final int INPUT_COUNT = 2; - private static final int INPUT_TRUE_VALUE = 0; - private static final int INPUT_FALSE_VALUE = 1; - - private static final int SUCCESSOR_COUNT = 0; - - @Override - protected int inputCount() { - return super.inputCount() + INPUT_COUNT; - } - - @Override - protected int successorCount() { - return super.successorCount() + SUCCESSOR_COUNT; - } - - - /** - * The instruction that produces the value if the comparison is true. - */ - public Value trueValue() { - return (Value) inputs().get(super.inputCount() + INPUT_TRUE_VALUE); - } - - public Value setTrueValue(Value n) { - return (Value) inputs().set(super.inputCount() + INPUT_TRUE_VALUE, n); - } - - /** - * The instruction that produces the value if the comparison is false. - */ - public Value falseValue() { - return (Value) inputs().get(super.inputCount() + INPUT_FALSE_VALUE); - } - - public Value setFalseValue(Value n) { - return (Value) inputs().set(super.inputCount() + INPUT_FALSE_VALUE, n); - } - - - Condition condition; - - /** - * Constructs a new IfOp. - * @param x the instruction producing the first value to be compared - * @param condition the condition of the comparison - * @param y the instruction producing the second value to be compared - * @param trueValue the value produced if the condition is true - * @param falseValue the value produced if the condition is false - */ - public IfOp(Value x, Condition condition, 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.condition = condition; - setTrueValue(trueValue); - setFalseValue(falseValue); - } - - // for copying - 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 condition; - } - - /** - * Checks whether this comparison operator is commutative (i.e. it is either == or !=). - * @return {@code true} if this comparison is commutative - */ - public boolean isCommutative() { - return condition == Condition.EQ || condition == Condition.NE; - } - - @Override - public void accept(ValueVisitor v) { - v.visitIfOp(this); - } - - @Override - public int valueNumber() { - return Util.hash4(condition.hashCode(), x(), y(), trueValue(), falseValue()); - } - - @Override - public boolean valueEqual(Node i) { - if (i instanceof IfOp) { - IfOp o = (IfOp) i; - return opcode == o.opcode && x() == o.x() && y() == o.y() && trueValue() == o.trueValue() && falseValue() == o.falseValue(); - } - return false; - } - - @Override - public void print(LogStream out) { - out.print(x()). - print(' '). - print(condition().operator). - print(' '). - print(y()). - print(" ? "). - print(trueValue()). - print(" : "). - print(falseValue()); - } - - @Override - public Node copy(Graph into) { - IfOp x = new IfOp(kind, condition, into); - return x; - } -} diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/Logic.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Logic.java Tue Jun 07 12:10:27 2011 +0200 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.c1x.debug.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +/** + * The {@code LogicOp} class definition. + */ +public final class Logic extends Binary { + + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + + /** + * Constructs a new logic operation instruction. + * @param opcode the opcode of the logic operation + * @param x the first input into this instruction + * @param y the second input into this instruction + */ + public Logic(int opcode, Value x, Value y, Graph graph) { + super(x.kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); + } + + // for copying + private Logic(CiKind kind, int opcode, Graph graph) { + super(kind, opcode, null, null, INPUT_COUNT, SUCCESSOR_COUNT, graph); + } + + @Override + public void accept(ValueVisitor v) { + v.visitLogic(this); + } + + @Override + public void print(LogStream out) { + out.print(x()).print(' ').print(Bytecodes.operator(opcode)).print(' ').print(y()); + } + + @Override + public Node copy(Graph into) { + Logic x = new Logic(kind, opcode, into); + return x; + } +} diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/LogicOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/LogicOp.java Tue Jun 07 11:36:32 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x.ir; - -import com.oracle.graal.graph.*; -import com.sun.c1x.debug.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -/** - * The {@code LogicOp} class definition. - */ -public final class LogicOp extends Op2 { - - private static final int INPUT_COUNT = 0; - private static final int SUCCESSOR_COUNT = 0; - - /** - * Constructs a new logic operation instruction. - * @param opcode the opcode of the logic operation - * @param x the first input into this instruction - * @param y the second input into this instruction - */ - public LogicOp(int opcode, Value x, Value y, Graph graph) { - super(x.kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); - } - - // for copying - private LogicOp(CiKind kind, int opcode, Graph graph) { - super(kind, opcode, null, null, INPUT_COUNT, SUCCESSOR_COUNT, graph); - } - - @Override - public void accept(ValueVisitor v) { - v.visitLogicOp(this); - } - - @Override - public void print(LogStream out) { - out.print(x()).print(' ').print(Bytecodes.operator(opcode)).print(' ').print(y()); - } - - @Override - public Node copy(Graph into) { - LogicOp x = new LogicOp(kind, opcode, into); - return x; - } -} diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/Negate.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Negate.java Tue Jun 07 12:10:27 2011 +0200 @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.c1x.debug.*; +import com.sun.c1x.util.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +/** + * The {@code NegateOp} instruction negates its operand. + */ +public final class Negate extends FloatingNode { + + private static final int INPUT_COUNT = 2; + private static final int INPUT_X = 0; + private static final int INPUT_Y = 1; + + private static final int SUCCESSOR_COUNT = 0; + + @Override + protected int inputCount() { + return super.inputCount() + INPUT_COUNT; + } + + @Override + protected int successorCount() { + return super.successorCount() + SUCCESSOR_COUNT; + } + + /** + * The instruction producing input to this instruction. + */ + public Value x() { + return (Value) inputs().get(super.inputCount() + INPUT_X); + } + + public Value setX(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_X, n); + } + + /** + * Creates new NegateOp instance. + * @param x the instruction producing the value that is input to this instruction + */ + public Negate(Value x, Graph graph) { + super(x.kind, INPUT_COUNT, SUCCESSOR_COUNT, graph); + setX(x); + } + + // for copying + private Negate(CiKind kind, Graph graph) { + super(kind, INPUT_COUNT, SUCCESSOR_COUNT, graph); + } + + @Override + public void accept(ValueVisitor v) { + v.visitNegate(this); + } + + @Override + public int valueNumber() { + return Util.hash1(Bytecodes.INEG, x()); + } + + @Override + public boolean valueEqual(Node i) { + if (i instanceof Negate) { + Negate o = (Negate) i; + return x() == o.x(); + } + return false; + } + + @Override + public void print(LogStream out) { + out.print("- ").print(x()); + } + + @Override + public Node copy(Graph into) { + Negate x = new Negate(kind, into); + return x; + } +} diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/NegateOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/NegateOp.java Tue Jun 07 11:36:32 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x.ir; - -import com.oracle.graal.graph.*; -import com.sun.c1x.debug.*; -import com.sun.c1x.util.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -/** - * The {@code NegateOp} instruction negates its operand. - */ -public final class NegateOp extends FloatingNode { - - private static final int INPUT_COUNT = 2; - private static final int INPUT_X = 0; - private static final int INPUT_Y = 1; - - private static final int SUCCESSOR_COUNT = 0; - - @Override - protected int inputCount() { - return super.inputCount() + INPUT_COUNT; - } - - @Override - protected int successorCount() { - return super.successorCount() + SUCCESSOR_COUNT; - } - - /** - * The instruction producing input to this instruction. - */ - public Value x() { - return (Value) inputs().get(super.inputCount() + INPUT_X); - } - - public Value setX(Value n) { - return (Value) inputs().set(super.inputCount() + INPUT_X, n); - } - - /** - * Creates new NegateOp instance. - * @param x the instruction producing the value that is input to this instruction - */ - public NegateOp(Value x, Graph graph) { - super(x.kind, INPUT_COUNT, SUCCESSOR_COUNT, graph); - setX(x); - } - - // for copying - private NegateOp(CiKind kind, Graph graph) { - super(kind, INPUT_COUNT, SUCCESSOR_COUNT, graph); - } - - @Override - public void accept(ValueVisitor v) { - v.visitNegateOp(this); - } - - @Override - public int valueNumber() { - return Util.hash1(Bytecodes.INEG, x()); - } - - @Override - public boolean valueEqual(Node i) { - if (i instanceof NegateOp) { - NegateOp o = (NegateOp) i; - return x() == o.x(); - } - return false; - } - - @Override - public void print(LogStream out) { - out.print("- ").print(x()); - } - - @Override - public Node copy(Graph into) { - NegateOp x = new NegateOp(kind, into); - return x; - } -} diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/Op2.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Op2.java Tue Jun 07 11:36:32 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x.ir; - -import com.oracle.graal.graph.*; -import com.sun.c1x.util.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -/** - * The {@code Op2} class is the base of arithmetic and logic operations with two inputs. - */ -public abstract class Op2 extends FloatingNode { - - private static final int INPUT_COUNT = 2; - private static final int INPUT_X = 0; - private static final int INPUT_Y = 1; - - private static final int SUCCESSOR_COUNT = 0; - - @Override - protected int inputCount() { - return super.inputCount() + INPUT_COUNT; - } - - @Override - protected int successorCount() { - return super.successorCount() + SUCCESSOR_COUNT; - } - - /** - * The first input to this instruction. - */ - public Value x() { - return (Value) inputs().get(super.inputCount() + INPUT_X); - } - - public Value setX(Value n) { - return (Value) inputs().set(super.inputCount() + INPUT_X, n); - } - - /** - * The second input to this instruction. - */ - public Value y() { - return (Value) inputs().get(super.inputCount() + INPUT_Y); - } - - public Value setY(Value n) { - return (Value) inputs().set(super.inputCount() + INPUT_Y, n); - } - - /** - * The opcode of this instruction. - */ - public final int opcode; - - /** - * Creates a new Op2 instance. - * @param kind the result type of this instruction - * @param opcode the bytecode opcode - * @param x the first input instruction - * @param y the second input instruction - */ - public Op2(CiKind kind, int opcode, Value x, Value y, int inputCount, int successorCount, Graph graph) { - super(kind, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); - this.opcode = opcode; - setX(x); - setY(y); - } - - /** - * Swaps the operands of this instruction. This is only legal for commutative operations. - */ - public void swapOperands() { - assert Bytecodes.isCommutative(opcode); - Value t = x(); - setX(y()); - setY(t); - } - - @Override - public int valueNumber() { - return Util.hash2(opcode, x(), y()); - } - - @Override - public boolean valueEqual(Node i) { - if (i instanceof Op2) { - Op2 o = (Op2) i; - return opcode == o.opcode && x() == o.x() && y() == o.y(); - } - return false; - } -} diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/Shift.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Shift.java Tue Jun 07 12:10:27 2011 +0200 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.c1x.debug.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +/** + * The {@code ShiftOp} class represents shift operations. + */ +public final class Shift extends Binary { + + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + + /** + * Creates a new shift operation. + * @param opcode the opcode of the shift + * @param x the first input value + * @param y the second input value + */ + public Shift(int opcode, Value x, Value y, Graph graph) { + super(x.kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); + } + + private Shift(CiKind kind, int opcode, Graph graph) { + super(kind, opcode, null, null, INPUT_COUNT, SUCCESSOR_COUNT, graph); + } + + @Override + public void accept(ValueVisitor v) { + v.visitShift(this); + } + + @Override + public void print(LogStream out) { + out.print(x()).print(' ').print(Bytecodes.operator(opcode)).print(' ').print(y()); + } + + @Override + public Node copy(Graph into) { + Shift x = new Shift(kind, opcode, into); + return x; + } +} diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/ShiftOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ShiftOp.java Tue Jun 07 11:36:32 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x.ir; - -import com.oracle.graal.graph.*; -import com.sun.c1x.debug.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -/** - * The {@code ShiftOp} class represents shift operations. - */ -public final class ShiftOp extends Op2 { - - private static final int INPUT_COUNT = 0; - private static final int SUCCESSOR_COUNT = 0; - - /** - * Creates a new shift operation. - * @param opcode the opcode of the shift - * @param x the first input value - * @param y the second input value - */ - public ShiftOp(int opcode, Value x, Value y, Graph graph) { - super(x.kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); - } - - private ShiftOp(CiKind kind, int opcode, Graph graph) { - super(kind, opcode, null, null, INPUT_COUNT, SUCCESSOR_COUNT, graph); - } - - @Override - public void accept(ValueVisitor v) { - v.visitShiftOp(this); - } - - @Override - public void print(LogStream out) { - out.print(x()).print(' ').print(Bytecodes.operator(opcode)).print(' ').print(y()); - } - - @Override - public Node copy(Graph into) { - ShiftOp x = new ShiftOp(kind, opcode, into); - return x; - } -} diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/TypeCheck.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/TypeCheck.java Tue Jun 07 11:36:32 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/TypeCheck.java Tue Jun 07 12:10:27 2011 +0200 @@ -29,7 +29,7 @@ /** * The {@code TypeCheck} instruction is the base class of casts and instanceof tests. */ -public abstract class TypeCheck extends Value { +public abstract class TypeCheck extends FloatingNode { private static final int INPUT_COUNT = 2; private static final int INPUT_OBJECT = 0; diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/ir/ValueVisitor.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ValueVisitor.java Tue Jun 07 11:36:32 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ValueVisitor.java Tue Jun 07 12:10:27 2011 +0200 @@ -31,29 +31,29 @@ */ public abstract class ValueVisitor { // Checkstyle: stop - public abstract void visitArithmeticOp(ArithmeticOp i); + public abstract void visitArithmetic(Arithmetic i); public abstract void visitArrayLength(ArrayLength i); public abstract void visitMerge(Merge i); public abstract void visitCheckCast(CheckCast i); - public abstract void visitCompareOp(CompareOp i); + public abstract void visitCompare(Compare i); public abstract void visitConstant(Constant i); public abstract void visitConvert(Convert i); public abstract void visitExceptionObject(ExceptionObject i); public abstract void visitFrameState(FrameState i); public abstract void visitAnchor(Anchor i); public abstract void visitIf(If i); - public abstract void visitIfOp(IfOp i); + public abstract void visitIfOp(Conditional i); public abstract void visitInstanceOf(InstanceOf i); public abstract void visitInvoke(Invoke i); public abstract void visitLoadField(LoadField i); public abstract void visitLoadIndexed(LoadIndexed i); public abstract void visitLocal(Local i); - public abstract void visitLogicOp(LogicOp i); + public abstract void visitLogic(Logic i); public abstract void visitLookupSwitch(LookupSwitch i); public abstract void visitMonitorAddress(MonitorAddress monitorAddress); public abstract void visitMonitorEnter(MonitorEnter i); public abstract void visitMonitorExit(MonitorExit i); - public abstract void visitNegateOp(NegateOp i); + public abstract void visitNegate(Negate i); public abstract void visitNewInstance(NewInstance i); public abstract void visitNewMultiArray(NewMultiArray i); public abstract void visitNewObjectArray(NewObjectArray i); @@ -62,7 +62,7 @@ public abstract void visitPhi(Phi i); public abstract void visitRegisterFinalizer(RegisterFinalizer i); public abstract void visitReturn(Return i); - public abstract void visitShiftOp(ShiftOp i); + public abstract void visitShift(Shift i); public abstract void visitStoreField(StoreField i); public abstract void visitStoreIndexed(StoreIndexed i); public abstract void visitTableSwitch(TableSwitch i); diff -r 14708c03abba -r c6bdec623ef9 graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java --- a/graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java Tue Jun 07 11:36:32 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java Tue Jun 07 12:10:27 2011 +0200 @@ -124,7 +124,7 @@ } @Override - public void visitNegateOp(NegateOp x) { + public void visitNegate(Negate x) { LIRItem value = new LIRItem(x.x(), this); value.setDestroysRegister(); value.loadItem(); @@ -144,7 +144,7 @@ return false; } - public void visitArithmeticOpFloat(ArithmeticOp x) { + public void visitArithmeticOpFloat(Arithmetic x) { LIRItem left = new LIRItem(x.x(), this); LIRItem right = new LIRItem(x.y(), this); assert !left.isStack() || !right.isStack() : "can't both be memory operands"; @@ -185,7 +185,7 @@ setResult(x, reg); } - public void visitArithmeticOpLong(ArithmeticOp x) { + public void visitArithmeticOpLong(Arithmetic x) { int opcode = x.opcode; if (opcode == Bytecodes.LDIV || opcode == Bytecodes.LREM) { // emit inline 64-bit code @@ -228,7 +228,7 @@ } } - public void visitArithmeticOpInt(ArithmeticOp x) { + public void visitArithmeticOpInt(Arithmetic x) { int opcode = x.opcode; if (opcode == Bytecodes.IDIV || opcode == Bytecodes.IREM) { // emit code for integer division or modulus @@ -306,7 +306,7 @@ } } - public void visitArithmeticOpWord(ArithmeticOp x) { + public void visitArithmeticOpWord(Arithmetic x) { int opcode = x.opcode; if (opcode == Bytecodes.WDIV || opcode == Bytecodes.WREM || opcode == Bytecodes.WDIVI || opcode == Bytecodes.WREMI) { // emit code for long division or modulus @@ -359,7 +359,7 @@ } @Override - public void visitArithmeticOp(ArithmeticOp x) { + public void visitArithmetic(Arithmetic x) { trySwap(x); if (x.kind.isWord() || x.opcode == Bytecodes.WREMI) { @@ -384,7 +384,7 @@ } @Override - public void visitShiftOp(ShiftOp x) { + public void visitShift(Shift x) { // count must always be in rcx CiValue count = makeOperand(x.y()); boolean mustLoadCount = !count.isConstant() || x.kind == CiKind.Long; @@ -400,7 +400,7 @@ } @Override - public void visitLogicOp(LogicOp x) { + public void visitLogic(Logic x) { trySwap(x); LIRItem right = new LIRItem(x.y(), this); @@ -412,12 +412,12 @@ logicOp(x.opcode, reg, left, right.result()); } - private void trySwap(Op2 x) { + private void trySwap(Binary x) { // (tw) TODO: Check what this is for? } @Override - public void visitCompareOp(CompareOp x) { + public void visitCompare(Compare x) { LIRItem left = new LIRItem(x.x(), this); LIRItem right = new LIRItem(x.y(), this); if (!x.kind.isVoid() && x.x().kind.isLong()) {