changeset 9844:2d1687e63484

SPARCMacroAssembler and synthetic instructions
author Morris Meyer <morris.meyer@oracle.com>
date Fri, 31 May 2013 21:55:53 -0400
parents e05af215586b
children 204e8f3209e9
files graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCMacroAssembler.java graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCompare.java graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java graal/com.oracle.graal.sparc/src/com/oracle/graal/sparc/SPARC.java
diffstat 5 files changed, 313 insertions(+), 205 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java	Thu May 30 22:56:22 2013 -0400
+++ b/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java	Fri May 31 21:55:53 2013 -0400
@@ -194,6 +194,16 @@
         }
     }
 
+    public static class Fmt3r {
+        public Fmt3r(SPARCAssembler masm, int op, int fcn, int op3) {
+            assert  op == 23;
+            assert op3 >= 0 && op3 < 0x40;
+            assert fcn >= 0 && fcn < 0x40;
+
+            masm.emitInt(op << 30 | fcn << 25 | op3 << 19);
+        }
+    }
+
     public static class Fmt4c {
         public Fmt4c(SPARCAssembler masm, int op, int op3, int cond, int cc, int rs2, int rd) {
             assert op == 2;
@@ -597,11 +607,6 @@
         return x & ((1 << 10) - 1);
     }
 
-    private static int fcn(int val) {
-        assert val < 0x20;
-        return (val << 25);
-    }
-
     public static class Add extends Fmt3b {
         public Add(SPARCAssembler masm, Register src1, int simm13, Register dst) {
             super(masm, Ops.ArithOp.getValue(), Op3s.Add.getValue(), src1.encoding(), simm13, dst.encoding());
@@ -722,16 +727,6 @@
         }
     }
 
-    @SuppressWarnings("unused")
-    public static class Cmp {
-        public Cmp(SPARCAssembler masm, Register a, Register b) {
-            new Subcc(masm, a, b, SPARC.r0);
-        }
-        public Cmp(SPARCAssembler masm, Register a, int simm13) {
-            new Subcc(masm, a, simm13, SPARC.r0);
-        }
-    }
-
     private static int patchUnbound(SPARCAssembler masm, Label label) {
         label.addPatchAt(masm.codeBuffer.position());
         return 0;
@@ -814,8 +809,10 @@
         }
     }
 
