# HG changeset patch # User twisti # Date 1371791271 25200 # Node ID c88019cc87f6da3df57558220db473bee89f0b10 # Parent 6b64601aa8c8a82c941cf5a4a94eae723afd18d3 removed SPARC compiler test since SPARCBackend got moved to SPARCHotSpotBackend diff -r 6b64601aa8c8 -r c88019cc87f6 graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/ArraySPARCTest.java --- a/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/ArraySPARCTest.java Thu Jun 20 20:50:25 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2013, 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.graal.compiler.sparc.test; - -import java.lang.reflect.*; - -import org.junit.*; - -public class ArraySPARCTest extends SPARCTestBase { - - @Test - public void testArray() { - compile("testArray1I"); - compile("testArray1J"); - compile("testArray1B"); - compile("testArray1S"); - compile("testArray1C"); - compile("testArray1F"); - compile("testArray1D"); - compile("testArray1L"); - compile("testStoreArray1I"); - compile("testStoreArray1J"); - compile("testStoreArray1B"); - compile("testStoreArray1S"); - compile("testStoreArray1F"); - compile("testStoreArray1D"); - } - - public static int testArray1I(int[] array, int i) { - return array[i]; - } - - public static long testArray1J(long[] array, int i) { - return array[i]; - } - - public static byte testArray1B(byte[] array, int i) { - return array[i]; - } - - public static short testArray1S(short[] array, int i) { - return array[i]; - } - - public static char testArray1C(char[] array, int i) { - return array[i]; - } - - public static float testArray1F(float[] array, int i) { - return array[i]; - } - - public static double testArray1D(double[] array, int i) { - return array[i]; - } - - public static Object testArray1L(Object[] array, int i) { - return array[i]; - } - - public static void testStoreArray1I(int[] array, int i, int val) { - array[i] = val; - } - - public static void testStoreArray1B(byte[] array, int i, byte val) { - array[i] = val; - } - - public static void testStoreArray1S(short[] array, int i, short val) { - array[i] = val; - } - - public static void testStoreArray1J(long[] array, int i, long val) { - array[i] = val; - } - - public static void testStoreArray1F(float[] array, int i, float val) { - array[i] = val; - } - - public static void testStoreArray1D(double[] array, int i, double val) { - array[i] = val; - } - - public static void main(String[] args) { - ArraySPARCTest test = new ArraySPARCTest(); - for (Method m : ArraySPARCTest.class.getMethods()) { - String name = m.getName(); - if (m.getAnnotation(Test.class) == null && name.startsWith("test")) { - // CheckStyle: stop system..print check - System.out.println(name + ": \n" + new String(test.compile(name).getTargetCode())); - // CheckStyle: resume system..print check - } - } - } -} diff -r 6b64601aa8c8 -r c88019cc87f6 graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/BasicSPARCTest.java --- a/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/BasicSPARCTest.java Thu Jun 20 20:50:25 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013, 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.graal.compiler.sparc.test; - -import java.lang.reflect.Method; - -import org.junit.Test; - -public class BasicSPARCTest extends SPARCTestBase { - - @Test - public void testAdd() { - compile("testAddConst1I"); - } - - public int testAddConst1I(int a) { - return a + 1; - } - - public static void main(String[] args) { - BasicSPARCTest test = new BasicSPARCTest(); - Method[] methods = BasicSPARCTest.class.getMethods(); - for (Method m : methods) { - String name = m.getName(); - if (m.getAnnotation(Test.class) == null && name.startsWith("test")) { - // CheckStyle: stop system..print check - System.out.println(name + ": \n" + new String(test.compile(name).getTargetCode())); - // CheckStyle: resume system..print check - } - } - } -} diff -r 6b64601aa8c8 -r c88019cc87f6 graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/ControlSPARCTest.java --- a/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/ControlSPARCTest.java Thu Jun 20 20:50:25 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2013, 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.graal.compiler.sparc.test; - -import org.junit.Test; - -import java.lang.reflect.Method; - -public class ControlSPARCTest extends SPARCTestBase { - - @Test - public void testControl() { - compile("testSwitch1I"); - // compile("testStatic"); - compile("testCall"); - compile("testLookupSwitch1I"); - } - - public static int testSwitch1I(int a) { - switch (a) { - case 1: - return 2; - case 2: - return 3; - default: - return 4; - } - } - - public static int testLookupSwitch1I(int a) { - switch (a) { - case 0: - return 1; - case 1: - return 2; - case 2: - return 3; - case 3: - return 1; - case 4: - return 2; - case 5: - return 3; - case 6: - return 1; - case 7: - return 2; - case 8: - return 3; - case 9: - return 1; - case 10: - return 2; - case 11: - return 3; - default: - return -1; - } - } - - @SuppressWarnings("unused") private static Object foo = null; - - public static boolean testStatic(Object o) { - foo = o; - return true; - } - - private static int method(int a, int b) { - return a + b; - } - - public static int testCall(@SuppressWarnings("unused") Object o, int a, int b) { - return method(a, b); - } - - public static void main(String[] args) { - ControlSPARCTest test = new ControlSPARCTest(); - for (Method m : ControlSPARCTest.class.getMethods()) { - String name = m.getName(); - if (m.getAnnotation(Test.class) == null && name.startsWith("test")) { - // CheckStyle: stop system..print check - System.out.println(name + ": \n" + new String(test.compile(name).getTargetCode())); - // CheckStyle: resume system..print check - } - } - } -} diff -r 6b64601aa8c8 -r c88019cc87f6 graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/FloatSPARCTest.java --- a/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/FloatSPARCTest.java Thu Jun 20 20:50:25 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2013, 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.graal.compiler.sparc.test; - -import java.lang.reflect.Method; - -import org.junit.Test; - -public class FloatSPARCTest extends SPARCTestBase { - - @Test - public void testAdd() { - compile("testAdd2F"); - compile("testAdd2D"); - // compile("testAddFConst"); - // compile("testAddConstF"); - // compile("testAddDConst"); - // compile("testAddConstD"); - } - - public static float testAdd2F(float a, float b) { - return a + b; - } - - public static double testAdd2D(double a, double b) { - return a + b; - } - - public static float testAddFConst(float a) { - return a + 32.0F; - } - - public static float testAddConstF(float a) { - return 32.0F + a; - } - - public static double testAddDConst(double a) { - return a + 32.0; - } - - public static double testAddConstD(double a) { - return 32.0 + a; - } - - @Test - public void testSub() { - compile("testSub2F"); - compile("testSub2D"); - // compile("testSubFConst"); - // compile("testSubConstF"); - // compile("testSubDConst"); - // compile("testSubConstD"); - } - - public static float testSub2F(float a, float b) { - return a - b; - } - - public static double testSub2D(double a, double b) { - return a - b; - } - - public static float testSubFConst(float a) { - return a - 32.0F; - } - - public static float testSubConstF(float a) { - return 32.0F - a; - } - - public static double testSubDConst(double a) { - return a - 32.0; - } - - public static double testSubConstD(double a) { - return 32.0 - a; - } - - @Test - public void testMul() { - compile("testMul2F"); - compile("testMul2D"); - // compile("testMulFConst"); - // compile("testMulConstF"); - // compile("testMulDConst"); - // compile("testMulConstD"); - } - - public static float testMul2F(float a, float b) { - return a * b; - } - - public static double testMul2D(double a, double b) { - return a * b; - } - - public static float testMulFConst(float a) { - return a * 32.0F; - } - - public static float testMulConstF(float a) { - return 32.0F * a; - } - - public static double testMulDConst(double a) { - return a * 32.0; - } - - public static double testMulConstD(double a) { - return 32.0 * a; - } - - @Test - public void testDiv() { - compile("testDiv2F"); - compile("testDiv2D"); - // compile("testDivFConst"); - // compile("testDivConstF"); - // compile("testDivDConst"); - // compile("testDivConstD"); - } - - public static float testDiv2F(float a, float b) { - return a / b; - } - - public static double testDiv2D(double a, double b) { - return a / b; - } - - public static float testDivFConst(float a) { - return a / 32.0F; - } - - public static float testDivConstF(float a) { - return 32.0F / a; - } - - public static double testDivDConst(double a) { - return a / 32.0; - } - - public static double testDivConstD(double a) { - return 32.0 / a; - } - - @Test - public void testNeg() { - compile("testNeg2F"); - compile("testNeg2D"); - } - - public static float testNeg2F(float a) { - return -a; - } - - public static double testNeg2D(double a) { - return -a; - } - - @Test - public void testRem() { - // need linkage to PTX remainder() - // compile("testRem2F"); - // compile("testRem2D"); - } - - public static float testRem2F(float a, float b) { - return a % b; - } - - public static double testRem2D(double a, double b) { - return a % b; - } - - @Test - public void testFloatConversion() { - // compile("testF2I"); - // compile("testF2L"); - // compile("testF2D"); - // compile("testD2I"); - // compile("testD2L"); - // compile("testD2F"); - } - - public static int testF2I(float a) { - return (int) a; - } - - public static long testF2L(float a) { - return (long) a; - } - - public static double testF2D(float a) { - return a; - } - - public static int testD2I(double a) { - return (int) a; - } - - public static long testD2L(double a) { - return (long) a; - } - - public static float testD2F(double a) { - return (float) a; - } - - public static void main(String[] args) { - FloatSPARCTest test = new FloatSPARCTest(); - for (Method m : FloatSPARCTest.class.getMethods()) { - String name = m.getName(); - if (m.getAnnotation(Test.class) == null && name.startsWith("test") && name.startsWith("testRem") == false) { - // CheckStyle: stop system..print check - System.out.println(name + ": \n" + new String(test.compile(name).getTargetCode())); - // CheckStyle: resume system..print check - } - } - } -} diff -r 6b64601aa8c8 -r c88019cc87f6 graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/IntegerSPARCTest.java --- a/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/IntegerSPARCTest.java Thu Jun 20 20:50:25 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2013, 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.graal.compiler.sparc.test; - -import org.junit.Ignore; -import org.junit.Test; - -import java.lang.reflect.Method; - -public class IntegerSPARCTest extends SPARCTestBase { - - @Test - public void testAdd() { - compile("testAdd2I"); - compile("testAdd2L"); - compile("testAdd2B"); - compile("testAddIConst"); - compile("testAddConstI"); - } - - public static int testAdd2I(int a, int b) { - return a + b; - } - - public static long testAdd2L(long a, long b) { - return a + b; - } - - public static int testAdd2B(byte a, byte b) { - return a + b; - } - - public static int testAddIConst(int a) { - return a + 32; - } - - public static int testAddConstI(int a) { - return 32 + a; - } - - @Test - public void testSub() { - compile("testSub2I"); - compile("testSub2L"); - compile("testSubIConst"); - compile("testSubConstI"); - } - - public static int testSub2I(int a, int b) { - return a - b; - } - - public static long testSub2L(long a, long b) { - return a - b; - } - - public static int testSubIConst(int a) { - return a - 32; - } - - public static int testSubConstI(int a) { - return 32 - a; - } - - @Test - public void testMul() { - compile("testMul2I"); - compile("testMul2L"); - compile("testMulIConst"); - compile("testMulConstI"); - } - - public static int testMul2I(int a, int b) { - return a * b; - } - - public static long testMul2L(long a, long b) { - return a * b; - } - - public static int testMulIConst(int a) { - return a * 32; - } - - public static int testMulConstI(int a) { - return 32 * a; - } - - @Test - public void testDiv() { - compile("testDiv2I"); - compile("testDiv2L"); - compile("testDivIConst"); - } - - public static int testDiv2I(int a, int b) { - return a / b; - } - - public static long testDiv2L(long a, long b) { - return a / b; - } - - public static int testDivIConst(int a) { - return a / 32; - } - - @Ignore - public void testRem() { - compile("testRem2I"); - compile("testRem2L"); - } - - public static int testRem2I(int a, int b) { - return a % b; - } - - public static long testRem2L(long a, long b) { - return a % b; - } - - @Test - public void testIntConversion() { - compile("testI2L"); - compile("testI2C"); - compile("testI2B"); - compile("testI2F"); - compile("testI2D"); - } - - public static long testI2L(int a) { - return a; - } - - public static char testI2C(int a) { - return (char) a; - } - - public static byte testI2B(int a) { - return (byte) a; - } - - public static float testI2F(int a) { - return a; - } - - public static double testI2D(int a) { - return a; - } - - public static void main(String[] args) { - IntegerSPARCTest test = new IntegerSPARCTest(); - for (Method m : IntegerSPARCTest.class.getMethods()) { - String name = m.getName(); - if (m.getAnnotation(Test.class) == null && name.startsWith("test")) { - // CheckStyle: stop system..print check - System.out.println(name + ": \n" + new String(test.compile(name).getTargetCode())); - // CheckStyle: resume system..print check - } - } - } -} diff -r 6b64601aa8c8 -r c88019cc87f6 graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/LogicSPARCTest.java --- a/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/LogicSPARCTest.java Thu Jun 20 20:50:25 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2013, 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.graal.compiler.sparc.test; - -import java.lang.reflect.Method; - -import org.junit.Test; - -public class LogicSPARCTest extends SPARCTestBase { - - @Test - public void testAnd() { - compile("testAnd2I"); - compile("testAnd2L"); - } - - public static int testAnd2I(int a, int b) { - return a & b; - } - - public static long testAnd2L(long a, long b) { - return a & b; - } - - @Test - public void testOr() { - compile("testOr2I"); - compile("testOr2L"); - } - - public static int testOr2I(int a, int b) { - return a | b; - } - - public static long testOr2L(long a, long b) { - return a | b; - } - - @Test - public void testXor() { - compile("testXor2I"); - compile("testXor2L"); - } - - public static int testXor2I(int a, int b) { - return a ^ b; - } - - public static long testXor2L(long a, long b) { - return a ^ b; - } - - @Test - public void testNot() { - compile("testNot1I"); - compile("testNot1L"); - } - - public static int testNot1I(int a) { - return ~a; - } - - public static long testNot1L(long a) { - return ~a; - } - - @Test - public void testShiftLeft() { - compile("testShiftLeft2I"); - compile("testShiftLeft2L"); - } - - public static int testShiftLeft2I(int a, int b) { - return a << b; - } - - public static long testShiftLeft2L(long a, int b) { - return a << b; - } - - @Test - public void testShiftRight() { - compile("testShiftRight2I"); - compile("testShiftRight2L"); - compile("testUnsignedShiftRight2I"); - compile("testUnsignedShiftRight2L"); - } - - public static int testShiftRight2I(int a, int b) { - return a >> b; - } - - public static long testShiftRight2L(long a, int b) { - return a >> b; - } - - public static int testUnsignedShiftRight2I(int a, int b) { - return a >>> b; - } - - public static long testUnsignedShiftRight2L(long a, long b) { - return a >>> b; - } - - public static void main(String[] args) { - LogicSPARCTest test = new LogicSPARCTest(); - for (Method m : LogicSPARCTest.class.getMethods()) { - String name = m.getName(); - if (m.getAnnotation(Test.class) == null && name.startsWith("test")) { - // CheckStyle: stop system..print check - System.out.println(name + ": \n" + new String(test.compile(name).getTargetCode())); - // CheckStyle: resume system..print check - } - } - } -} diff -r 6b64601aa8c8 -r c88019cc87f6 graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/SPARCTestBase.java --- a/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/SPARCTestBase.java Thu Jun 20 20:50:25 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013, 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.graal.compiler.sparc.test; - -import static com.oracle.graal.api.code.CodeUtil.*; -import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.api.code.CallingConvention.*; -import com.oracle.graal.api.runtime.Graal; -import com.oracle.graal.compiler.GraalCompiler; -import com.oracle.graal.compiler.sparc.SPARCBackend; -import com.oracle.graal.compiler.test.GraalCompilerTest; -import com.oracle.graal.debug.Debug; -import com.oracle.graal.java.GraphBuilderConfiguration; -import com.oracle.graal.java.GraphBuilderPhase; -import com.oracle.graal.nodes.StructuredGraph; -import com.oracle.graal.nodes.spi.GraalCodeCacheProvider; -import com.oracle.graal.phases.OptimisticOptimizations; -import com.oracle.graal.phases.PhasePlan; -import com.oracle.graal.phases.PhasePlan.PhasePosition; -import com.oracle.graal.sparc.SPARC; - -public abstract class SPARCTestBase extends GraalCompilerTest { - - private StructuredGraph sg; - - protected CompilationResult compile(String test) { - StructuredGraph graph = parse(test); - sg = graph; - Debug.dump(graph, "Graph"); - TargetDescription target = new TargetDescription(new SPARC(), true, 1, 0, true); - SPARCBackend sparcBackend = new SPARCBackend(Graal.getRequiredCapability(GraalCodeCacheProvider.class), target); - PhasePlan phasePlan = new PhasePlan(); - GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE); - phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); - CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); - CompilationResult result = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, graalRuntime().getReplacements(), sparcBackend, target, null, phasePlan, - OptimisticOptimizations.NONE, new SpeculationLog(), suites); - return result; - } - - protected StructuredGraph getStructuredGraph() { - return sg; - } - -}