# HG changeset patch # User Thomas Wuerthinger # Date 1307527240 -7200 # Node ID d7416eab9ddcc0e33597f5f42318340e2b4f3725 # Parent 385a4d7c2a785e397a2303d950fbccab2056277e# Parent c779525b27add35e0864017d10f36e58bab975f1 Merge. diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Arithmetic.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Arithmetic.java Wed Jun 08 11:59:54 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Arithmetic.java Wed Jun 08 12:00:40 2011 +0200 @@ -30,12 +30,11 @@ /** * The {@code ArithmeticOp} class represents arithmetic operations such as addition, subtraction, etc. */ -public final class Arithmetic extends Binary { +public abstract 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; /** @@ -47,10 +46,9 @@ * @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) { + public Arithmetic(CiKind kind, int opcode, Value x, Value y, boolean isStrictFP, Graph graph) { super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); this.isStrictFP = isStrictFP; - this.canTrap = canTrap; } /** @@ -72,17 +70,9 @@ @Override public void print(LogStream out) { - out.print(x()).print(' ').print(Bytecodes.operator(opcode)).print(' ').print(y()); + out.print(x()).print(' ').print(this.shortName()).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; - } + public abstract String shortName(); } diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Compare.java diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatAdd.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatAdd.java Wed Jun 08 12:00:40 2011 +0200 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 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.oracle.max.graal.compiler.ir; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + + +public final class FloatAdd extends FloatArithmetic { + + public FloatAdd(CiKind kind, Value x, Value y, boolean isStrictFP, Graph graph) { + super(kind, kind == CiKind.Double ? Bytecodes.DADD : Bytecodes.FADD, x, y, isStrictFP, graph); + } + + @Override + public String shortName() { + return "+"; + } + + @Override + public Node copy(Graph into) { + FloatAdd x = new FloatAdd(kind, null, null, isStrictFP(), graph()); + return x; + } + +} diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatArithmetic.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatArithmetic.java Wed Jun 08 12:00:40 2011 +0200 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 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.oracle.max.graal.compiler.ir; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + + +/** + * + */ +public abstract class FloatArithmetic extends Arithmetic { + + /** + * @param opcode + * @param kind + * @param x + * @param y + * @param isStrictFP + * @param graph + */ + public FloatArithmetic(CiKind kind, int opcode, Value x, Value y, boolean isStrictFP, Graph graph) { + super(kind, opcode, x, y, isStrictFP, graph); + } + +} diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatDiv.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatDiv.java Wed Jun 08 12:00:40 2011 +0200 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 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.oracle.max.graal.compiler.ir; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + + +/** + * + */ +public final class FloatDiv extends FloatArithmetic { + + /** + * @param opcode + * @param kind + * @param x + * @param y + * @param isStrictFP + * @param graph + */ + public FloatDiv(CiKind kind, Value x, Value y, boolean isStrictFP, Graph graph) { + super(kind, kind == CiKind.Double ? Bytecodes.DDIV : Bytecodes.FDIV, x, y, isStrictFP, graph); + } + + @Override + public String shortName() { + return "/"; + } + + @Override + public Node copy(Graph into) { + FloatDiv x = new FloatDiv(kind, null, null, isStrictFP(), graph()); + return x; + } + +} diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatMul.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatMul.java Wed Jun 08 12:00:40 2011 +0200 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 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.oracle.max.graal.compiler.ir; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + + +/** + * + */ +public final class FloatMul extends FloatArithmetic { + + /** + * @param opcode + * @param kind + * @param x + * @param y + * @param isStrictFP + * @param graph + */ + public FloatMul(CiKind kind, Value x, Value y, boolean isStrictFP, Graph graph) { + super(kind, kind == CiKind.Double ? Bytecodes.DMUL : Bytecodes.FMUL, x, y, isStrictFP, graph); + } + + @Override + public String shortName() { + return "*"; + } + + @Override + public Node copy(Graph into) { + FloatMul x = new FloatMul(kind, null, null, isStrictFP(), graph()); + return x; + } + +} diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatRem.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatRem.java Wed Jun 08 12:00:40 2011 +0200 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 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.oracle.max.graal.compiler.ir; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + + +/** + * + */ +public final class FloatRem extends FloatArithmetic { + + /** + * @param opcode + * @param kind + * @param x + * @param y + * @param isStrictFP + * @param graph + */ + public FloatRem(CiKind kind, Value x, Value y, boolean isStrictFP, Graph graph) { + super(kind, kind == CiKind.Double ? Bytecodes.DREM : Bytecodes.FREM, x, y, isStrictFP, graph); + } + + @Override + public String shortName() { + return "%"; + } + + @Override + public Node copy(Graph into) { + FloatRem x = new FloatRem(kind, null, null, isStrictFP(), graph()); + return x; + } + +} diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatSub.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/FloatSub.java Wed Jun 08 12:00:40 2011 +0200 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 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.oracle.max.graal.compiler.ir; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + + +public final class FloatSub extends FloatArithmetic { + + public FloatSub(CiKind kind, Value x, Value y, boolean isStrictFP, Graph graph) { + super(kind, kind == CiKind.Double ? Bytecodes.DSUB : Bytecodes.FSUB, x, y, isStrictFP, graph); + } + + @Override + public String shortName() { + return "-"; + } + + @Override + public Node copy(Graph into) { + FloatSub x = new FloatSub(kind, null, null, isStrictFP(), graph()); + return x; + } + +} diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/If.java diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerAdd.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerAdd.java Wed Jun 08 12:00:40 2011 +0200 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2011, 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.oracle.max.graal.compiler.ir; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + + +public final class IntegerAdd extends IntegerArithmetic { + + public IntegerAdd(CiKind kind, Value x, Value y, Graph graph) { + super(kind, kind == CiKind.Int ? Bytecodes.IADD : Bytecodes.LADD, x, y, graph); + } + + @Override + public Node copy(Graph into) { + IntegerAdd x = new IntegerAdd(kind, null, null, graph()); + return x; + } + + @Override + public String shortName() { + return "+"; + } + +} diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerArithmetic.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerArithmetic.java Wed Jun 08 12:00:40 2011 +0200 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2011, 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.oracle.max.graal.compiler.ir; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.ci.*; + + +public abstract class IntegerArithmetic extends Arithmetic { + + public IntegerArithmetic(CiKind kind, int opcode, Value x, Value y, Graph graph) { + super(kind, opcode, x, y, false, graph); + assert kind == CiKind.Int || kind == CiKind.Long; + } + +} diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerDiv.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerDiv.java Wed Jun 08 12:00:40 2011 +0200 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 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.oracle.max.graal.compiler.ir; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + + +public final class IntegerDiv extends IntegerArithmetic { + + public IntegerDiv(CiKind kind, Value x, Value y, Graph graph) { + super(kind, kind == CiKind.Int ? Bytecodes.IDIV : Bytecodes.LDIV, x, y, graph); + } + + @Override + public String shortName() { + return "/"; + } + + @Override + public Node copy(Graph into) { + IntegerDiv x = new IntegerDiv(kind, null, null, graph()); + return x; + } + +} diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerMul.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerMul.java Wed Jun 08 12:00:40 2011 +0200 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 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.oracle.max.graal.compiler.ir; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + + +public final class IntegerMul extends IntegerArithmetic { + + public IntegerMul(CiKind kind, Value x, Value y, Graph graph) { + super(kind, kind == CiKind.Int ? Bytecodes.IMUL : Bytecodes.LMUL, x, y, graph); + } + + @Override + public String shortName() { + return "*"; + } + + @Override + public Node copy(Graph into) { + IntegerMul x = new IntegerMul(kind, null, null, graph()); + return x; + } + +} diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerRem.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerRem.java Wed Jun 08 12:00:40 2011 +0200 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 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.oracle.max.graal.compiler.ir; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + + +public final class IntegerRem extends IntegerArithmetic { + + public IntegerRem(CiKind kind, Value x, Value y, Graph graph) { + super(kind, kind == CiKind.Int ? Bytecodes.IREM : Bytecodes.LREM, x, y, graph); + } + + @Override + public String shortName() { + return "%"; + } + + @Override + public Node copy(Graph into) { + IntegerRem x = new IntegerRem(kind, null, null, graph()); + return x; + } + +} diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerSub.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/IntegerSub.java Wed Jun 08 12:00:40 2011 +0200 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 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.oracle.max.graal.compiler.ir; + +import com.oracle.max.graal.graph.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + + +public final class IntegerSub extends IntegerArithmetic { + + public IntegerSub(CiKind kind, Value x, Value y, Graph graph) { + super(kind, kind == CiKind.Int ? Bytecodes.ISUB : Bytecodes.LSUB, x, y, graph); + } + + @Override + public Node copy(Graph into) { + IntegerSub x = new IntegerSub(kind, null, null, graph()); + return x; + } + + @Override + public String shortName() { + return "-"; + } +} diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java Wed Jun 08 11:59:54 2011 +0200 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java Wed Jun 08 12:00:40 2011 +0200 @@ -552,14 +552,36 @@ genArithmeticOp(kind, opcode, false); } - private void genArithmeticOp(CiKind kind, int opcode, boolean canTrap) { - genArithmeticOp(kind, opcode, kind, kind, canTrap); - } - - 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 Arithmetic(opcode, result, xValue, yValue, isStrict(method.accessFlags()), canTrap, graph)); + private void genArithmeticOp(CiKind result, int opcode, boolean canTrap) { + Value y = frameState.pop(result); + Value x = frameState.pop(result); + boolean isStrictFP = isStrict(method.accessFlags()); + Arithmetic v; + switch(opcode){ + case IADD: + case LADD: v = new IntegerAdd(result, x, y, graph); break; + case FADD: + case DADD: v = new FloatAdd(result, x, y, isStrictFP, graph); break; + case ISUB: + case LSUB: v = new IntegerSub(result, x, y, graph); break; + case FSUB: + case DSUB: v = new FloatSub(result, x, y, isStrictFP, graph); break; + case IMUL: + case LMUL: v = new IntegerMul(result, x, y, graph); break; + case FMUL: + case DMUL: v = new FloatMul(result, x, y, isStrictFP, graph); break; + case IDIV: + case LDIV: v = new IntegerDiv(result, x, y, graph); break; + case FDIV: + case DDIV: v = new FloatDiv(result, x, y, isStrictFP, graph); break; + case IREM: + case LREM: v = new IntegerRem(result, x, y, graph); break; + case FREM: + case DREM: v = new FloatRem(result, x, y, isStrictFP, graph); break; + default: + throw new CiBailout("should not reach"); + } + Value result1 = append(v); if (canTrap) { append(new ValueAnchor(result1, graph)); } @@ -623,7 +645,7 @@ int delta = stream().readIncrement(); Value x = frameState.localAt(index); Value y = append(Constant.forInt(delta, graph)); - frameState.storeLocal(index, append(new Arithmetic(IADD, CiKind.Int, x, y, isStrict(method.accessFlags()), false, graph))); + frameState.storeLocal(index, append(new IntegerAdd(CiKind.Int, x, y, graph))); } private void genGoto(int fromBCI, int toBCI) { diff -r 385a4d7c2a78 -r d7416eab9ddc graal/com.oracle.max.graal.graph/.checkstyle --- a/graal/com.oracle.max.graal.graph/.checkstyle Wed Jun 08 11:59:54 2011 +0200 +++ b/graal/com.oracle.max.graal.graph/.checkstyle Wed Jun 08 12:00:40 2011 +0200 @@ -1,7 +1,7 @@ - +