-    public final void flushw() {
-        emitInt(Ops.ArithOp.getValue() | Op3s.Flushw.getValue());
+    public static class Flushw extends Fmt3r {
+        public Flushw(SPARCAssembler masm) {
+            super(masm, Ops.ArithOp.getValue(), 0, Op3s.Flushw.getValue());
+        }
     }
 
     public static class Fsubs extends Fmt3p {
@@ -845,6 +842,13 @@
         new Bpa(this, l);
     }
 
+    public static class Jmpl extends Fmt3b {
+        public Jmpl(SPARCAssembler asm, SPARCAddress src, Register dst) {
+            super(asm, Ops.ArithOp.getValue(), Op3s.Jmpl.getValue(),
+                  src.getBase().encoding(), src.getDisplacement(), dst.encoding());
+        }
+    }
+
     public static class Lddf extends Fmt3b {
         public Lddf(SPARCAssembler masm, SPARCAddress src, Register dst) {
             super(masm, Ops.ArithOp.getValue(), Op3s.Lddf.getValue(),
@@ -1034,6 +1038,19 @@
         }
     }
 
+    public static class Restore extends Fmt3b {
+        public Restore(SPARCAssembler asm, Register src1, Register src2, Register dst) {
+            super(asm, Ops.ArithOp.getValue(), Op3s.Restore.getValue(),
+                  src1.encoding(), src2.encoding(), dst.encoding());
+        }
+    }
+
+    public static class Restored extends Fmt3r {
+        public Restored(SPARCAssembler asm) {
+            super(asm, Ops.ArithOp.getValue(), 1, Op3s.Saved.getValue());
+        }
+    }
+
     public static class Return extends Fmt3d {
         public Return(SPARCAssembler masm, Register src1, int simm13) {
             super(masm, Ops.ArithOp.getValue(), Op3s.Rett.getValue(), src1.encoding(), simm13);
@@ -1043,12 +1060,17 @@
         }
     }
 
-    public final void restored() {
-        emitInt(Ops.ArithOp.getValue() | Op3s.Saved.getValue() | fcn(1));
+    public static class Save extends Fmt3b {
+        public Save(SPARCAssembler asm, Register src1, Register src2, Register dst) {
+            super(asm, Ops.ArithOp.getValue(), Op3s.Save.getValue(),
+                  src1.encoding(), src2.encoding(), dst.encoding());
+        }
     }
 
-    public final void saved() {
-        emitInt(Ops.ArithOp.getValue() | Op3s.Saved.getValue() | fcn(0));
+    public static class Saved extends Fmt3r {
+        public Saved(SPARCAssembler asm) {
+            super(asm, Ops.ArithOp.getValue(), 0, Op3s.Saved.getValue());
+        }
     }
 
     @Deprecated
@@ -1090,66 +1112,13 @@
         }
     }
 
-    @SuppressWarnings("unused")
-    public static class Setuw {
-        public Setuw(SPARCAssembler masm, int value, Register dst) {
-            if (value >= 0 && ((value & 0x3FFF) == 0)) {
-                new Sethi(masm, hi22(value), dst);
-            } else if (-4095 <= value && value <= 4096) {
-                // or   g0, value, dst
-                new Or(masm, SPARC.r0, value, dst);
-            } else {
-                new Sethi(masm, hi22(value), dst);
-                new Or(masm, dst, lo10(value), dst);
-            }
+    public static class Sir extends Fmt3b {
+        public Sir(SPARCAssembler asm, int simm13) {
+            super(asm, Ops.ArithOp.getValue(), Op3s.Sir.getValue(),
+                  SPARC.r0.encoding(), simm13, SPARC.r15.encoding());
         }
     }
 
-    @SuppressWarnings("unused")
-    public static class Setx {
-        public Setx(SPARCAssembler masm, long value, Register tmp, Register dst) {
-            int hi = (int) (value >> 32);
-            int lo = (int) (value & ~0);
-
-            if (isSimm13(lo) && value == lo) {
-                new Or(masm, SPARC.r0, lo, dst);
-            } else if (hi == 0) {
-                new Sethi(masm, lo, dst);   // hardware version zero-extends to upper 32
-                if (lo10(lo) != 0) {
-                    new Or(masm, dst, lo10(lo), dst);
-                }
-            } else if (hi == -1) {
-                new Sethi(masm, ~lo, dst);  // hardware version zero-extends to upper 32
-                new Xor(masm, dst, lo10(lo) ^ ~lo10(~0), dst);
-            } else if (lo == 0) {
-                if (isSimm13(hi)) {
-                    new Or(masm, SPARC.r0, hi, dst);
-                } else {
-                    new Sethi(masm, hi, dst);   // hardware version zero-extends to upper 32
-                    if (lo10(hi) != 0) {
-                        new Or(masm, dst, lo10(hi), dst);
-                    }
-                }
-                new Sllx(masm, dst, 32, dst);
-            }  else {
-                new Sethi(masm, hi, tmp);
-                new Sethi(masm, lo, dst); // macro assembler version sign-extends
-                if (lo10(hi) != 0) {
-                    new Or(masm, tmp, lo10(hi), tmp);
-                }
-                if (lo10(lo) != 0) {
-                    new Or(masm, dst, lo10(lo), dst);
-                }
-                new Sllx(masm, tmp, 32, tmp);
-                new Or(masm, dst, tmp, dst);
-              }
-        }
-    }
-
-    public final void sir(int simm13a) {
-        emitInt(Ops.ArithOp.getValue() | Op3s.Sir.getValue() | ImmedTrue | simm(simm13a, 13));
-    }
-
     public static class Sll extends Fmt3b {
         public Sll(SPARCAssembler masm, Register src1, int simm13, Register dst) {
             super(masm, Ops.ArithOp.getValue(), Op3s.Sll.getValue(), src1.encoding(), simm13, dst.encoding());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCMacroAssembler.java	Fri May 31 21:55:53 2013 -0400
@@ -0,0 +1,129 @@
+/*
+ * 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.asm.sparc;
+
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.sparc.*;
+
+public class SPARCMacroAssembler extends SPARCAssembler {
+
+    public SPARCMacroAssembler(TargetDescription target, RegisterConfig registerConfig) {
+        super(target, registerConfig);
+    }
+
+    @SuppressWarnings("unused")
+    public static class Cmp {
+
+        public Cmp(SPARCAssembler masm, Register a, Register b) {
+            new Subcc(masm, a, b, SPARC.r0);
+        }
+
+        public Cmp(SPARCAssembler masm, Register a, int simm13) {
+            new Subcc(masm, a, simm13, SPARC.r0);
+        }
+    }
+
+    @SuppressWarnings("unused")
+    public static class Setuw {
+
+        public Setuw(SPARCAssembler masm, int value, Register dst) {
+            if (value >= 0 && ((value & 0x3FFF) == 0)) {
+                new Sethi(masm, hi22(value), dst);
+            } else if (-4095 <= value && value <= 4096) {
+                // or g0, value, dst
+                new Or(masm, SPARC.r0, value, dst);
+            } else {
+                new Sethi(masm, hi22(value), dst);
+                new Or(masm, dst, lo10(value), dst);
+            }
+        }
+    }
+
+    @SuppressWarnings("unused")
+    public static class Setx {
+
+        public Setx(SPARCAssembler masm, long value, Register tmp, Register dst) {
+            int hi = (int) (value >> 32);
+            int lo = (int) (value & ~0);
+
+            if (isSimm13(lo) && value == lo) {
+                new Or(masm, SPARC.r0, lo, dst);
+            } else if (hi == 0) {
+                new Sethi(masm, lo, dst);   // hardware version zero-extends to upper 32
+                if (lo10(lo) != 0) {
+                    new Or(masm, dst, lo10(lo), dst);
+                }
+            } else if (hi == -1) {
+                new Sethi(masm, ~lo, dst);  // hardware version zero-extends to upper 32
+                new Xor(masm, dst, lo10(lo) ^ ~lo10(~0), dst);
+            } else if (lo == 0) {
+                if (isSimm13(hi)) {
+                    new Or(masm, SPARC.r0, hi, dst);
+                } else {
+                    new Sethi(masm, hi, dst);   // hardware version zero-extends to upper 32
+                    if (lo10(hi) != 0) {
+                        new Or(masm, dst, lo10(hi), dst);
+                    }
+                }
+                new Sllx(masm, dst, 32, dst);
+            } else {
+                new Sethi(masm, hi, tmp);
+                new Sethi(masm, lo, dst); // macro assembler version sign-extends
+                if (lo10(hi) != 0) {
+                    new Or(masm, tmp, lo10(hi), tmp);
+                }
+                if (lo10(lo) != 0) {
+                    new Or(masm, dst, lo10(lo), dst);
+                }
+                new Sllx(masm, tmp, 32, tmp);
+                new Or(masm, dst, tmp, dst);
+            }
+        }
+    }
+
+    @SuppressWarnings("unused")
+    public static class RestoreWindow {
+
+        public RestoreWindow(SPARCAssembler asm) {
+            new Restore(asm, SPARC.g0, SPARC.g0, SPARC.g0);
+        }
+    }
+
+    @SuppressWarnings("unused")
+    public static class Ret {
+
+        public Ret(SPARCAssembler asm) {
+            new Jmpl(asm, new SPARCAddress(SPARC.i0, 8), SPARC.g0);
+
+        }
+    }
+
+    @SuppressWarnings("unused")
+    public static class SaveWindow {
+
+        public SaveWindow(SPARCAssembler asm) {
+            new Save(asm, SPARC.g0, SPARC.g0, SPARC.g0);
+        }
+    }
+
+}
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCompare.java	Thu May 30 22:56:22 2013 -0400
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCompare.java	Fri May 31 21:55:53 2013 -0400
@@ -28,7 +28,7 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.SPARCAssembler;
-import com.oracle.graal.asm.sparc.SPARCAssembler.Cmp;
+import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Cmp;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.asm.*;
 
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java	Thu May 30 22:56:22 2013 -0400
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java	Fri May 31 21:55:53 2013 -0400
@@ -38,13 +38,13 @@
 import com.oracle.graal.asm.sparc.SPARCAssembler.Lduw;
 import com.oracle.graal.asm.sparc.SPARCAssembler.Ldx;
 import com.oracle.graal.asm.sparc.SPARCAssembler.Or;
-import com.oracle.graal.asm.sparc.SPARCAssembler.Setuw;
-import com.oracle.graal.asm.sparc.SPARCAssembler.Setx;
 import com.oracle.graal.asm.sparc.SPARCAssembler.Stb;
 import com.oracle.graal.asm.sparc.SPARCAssembler.Sth;
 import com.oracle.graal.asm.sparc.SPARCAssembler.Stw;
 import com.oracle.graal.asm.sparc.SPARCAssembler.Stx;
 import com.oracle.graal.asm.sparc.SPARCAssembler.NullCheck;
+import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Setuw;
+import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Setx;
 import com.oracle.graal.graph.GraalInternalError;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.*;
@@ -56,10 +56,8 @@
 
     public static class NullCheckOp extends SPARCLIRInstruction {
 
-        @Use({ REG })
-        protected AllocatableValue input;
-        @State
-        protected LIRFrameState state;
+        @Use({REG}) protected AllocatableValue input;
+        @State protected LIRFrameState state;
 
         public NullCheckOp(Variable input, LIRFrameState state) {
             this.input = input;
@@ -77,15 +75,11 @@
     public static class LoadOp extends SPARCLIRInstruction {
 
         private final Kind kind;
-        @Def({ REG })
-        protected AllocatableValue result;
-        @Use({ COMPOSITE })
-        protected SPARCAddressValue address;
-        @State
-        protected LIRFrameState state;
+        @Def({REG}) protected AllocatableValue result;
+        @Use({COMPOSITE}) protected SPARCAddressValue address;
+        @State protected LIRFrameState state;
 
-        public LoadOp(Kind kind, AllocatableValue result, SPARCAddressValue address,
-                LIRFrameState state) {
+        public LoadOp(Kind kind, AllocatableValue result, SPARCAddressValue address, LIRFrameState state) {
             this.kind = kind;
             this.result = result;
             this.address = address;
@@ -97,32 +91,32 @@
         public void emitCode(TargetMethodAssembler tasm, SPARCAssembler masm) {
             SPARCAddress addr = address.toAddress();
             switch (kind) {
-            case Byte:
-                new Ldsb(masm, addr, asRegister(result));
-                break;
-            case Short:
-                new Ldsh(masm, addr, asRegister(result));
-                break;
-            case Char:
-                new Lduw(masm, addr, asRegister(result));
-                break;
-            case Int:
-                new Ldsw(masm, addr, asRegister(result));
-                break;
-            case Long:
-                new Ldx(masm, addr, asRegister(result));
-                break;
-            case Float:
-                new Ldf(masm, addr, asRegister(result));
-                break;
-            case Double:
-                new Lddf(masm, addr, asRegister(result));
-                break;
-            case Object:
-                new Ldx(masm, addr, asRegister(result));
-                break;
-            default:
-                throw GraalInternalError.shouldNotReachHere();
+                case Byte:
+                    new Ldsb(masm, addr, asRegister(result));
+                    break;
+                case Short:
+                    new Ldsh(masm, addr, asRegister(result));
+                    break;
+                case Char:
+                    new Lduw(masm, addr, asRegister(result));
+                    break;
+                case Int:
+                    new Ldsw(masm, addr, asRegister(result));
+                    break;
+                case Long:
+                    new Ldx(masm, addr, asRegister(result));
+                    break;
+                case Float:
+                    new Ldf(masm, addr, asRegister(result));
+                    break;
+                case Double:
+                    new Lddf(masm, addr, asRegister(result));
+                    break;
+                case Object:
+                    new Ldx(masm, addr, asRegister(result));
+                    break;
+                default:
+                    throw GraalInternalError.shouldNotReachHere();
             }
         }
     }
@@ -130,15 +124,11 @@
     public static class StoreOp extends SPARCLIRInstruction {
 
         private final Kind kind;
-        @Use({ COMPOSITE })
-        protected SPARCAddressValue address;
-        @Use({ REG })
-        protected AllocatableValue input;
-        @State
-        protected LIRFrameState state;
+        @Use({COMPOSITE}) protected SPARCAddressValue address;
+        @Use({REG}) protected AllocatableValue input;
+        @State protected LIRFrameState state;
 
-        public StoreOp(Kind kind, SPARCAddressValue address, AllocatableValue input,
-                LIRFrameState state) {
+        public StoreOp(Kind kind, SPARCAddressValue address, AllocatableValue input, LIRFrameState state) {
             this.kind = kind;
             this.address = address;
             this.input = input;
@@ -151,29 +141,29 @@
             assert isRegister(input);
             SPARCAddress addr = address.toAddress();
             switch (kind) {
-            case Byte:
-                new Stb(masm, addr, asRegister(input));
-                break;
-            case Short:
-                new Sth(masm, addr, asRegister(input));
-                break;
-            case Int:
-                new Stw(masm, addr, asRegister(input));
-                break;
-            case Long:
-                new Stx(masm, addr, asRegister(input));
-                break;
-            case Float:
-                new Stx(masm, addr, asRegister(input));
-                break;
-            case Double:
-                new Stx(masm, addr, asRegister(input));
-                break;
-            case Object:
-                new Stx(masm, addr, asRegister(input));
-                break;
-            default:
-                throw GraalInternalError.shouldNotReachHere("missing: " + address.getKind());
+                case Byte:
+                    new Stb(masm, addr, asRegister(input));
+                    break;
+                case Short:
+                    new Sth(masm, addr, asRegister(input));
+                    break;
+                case Int:
+                    new Stw(masm, addr, asRegister(input));
+                    break;
+                case Long:
+                    new Stx(masm, addr, asRegister(input));
+                    break;
+                case Float:
+                    new Stx(masm, addr, asRegister(input));
+                    break;
+                case Double:
+                    new Stx(masm, addr, asRegister(input));
+                    break;
+                case Object:
+                    new Stx(masm, addr, asRegister(input));
+                    break;
+                default:
+                    throw GraalInternalError.shouldNotReachHere("missing: " + address.getKind());
             }
         }
     }
@@ -181,10 +171,8 @@
     @Opcode("MOVE")
     public static class MoveToRegOp extends SPARCLIRInstruction implements MoveOp {
 
-        @Def({ REG, HINT })
-        protected AllocatableValue result;
-        @Use({ REG, STACK, CONST })
-        protected Value input;
+        @Def({REG, HINT}) protected AllocatableValue result;
+        @Use({REG, STACK, CONST}) protected Value input;
 
         public MoveToRegOp(AllocatableValue result, Value input) {
             this.result = result;
@@ -210,10 +198,8 @@
     @Opcode("MOVE")
     public static class MoveFromRegOp extends SPARCLIRInstruction implements MoveOp {
 
-        @Def({ REG, STACK })
-        protected AllocatableValue result;
-        @Use({ REG, CONST, HINT })
-        protected Value input;
+        @Def({REG, STACK}) protected AllocatableValue result;
+        @Use({REG, CONST, HINT}) protected Value input;
 
         public MoveFromRegOp(AllocatableValue result, Value input) {
             this.result = result;
@@ -236,8 +222,7 @@
         }
     }
 
-    public static void move(TargetMethodAssembler tasm, SPARCAssembler masm, Value result,
-            Value input) {
+    public static void move(TargetMethodAssembler tasm, SPARCAssembler masm, Value result, Value input) {
         if (isRegister(input)) {
             if (isRegister(result)) {
                 reg2reg(masm, result, input);
@@ -256,60 +241,58 @@
     }
 
     @SuppressWarnings("unused")
-    private static void reg2reg(SPARCAssembler masm, Value result,
-            Value input) {
+    private static void reg2reg(SPARCAssembler masm, Value result, Value input) {
         if (asRegister(input).equals(asRegister(result))) {
             return;
         }
         switch (input.getKind()) {
-        case Int:
-            new Or(masm, SPARC.r0, asRegister(input), asRegister(result));
-            break;
-        case Long:
-            new Or(masm, SPARC.r0, asRegister(input), asRegister(result));
-            break;
-        case Float:
-            new Or(masm, SPARC.r0, asRegister(input), asRegister(result));
-            break;
-        case Double:
-            new Or(masm, SPARC.r0, asRegister(input), asRegister(result));
-            break;
-        case Object:
-            new Or(masm, SPARC.r0, asRegister(input), asRegister(result));
-            break;
-        default:
-            throw GraalInternalError.shouldNotReachHere("missing: " + input.getKind());
+            case Int:
+                new Or(masm, SPARC.r0, asRegister(input), asRegister(result));
+                break;
+            case Long:
+                new Or(masm, SPARC.r0, asRegister(input), asRegister(result));
+                break;
+            case Float:
+                new Or(masm, SPARC.r0, asRegister(input), asRegister(result));
+                break;
+            case Double:
+                new Or(masm, SPARC.r0, asRegister(input), asRegister(result));
+                break;
+            case Object:
+                new Or(masm, SPARC.r0, asRegister(input), asRegister(result));
+                break;
+            default:
+                throw GraalInternalError.shouldNotReachHere("missing: " + input.getKind());
         }
     }
 
     @SuppressWarnings("unused")
-    private static void const2reg(TargetMethodAssembler tasm, SPARCAssembler masm, Value result,
-            Constant input) {
+    private static void const2reg(TargetMethodAssembler tasm, SPARCAssembler masm, Value result, Constant input) {
         switch (input.getKind().getStackKind()) {
-        case Int:
-            if (tasm.runtime.needsDataPatch(input)) {
-                tasm.recordDataReferenceInCode(input, 0, true);
-            }
-            new Setuw(masm, input.asInt(), asRegister(result));
-            break;
-        case Long:
-            if (tasm.runtime.needsDataPatch(input)) {
-                tasm.recordDataReferenceInCode(input, 0, true);
-            }
-            new Setx(masm, input.asInt(), null, asRegister(result));
-            break;
-        case Object:
-            if (input.isNull()) {
-                new Setx(masm, 0x0L, null, asRegister(result));
-            } else if (tasm.target.inlineObjects) {
-                tasm.recordDataReferenceInCode(input, 0, true);
-                new Setx(masm, 0xDEADDEADDEADDEADL, null, asRegister(result));
-            } else {
-                throw new InternalError("NYI");
-            }
-            break;
-        default:
-            throw GraalInternalError.shouldNotReachHere("missing: " + input.getKind());
+            case Int:
+                if (tasm.runtime.needsDataPatch(input)) {
+                    tasm.recordDataReferenceInCode(input, 0, true);
+                }
+                new Setuw(masm, input.asInt(), asRegister(result));
+                break;
+            case Long:
+                if (tasm.runtime.needsDataPatch(input)) {
+                    tasm.recordDataReferenceInCode(input, 0, true);
+                }
+                new Setx(masm, input.asInt(), null, asRegister(result));
+                break;
+            case Object:
+                if (input.isNull()) {
+                    new Setx(masm, 0x0L, null, asRegister(result));
+                } else if (tasm.target.inlineObjects) {
+                    tasm.recordDataReferenceInCode(input, 0, true);
+                    new Setx(masm, 0xDEADDEADDEADDEADL, null, asRegister(result));
+                } else {
+                    throw new InternalError("NYI");
+                }
+                break;
+            default:
+                throw GraalInternalError.shouldNotReachHere("missing: " + input.getKind());
         }
     }
 }
--- a/graal/com.oracle.graal.sparc/src/com/oracle/graal/sparc/SPARC.java	Thu May 30 22:56:22 2013 -0400
+++ b/graal/com.oracle.graal.sparc/src/com/oracle/graal/sparc/SPARC.java	Fri May 31 21:55:53 2013 -0400
@@ -74,6 +74,33 @@
     public static final Register r30 = new Register(30, 30, "r30", CPU);
     public static final Register r31 = new Register(31, 31, "r31", CPU);
 
+    public static final Register g0 = r0;
+    public static final Register g1 = r1;
+    public static final Register g2 = r2;
+    public static final Register g3 = r3;
+    public static final Register g4 = r4;
+    public static final Register g5 = r5;
+    public static final Register g6 = r6;
+    public static final Register g7 = r7;
+
+    public static final Register i0 = r24;
+    public static final Register i1 = r25;
+    public static final Register i2 = r26;
+    public static final Register i3 = r27;
+    public static final Register i4 = r28;
+    public static final Register i5 = r29;
+    public static final Register i6 = r30;
+    public static final Register i7 = r31;
+
+    public static final Register o0 = r8;
+    public static final Register o1 = r9;
+    public static final Register o2 = r10;
+    public static final Register o3 = r11;
+    public static final Register o4 = r12;
+    public static final Register o5 = r13;
+    public static final Register o6 = r14;
+    public static final Register o7 = r15;
+
     public static final Register[] gprRegisters = {
         r0,  r1,  r2,  r3,  r4,  r5,  r6,  r7,
          r8,  r9, r10, r11, r12, r13, r14, r15,