# HG changeset patch # User twisti # Date 1371786052 25200 # Node ID f7807994708459fdcb54c2d4788f7a50baa9732e # Parent 63e44cdabb9134c3311b6357e3d7a12c93958eb7 some basic SPARC arithmetic works diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/AbstractSPARCAssembler.java --- a/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/AbstractSPARCAssembler.java Thu Jun 20 10:56:34 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2009, 2012, 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.AbstractAddress; -import com.oracle.graal.api.code.Register; -import com.oracle.graal.api.code.TargetDescription; -import com.oracle.graal.asm.AbstractAssembler; - -public abstract class AbstractSPARCAssembler extends AbstractAssembler { - - public static final String UNBOUND_TARGET = "L" + Integer.MAX_VALUE; - - public AbstractSPARCAssembler(TargetDescription target) { - super(target); - } - - @Override - public void align(int modulus) { - // SPARC: Implement alignment. - } - - @Override - protected void patchJumpTarget(int branch, int jumpTarget) { - // SPARC: Implement patching of jump target. - } - - @Override - public AbstractAddress makeAddress(Register base, int displacement) { - // SPARC: Implement address calculation. - return null; - } - - @Override - public AbstractAddress getPlaceholder() { - // SPARC: Implement address patching. - return null; - } -} diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java --- a/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java Thu Jun 20 10:56:34 2013 -0700 +++ b/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java Thu Jun 20 20:40:52 2013 -0700 @@ -22,63 +22,214 @@ */ package com.oracle.graal.asm.sparc; -import com.oracle.graal.api.code.Register; -import com.oracle.graal.api.code.RegisterConfig; -import com.oracle.graal.api.code.TargetDescription; +import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.Kind; import com.oracle.graal.asm.*; +import com.oracle.graal.debug.*; import com.oracle.graal.hotspot.HotSpotGraalRuntime; import com.oracle.graal.sparc.SPARC; +import static com.oracle.graal.sparc.SPARC.*; + /** * This class implements an assembler that can encode most SPARC instructions. */ -public class SPARCAssembler extends AbstractSPARCAssembler { - - // @formatter:off - - public static class Fmt1 { - public Fmt1(SPARCAssembler masm, int op, int disp30) { - assert op == 1; - assert ((disp30 & 0xc0000000) == 0); - - masm.emitInt(op << 30 | disp30); +public abstract class SPARCAssembler extends AbstractAssembler { + + public static class Fmt00a { + + private int rd; + private int op2; + private int imm22; + + public Fmt00a(Op2s op2, int imm22, Register rd) { + this.op2 = op2.getValue(); + this.imm22 = imm22; + this.rd = rd.encoding(); + } + + public void emit(SPARCAssembler masm) { + assert rd < 0x40; + assert op2 < 0x8; + masm.emitInt(Ops.BranchOp.getValue() << 30 | rd << 25 | op2 << 22 | (imm22 & 0x003fffff)); } } - public static class Fmt2a { - public Fmt2a(SPARCAssembler masm, int op, int rd, int op2, int imm22) { - assert op == 0; - assert rd < 0x40; - assert op2 < 0x8; - - masm.emitInt(op << 30 | rd << 25 | op2 << 22 | (imm22 & 0x003fffff)); - } - } - + // @formatter:off + /** + * Instruction format for branches. + * + * | 00 |a | cond | op2 | disp22 | + * |31 30|29|28 25|24 22|21 0| + */ + // @formatter:on public static class Fmt2b { + public Fmt2b(SPARCAssembler masm, int op, int a, int cond, int op2, int disp22) { assert op == 0; assert op == 0; assert cond < 0x10; assert op2 < 0x8; - masm.emitInt(op << 30 | a << 29 | cond << 25 | op2 << 22 | (disp22 & 0x003fffff)); } } - public static class Fmt2c { - public Fmt2c(SPARCAssembler masm, int op, int a, int cond, int op2, int cc, int predict, int disp19) { - assert predict < 2; - assert op == 0; + // @formatter:off + /** + * Instruction format for conditional branches. + * + * | 00 |a | cond | op2 |cc1|cc0|p | disp19 | + * |31 30|29|28 25|24 22|21 |20 |19| 0| + */ + // @formatter:on + public static class Fmt00c { + + private static final int OP_SHIFT = 30; + private static final int A_SHIFT = 29; + private static final int COND_SHIFT = 25; + private static final int OP2_SHIFT = 22; + private static final int CC_SHIFT = 20; + private static final int P_SHIFT = 19; + private static final int DISP19_SHIFT = 0; + + // @formatter:off + private static final int OP_MASK = 0b11000000000000000000000000000000; + private static final int A_MASK = 0b00100000000000000000000000000000; + private static final int COND_MASK = 0b00011110000000000000000000000000; + private static final int OP2_MASK = 0b00000001110000000000000000000000; + private static final int CC_MASK = 0b00000000001100000000000000000000; + private static final int P_MASK = 0b00000000000010000000000000000000; + private static final int DISP19_MASK = 0b00000000000001111111111111111111; + // @formatter:on + + private int a; + private int cond; + private int op2; + private int cc; + private int p; + private int disp19; + private Label label; + + private Fmt00c(int a, int cond, int op2, int cc, int p, int disp19) { + setA(a); + setCond(cond); + setOp2(op2); + setCc(cc); + setP(p); + setDisp19(disp19); + } + + public Fmt00c(int a, ConditionFlag cond, Op2s op2, CC cc, int p, int disp19) { + this(a, cond.getValue(), op2.getValue(), cc.getValue(), p, disp19); + } + + public Fmt00c(int a, ConditionFlag cond, Op2s op2, CC cc, int p, Label label) { + this(a, cond.getValue(), op2.getValue(), cc.getValue(), p, 0); + this.label = label; + } + + public int getA() { + return a; + } + + public void setA(int a) { + this.a = a; + } + + public int getCond() { + return cond; + } + + public void setCond(int cond) { + this.cond = cond; + } + + public int getOp2() { + return op2; + } + + public void setOp2(int op2) { + this.op2 = op2; + } + + public int getCc() { + return cc; + } + + public void setCc(int cc) { + this.cc = cc; + } + + public int getP() { + return p; + } + + public void setP(int p) { + this.p = p; + } + + /** + * Return the displacement in bytes. + */ + public int getDisp19() { + return disp19 << 2; + } + + /** + * The instructions requires displacements to be word-sized. + */ + public void setDisp19(int disp19) { + this.disp19 = disp19 >> 2; + } + + private int getInstructionBits() { + return Ops.BranchOp.getValue() << OP_SHIFT | a << A_SHIFT | cond << COND_SHIFT | op2 << OP2_SHIFT | cc << CC_SHIFT | p << P_SHIFT | (disp19 & DISP19_MASK) << DISP19_SHIFT; + } + + public static Fmt00c read(SPARCAssembler masm, int pos) { + final int inst = masm.codeBuffer.getInt(pos); + + // Make sure it's the right instruction: + final int op = (inst & OP_MASK) >> OP_SHIFT; + assert op == Ops.BranchOp.getValue(); + + // Get the instruction fields: + final int a = (inst & A_MASK) >> A_SHIFT; + final int cond = (inst & COND_MASK) >> COND_SHIFT; + final int op2 = (inst & OP2_MASK) >> OP2_SHIFT; + final int cc = (inst & CC_MASK) >> CC_SHIFT; + final int p = (inst & P_MASK) >> P_SHIFT; + final int disp19 = (inst & DISP19_MASK) >> DISP19_SHIFT; + + Fmt00c fmt = new Fmt00c(a, cond, op2, cc, p, disp19); + fmt.verify(); + return fmt; + } + + public void write(SPARCAssembler masm, int pos) { + verify(); + masm.codeBuffer.emitInt(getInstructionBits(), pos); + } + + public void emit(SPARCAssembler masm) { + if (label != null) { + final int pos = label.isBound() ? label.position() : patchUnbound(masm, label); + final int disp = pos - masm.codeBuffer.position(); + setDisp19(disp); + } + verify(); + masm.emitInt(getInstructionBits()); + } + + public void verify() { + assert p < 2; assert cond < 0x10; assert op2 < 0x8; - - masm.emitInt(op << 30 | a << 29 | cond << 25 | op2 << 22 | cc << 20 | predict | (disp19 & 0x0007ffff)); } } public static class Fmt2d { + public Fmt2d(SPARCAssembler masm, int op, int a, int rcond, int op2, int d16hi, int predict, int rs1, int d16lo) { assert predict == 0 || predict == 1; assert rcond >= 0 && rcond < 0x8; @@ -91,6 +242,7 @@ } public static class Fmt2e { + public Fmt2e(SPARCAssembler asm, int op, int c4lo, int cc2, int rs1, int d10lo, int regOrImmediate) { assert op == 0; assert (cc2 & 0xFFFFFFFE) == 0; @@ -104,32 +256,80 @@ } } + public static class Fmt01 { + + private int disp30; + + public Fmt01(int disp30) { + this.disp30 = disp30; + } + + public void emit(SPARCAssembler masm) { + assert ((disp30 & 0xc0000000) == 0); + masm.emitInt(Ops.CallOp.getValue() << 30 | disp30); + } + } + public static class Fmt3a { + public Fmt3a(SPARCAssembler masm, int op, int rd, int op3, int rs1, int rs2) { - assert op == 2 || op == 3; + assert op == 2 || op == 3; assert op3 >= 0 && op3 < 0x40; assert rs1 >= 0 && rs1 < 0x20; assert rs2 >= 0 && rs2 < 0x20; - assert rd >= 0 && rd < 0x20; - - masm.emitInt(op << 30 | rd << 25 | op3 << 19 | rs1 << 14 | rs2); + assert rd >= 0 && rd < 0x20; + + masm.emitInt(op << 30 | rd << 25 | op3 << 19 | rs1 << 14 | rs2); } } public static class Fmt3b { - public Fmt3b(SPARCAssembler masm, int op, int op3, int rs1, int regOrImmediate, int rd) { - assert op == 2 || op == 3; + + private boolean isImm; + private int op; + private int op3; + private int rs1; + private int rs2; + private int simm13; + private int rd; + + public Fmt3b(Ops op, Op3s op3, Register rs1, Register rs2, Register rd) { + this.op = op.getValue(); + this.op3 = op3.getValue(); + this.rs1 = rs1.encoding(); + this.rs2 = rs2.encoding(); + this.rd = rd.encoding(); + } + + public Fmt3b(Ops op, Op3s op3, Register rs1, int simm13, Register rd) { + isImm = true; + this.op = op.getValue(); + this.op3 = op3.getValue(); + this.rs1 = rs1.encoding(); + this.simm13 = simm13; + this.rd = rd.encoding(); + } + + public void emit(SPARCAssembler masm) { + assert op == 2 || op == 3; assert op3 >= 0 && op3 < 0x40; assert rs1 >= 0 && rs1 < 0x20; - assert rd >= 0 && rd < 0x20; - - masm.emitInt(op << 30 | rd << 25 | op3 << 19 | rs1 << 14 | (regOrImmediate & 0x1fff)); + assert rd >= 0 && rd < 0x20; + + if (isImm == false) { + assert rs2 >= 0 && rs2 < 0x20; + masm.emitInt(op << 30 | rd << 25 | op3 << 19 | rs1 << 14 | rs2); + } else { + assert isSimm13(simm13) : simm13; + masm.emitInt(op << 30 | rd << 25 | op3 << 19 | rs1 << 14 | ImmedTrue | (simm13 & 0x1fff)); + } } } public static class Fmt3c { + public Fmt3c(SPARCAssembler masm, int op, int op3, int rs1, int rs2) { - assert op == 2; + assert op == 2; assert op3 >= 0 && op3 < 0x40; assert rs1 >= 0 && rs1 < 0x20; assert rs2 >= 0 && rs2 < 0x20; @@ -139,8 +339,9 @@ } public static class Fmt3d { + public Fmt3d(SPARCAssembler masm, int op, int op3, int rs1, int simm13) { - assert op == 2; + assert op == 2; assert op3 >= 0 && op3 < 0x40; assert rs1 >= 0 && rs1 < 0x20; @@ -149,68 +350,74 @@ } public static class Fmt3e { + public Fmt3e(SPARCAssembler masm, int op, int op3, int rcond, int rs1, int rs2, int rd) { - assert op == 2 || op == 3; + assert op == 2 || op == 3; assert op3 >= 0 && op3 < 0x40; assert rcond >= 0 && rcond < 0x8; assert rs1 >= 0 && rs1 < 0x20; assert rs2 >= 0 && rs2 < 0x20; - assert rd >= 0 && rd < 0x20; - - masm.emitInt(op << 30 | rd << 25 | op3 << 19 | rs1 << 14 | rcond << 10 | rs2); + assert rd >= 0 && rd < 0x20; + + masm.emitInt(op << 30 | rd << 25 | op3 << 19 | rs1 << 14 | rcond << 10 | rs2); } } public static class Fmt3f { + public Fmt3f(SPARCAssembler masm, int op, int op3, int rcond, int rs1, int simm10, int rd) { - assert op == 2 || op == 3; + assert op == 2 || op == 3; assert op3 >= 0 && op3 < 0x40; assert rs1 >= 0 && rs1 < 0x20; - assert rd >= 0 && rd < 0x20; + assert rd >= 0 && rd < 0x20; masm.emitInt(op << 30 | rd << 25 | op3 << 19 | ImmedTrue | rs1 << 14 | rcond << 10 | (simm10 & 0x000003ff)); } } public static class Fmt3n { + public Fmt3n(SPARCAssembler masm, int op, int op3, int opf, int rs2, int rd) { - assert op == 2 || op == 3; + assert op == 2 || op == 3; assert op3 >= 0 && op3 < 0x40; assert opf >= 0 && opf < 0x200; assert rs2 >= 0 && rs2 < 0x20; - assert rd >= 0 && rd < 0x20; + assert rd >= 0 && rd < 0x20; masm.emitInt(op << 30 | rd << 25 | op3 << 19 | opf << 5 | rs2); } } public static class Fmt3p { + public Fmt3p(SPARCAssembler masm, int op, int op3, int opf, int rs1, int rs2, int rd) { - assert op == 2 || op == 3; + assert op == 2 || op == 3; assert op3 >= 0 && op3 < 0x40; assert opf >= 0 && opf < 0x200; assert rs1 >= 0 && rs1 < 0x20; assert rs2 >= 0 && rs2 < 0x20; - assert rd >= 0 && rd < 0x20; - - masm.emitInt(op << 30 | rd << 25 | op3 << 19 | rs1 << 14 | opf << 5 | rs2); + assert rd >= 0 && rd < 0x20; + + masm.emitInt(op << 30 | rd << 25 | op3 << 19 | rs1 << 14 | opf << 5 | rs2); } } public static class Fmt3q { + public Fmt3q(SPARCAssembler masm, int op, int op3, int rs1, int rd) { - assert op == 2 || op == 3; + assert op == 2 || op == 3; assert op3 >= 0 && op3 < 0x40; assert rs1 >= 0 && rs1 < 0x20; - assert rd >= 0 && rd < 0x20; + assert rd >= 0 && rd < 0x20; masm.emitInt(op << 30 | rd << 25 | op3 << 19 | rs1 << 14); } } public static class Fmt3r { + public Fmt3r(SPARCAssembler masm, int op, int fcn, int op3) { - assert op == 23; + assert op == 23; assert op3 >= 0 && op3 < 0x40; assert fcn >= 0 && fcn < 0x40; @@ -219,49 +426,53 @@ } public static class Fmt4a { + public Fmt4a(SPARCAssembler masm, int op, int op3, int cc, int rs1, int regOrImmediate, int rd) { - assert op == 2; + assert op == 2; assert rs1 >= 0 && rs1 < 0x20; - assert rd >= 0 && rd < 0x10; + assert rd >= 0 && rd < 0x10; masm.emitInt(op << 30 | rd << 25 | op3 << 19 | rs1 << 14 | ((cc << 11) & 0x000001800) | regOrImmediate); } } public static class Fmt4c { + public Fmt4c(SPARCAssembler masm, int op, int op3, int cond, int cc, int rs2, int rd) { assert op == 2; assert op3 >= 0 && op3 < 0x40; - assert cc >= 0 && cc < 0x8; + assert cc >= 0 && cc < 0x8; assert cond >= 0 && cond < 0x10; assert rs2 >= 0 && rs2 < 0x20; - assert rd >= 0 && rd < 0x20; + assert rd >= 0 && rd < 0x20; masm.emitInt(op << 30 | rd << 25 | op3 << 19 | ((cc << 15) & 0x00040000) | cond << 14 | ((cc << 11) & 0x3) | rs2); } } public static class Fmt4d { + public Fmt4d(SPARCAssembler masm, int op, int op3, int cond, int cc, int simm11, int rd) { assert op == 2; assert op3 >= 0 && op3 < 0x40; - assert cc >= 0 && cc < 0x8; + assert cc >= 0 && cc < 0x8; assert cond >= 0 && cond < 0x10; - assert rd >= 0 && rd < 0x20; + assert rd >= 0 && rd < 0x20; masm.emitInt(op << 30 | rd << 25 | op3 << 19 | ImmedTrue | ((cc << 15) & 0x00040000) | cond << 14 | ((cc << 11) & 0x3) | simm11 & 0x00004000); } } public static class Fmt5a { + public Fmt5a(SPARCAssembler masm, int op, int op3, int op5, int rs1, int rs2, int rs3, int rd) { - assert op == 2; - assert op3 >= 0 && op3 < 0x40; - assert op5 >= 0 && op5 < 0x10; - assert rs1 >= 0 && rs1 < 0x20; - assert rs2 >= 0 && rs2 < 0x20; - assert rs3 >= 0 && rs3 < 0x20; - assert rd >= 0 && rd < 0x20; + assert op == 2; + assert op3 >= 0 && op3 < 0x40; + assert op5 >= 0 && op5 < 0x10; + assert rs1 >= 0 && rs1 < 0x20; + assert rs2 >= 0 && rs2 < 0x20; + assert rs3 >= 0 && rs3 < 0x20; + assert rd >= 0 && rd < 0x20; masm.emitInt(op << 30 | rd << 25 | op3 << 19 | rs1 << 14 | rs3 << 9 | op5 << 5 | rs2); } @@ -270,10 +481,7 @@ public static final int ImmedTrue = 0x00002000; public enum Ops { - CallOp(1), - BranchOp(0), - ArithOp(2), - LdstOp(3); + BranchOp(0b00), CallOp(0b01), ArithOp(0b10), LdstOp(0b11); private final int value; @@ -287,13 +495,7 @@ } public enum Op2s { - Bpr(3), - Fb(6), - Fbp(5), - Br(2), - Bp(1), - Cb(7), - Sethi(4); + Bpr(3), Fb(6), Fbp(5), Br(2), Bp(1), Cb(7), Sethi(4); private final int value; @@ -388,8 +590,8 @@ Ldsw(0x08, "ldsw"), Ldsb(0x09, "ldsb"), Ldsh(0x0A, "ldsh"), - Ldx(0x0b, "ldx"), - Stx(0x0e, "stx"), + Ldx(0b001011, "ldx"), + Stx(0b001110, "stx"), Ldf(0x20, "ldf"), Ldfsr(0x21, "ldfsr"), @@ -418,14 +620,7 @@ } public enum Op5s { - Fmadds(0x1), - Fmaddd(0x2), - Fmsubs(0x5), - Fmsubd(0x6), - Fnmsubs(0x9), - Fnmsubd(0xA), - Fnmadds(0xD), - Fnmaddd(0xE); + Fmadds(0x1), Fmaddd(0x2), Fmsubs(0x5), Fmsubd(0x6), Fnmsubs(0x9), Fnmsubd(0xA), Fnmadds(0xD), Fnmaddd(0xE); private final int value; @@ -439,15 +634,9 @@ } public enum Opfs { - Fmovs(0x01, "fmovs"), - Fmovd(0x02, "fmovd"), - Fmovq(0x03, "fmovq"), - Fnegs(0x05, "fnegs"), - Fnegd(0x06, "fnegd"), - Fnegq(0x07, "fnegq"), - Fabss(0x09, "fabss"), - Fabsd(0x0A, "fabsd"), - Fabsq(0x0B, "fabsq"), + Fmovs(0x01, "fmovs"), Fmovd(0x02, "fmovd"), Fmovq(0x03, "fmovq"), Fnegs(0x05, "fnegs"), Fnegd(0x06, "fnegd"), Fnegq(0x07, "fnegq"), Fabss(0x09, "fabss"), Fabsd(0x0A, "fabsd"), Fabsq( + 0x0B, + "fabsq"), // start VIS1 Edge8cc(0x0, "edge8cc"), @@ -545,13 +734,9 @@ } public enum MembarMask { - StoreStore(1 << 3, "storestore"), - LoadStore(1 << 2, "loadstore"), - StoreLoad(1 << 1, "storeload"), - LoadLoad(1 << 0, "loadload"), - Sync(1 << 6, "sync"), - MemIssue(1 << 5, "memissue"), - LookAside(1 << 4, "lookaside"); + StoreStore(1 << 3, "storestore"), LoadStore(1 << 2, "loadstore"), StoreLoad(1 << 1, "storeload"), LoadLoad(1 << 0, "loadload"), Sync(1 << 6, "sync"), MemIssue(1 << 5, "memissue"), LookAside( + 1 << 4, + "lookaside"); private final int value; private final String operator; @@ -571,13 +756,7 @@ } public enum CC { - Icc(4, "icc"), - Xcc(6, "xcc"), - Ptrcc(HotSpotGraalRuntime.wordKind() == Kind.Long ? Xcc.getValue() : Icc.getValue(), "ptrcc"), - Fcc0(0, "fcc0"), - Fcc1(1, "fcc1"), - Fcc2(2, "fcc2"), - Fcc3(3, "fcc3"); + Icc(0, "icc"), Xcc(2, "xcc"), Ptrcc(HotSpotGraalRuntime.wordKind() == Kind.Long ? Xcc.getValue() : Icc.getValue(), "ptrcc"), Fcc0(0, "fcc0"), Fcc1(1, "fcc1"), Fcc2(2, "fcc2"), Fcc3(3, "fcc3"); private final int value; private final String operator; @@ -658,13 +837,7 @@ } public enum RCondition { - Rc_z(1, "rc_z"), - Rc_lez(2, "rc_lez"), - Rc_lz(3, "rc_lz"), - Rc_nz(5, "rc_nz"), - Rc_gz(6, "rc_gz"), - Rc_gez(7, "rc_gez"), - Rc_last(Rc_gez.getValue(), "rc_last"); + Rc_z(1, "rc_z"), Rc_lez(2, "rc_lez"), Rc_lz(3, "rc_lz"), Rc_nz(5, "rc_nz"), Rc_gz(6, "rc_gz"), Rc_gez(7, "rc_gez"), Rc_last(Rc_gez.getValue(), "rc_last"); private final int value; private final String operator; @@ -689,15 +862,15 @@ } public static int getDoubleEncoding(int reg) { - assert reg < 64 && ((reg & 1) == 0); - // ignore v8 assertion for now - return (reg & 0x1e) | ((reg & 0x20) >> 5); + assert reg < 64 && ((reg & 1) == 0); + // ignore v8 assertion for now + return (reg & 0x1e) | ((reg & 0x20) >> 5); } public static int getQuadEncoding(int reg) { - assert reg < 64 && ((reg & 3) == 0); - // ignore v8 assertion for now - return (reg & 0x1c) | ((reg & 0x20) >> 5); + assert reg < 64 && ((reg & 3) == 0); + // ignore v8 assertion for now + return (reg & 0x1c) | ((reg & 0x20) >> 5); } public SPARCAssembler(TargetDescription target, @SuppressWarnings("unused") RegisterConfig registerConfig) { @@ -726,361 +899,355 @@ return x & ((1 << 10) - 1); } - @Override - @SuppressWarnings("unused") - public void jmp(Label l) { - new Bpa(this, l); - } - 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()); + + public Add(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Add, src1, simm13, dst); } - public Add(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Add.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Add(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Add, src1, src2, dst); } } public static class Addc extends Fmt3b { - public Addc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Addc.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Addc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Addc, src1, simm13, dst); } - public Addc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Addc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Addc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Addc, src1, src2, dst); } } public static class Addcc extends Fmt3b { - public Addcc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Addcc.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Addcc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Addcc, src1, simm13, dst); } - public Addcc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Addcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Addcc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Addcc, src1, src2, dst); } } public static class Addccc extends Fmt3b { - public Addccc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Addccc.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Addccc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Addccc, src1, simm13, dst); } - public Addccc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Addccc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Addccc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Addccc, src1, src2, dst); } } public static class Addxc extends Fmt3p { + public Addxc(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS3 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Addxc.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Addxc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Addxccc extends Fmt3p { + public Addxccc(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS3 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Addxccc.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Addxccc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Alignaddr extends Fmt3p { + public Alignaddr(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS1 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.AlignAddress.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.AlignAddress.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Alignaddrl extends Fmt3p { + public Alignaddrl(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS1 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.AlignAddressLittle.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.AlignAddressLittle.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class And extends Fmt3b { - public And(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.And.getValue(), src1.encoding(), simm13, dst.encoding()); + + public And(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.And, src1, simm13, dst); } - public And(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.And.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public And(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.And, src1, src2, dst); } } public static class Andcc extends Fmt3b { - public Andcc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Andcc.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Andcc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Andcc, src1, simm13, dst); } - public Andcc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Andcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Andcc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Andcc, src1, src2, dst); } } public static class Andn extends Fmt3b { - public Andn(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Andn.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Andn(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Andn, src1, simm13, dst); } - public Andn(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Andn.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Andn(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Andn, src1, src2, dst); } } public static class Andncc extends Fmt3b { - public Andncc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Andncc.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Andncc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Andncc, src1, simm13, dst); } - public Andncc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Andncc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Andncc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Andncc, src1, src2, dst); } } public static class Array8 extends Fmt3p { + public Array8(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS1 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Array8.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Array8.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Array16 extends Fmt3p { + public Array16(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS1 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Array16.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Array16.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Array32 extends Fmt3p { + public Array32(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS1 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Array32.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Array32.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Bmask extends Fmt3p { + public Bmask(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS2 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Bmask.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Bmask.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } - public static class Bpa extends Fmt2c { - public Bpa(SPARCAssembler masm, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.Always.getValue(), - Op2s.Bp.getValue(), CC.Icc.getValue(), 1, simmm19); + public static class Bpa extends Fmt00c { + + public Bpa(int simm19) { + super(0, ConditionFlag.Always, Op2s.Bp, CC.Icc, 1, simm19); } - public Bpa(SPARCAssembler masm, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.Always.getValue(), - Op2s.Bp.getValue(), CC.Icc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bpa(Label label) { + super(0, ConditionFlag.Always, Op2s.Bp, CC.Icc, 1, label); } } - public static class Bpcc extends Fmt2c { - public Bpcc(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.CarryClear.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bpcc extends Fmt00c { + + public Bpcc(CC cc, int simm19) { + super(0, ConditionFlag.CarryClear, Op2s.Bp, cc, 1, simm19); } - public Bpcc(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.CarryClear.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bpcc(CC cc, Label label) { + super(0, ConditionFlag.CarryClear, Op2s.Bp, cc, 1, label); } } - public static class Bpcs extends Fmt2c { - public Bpcs(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.CarrySet.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bpcs extends Fmt00c { + + public Bpcs(CC cc, int simm19) { + super(0, ConditionFlag.CarrySet, Op2s.Bp, cc, 1, simm19); } - public Bpcs(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.CarrySet.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bpcs(CC cc, Label label) { + super(0, ConditionFlag.CarrySet, Op2s.Bp, cc, 1, label); } } - public static class Bpe extends Fmt2c { - public Bpe(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.Equal.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bpe extends Fmt00c { + + public Bpe(CC cc, int simm19) { + super(0, ConditionFlag.Equal, Op2s.Bp, cc, 1, simm19); } - public Bpe(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.Equal.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bpe(CC cc, Label label) { + super(0, ConditionFlag.Equal, Op2s.Bp, cc, 1, label); } } - public static class Bpg extends Fmt2c { - public Bpg(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.Greater.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bpg extends Fmt00c { + + public Bpg(CC cc, int simm19) { + super(0, ConditionFlag.Greater, Op2s.Bp, cc, 1, simm19); } - public Bpg(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.Greater.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bpg(CC cc, Label label) { + super(0, ConditionFlag.Greater, Op2s.Bp, cc, 1, label); } } - public static class Bpge extends Fmt2c { - public Bpge(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.GreaterEqual.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bpge extends Fmt00c { + + public Bpge(CC cc, int simm19) { + super(0, ConditionFlag.GreaterEqual, Op2s.Bp, cc, 1, simm19); } - public Bpge(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.GreaterEqual.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bpge(CC cc, Label label) { + super(0, ConditionFlag.GreaterEqual, Op2s.Bp, cc, 1, label); } } - public static class Bpgu extends Fmt2c { - public Bpgu(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.GreaterUnsigned.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bpgu extends Fmt00c { + + public Bpgu(CC cc, int simm19) { + super(0, ConditionFlag.GreaterUnsigned, Op2s.Bp, cc, 1, simm19); } - public Bpgu(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.GreaterUnsigned.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bpgu(CC cc, Label label) { + super(0, ConditionFlag.GreaterUnsigned, Op2s.Bp, cc, 1, label); } } - public static class Bpl extends Fmt2c { - public Bpl(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.Less.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bpl extends Fmt00c { + + public Bpl(CC cc, int simm19) { + super(0, ConditionFlag.Less, Op2s.Bp, cc, 1, simm19); } - public Bpl(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.Less.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bpl(CC cc, Label label) { + super(0, ConditionFlag.Less, Op2s.Bp, cc, 1, label); } } - public static class Bple extends Fmt2c { - public Bple(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.LessEqual.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bple extends Fmt00c { + + public Bple(CC cc, int simm19) { + super(0, ConditionFlag.LessEqual, Op2s.Bp, cc, 1, simm19); } - public Bple(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.LessEqual.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bple(CC cc, Label label) { + super(0, ConditionFlag.LessEqual, Op2s.Bp, cc, 1, label); } } - public static class Bpleu extends Fmt2c { - public Bpleu(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.LessEqualUnsigned.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bpleu extends Fmt00c { + + public Bpleu(CC cc, int simm19) { + super(0, ConditionFlag.LessEqualUnsigned, Op2s.Bp, cc, 1, simm19); } - public Bpleu(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.LessEqualUnsigned.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bpleu(CC cc, Label label) { + super(0, ConditionFlag.LessEqualUnsigned, Op2s.Bp, cc, 1, label); } } - public static class Bpn extends Fmt2c { - public Bpn(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.Never.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bpn extends Fmt00c { + + public Bpn(CC cc, int simm19) { + super(0, ConditionFlag.Never, Op2s.Bp, cc, 1, simm19); } - public Bpn(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.Never.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bpn(CC cc, Label label) { + super(0, ConditionFlag.Never, Op2s.Bp, cc, 1, label); } } - public static class Bpne extends Fmt2c { - public Bpne(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.NotZero.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bpne extends Fmt00c { + + public Bpne(CC cc, int simm19) { + super(0, ConditionFlag.NotZero, Op2s.Bp, cc, 1, simm19); } - public Bpne(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.NotZero.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bpne(CC cc, Label label) { + super(0, ConditionFlag.NotZero, Op2s.Bp, cc, 1, label); } } - public static class Bpneg extends Fmt2c { - public Bpneg(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.Negative.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bpneg extends Fmt00c { + + public Bpneg(CC cc, int simm19) { + super(0, ConditionFlag.Negative, Op2s.Bp, cc, 1, simm19); } - public Bpneg(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.Negative.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bpneg(CC cc, Label label) { + super(0, ConditionFlag.Negative, Op2s.Bp, cc, 1, label); } } - public static class Bppos extends Fmt2c { - public Bppos(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.Positive.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bppos extends Fmt00c { + + public Bppos(CC cc, int simm19) { + super(0, ConditionFlag.Positive, Op2s.Bp, cc, 1, simm19); } - public Bppos(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.Positive.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bppos(CC cc, Label label) { + super(0, ConditionFlag.Positive, Op2s.Bp, cc, 1, label); } } - public static class Bpvc extends Fmt2c { - public Bpvc(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.OverflowClear.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bpvc extends Fmt00c { + + public Bpvc(CC cc, int simm19) { + super(0, ConditionFlag.OverflowClear, Op2s.Bp, cc, 1, simm19); } - public Bpvc(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.OverflowClear.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bpvc(CC cc, Label label) { + super(0, ConditionFlag.OverflowClear, Op2s.Bp, cc, 1, label); } } - public static class Bpvs extends Fmt2c { - public Bpvs(SPARCAssembler masm, CC cc, int simmm19) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.OverflowSet.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, simmm19); + public static class Bpvs extends Fmt00c { + + public Bpvs(CC cc, int simm19) { + super(0, ConditionFlag.OverflowSet, Op2s.Bp, cc, 1, simm19); } - public Bpvs(SPARCAssembler masm, CC cc, Label label) { - super(masm, Ops.BranchOp.getValue(), 0, ConditionFlag.OverflowSet.getValue(), - Op2s.Bp.getValue(), cc.getValue(), 1, - label.isBound() ? label.position() : patchUnbound(masm, label)); + + public Bpvs(CC cc, Label label) { + super(0, ConditionFlag.OverflowSet, Op2s.Bp, cc, 1, label); } } public static class Bshuffle extends Fmt3p { + public Bshuffle(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS2 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Bshuffle.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Bshuffle.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class CammelliaFl extends Fmt3p { + public CammelliaFl(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* CAMELLIA only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.CammelliaFl.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.CammelliaFl.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class CammelliaFli extends Fmt3p { + public CammelliaFli(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* CAMELLIA only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.CammelliaFli.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.CammelliaFli.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } @@ -1090,836 +1257,844 @@ } public static class Cmask8 extends Fmt3n { + public Cmask8(SPARCAssembler asm, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Cmask8.getValue(), - src2.encoding(), 0); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Cmask8.getValue(), src2.encoding(), 0); } } public static class Cmask16 extends Fmt3n { + public Cmask16(SPARCAssembler asm, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Cmask16.getValue(), - src2.encoding(), 0); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Cmask16.getValue(), src2.encoding(), 0); } } public static class Cmask32 extends Fmt3n { + public Cmask32(SPARCAssembler asm, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Cmask32.getValue(), - src2.encoding(), 0); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Cmask32.getValue(), src2.encoding(), 0); } } public static class Crc32c extends Fmt3p { + public Crc32c(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* CRYPTO only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Crc32c.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Crc32c.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Cwbcc extends Fmt2e { + public Cwbcc(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarryClear.getValue(), 0, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarryClear.getValue(), 0, src1.encoding(), simm10, src2.encoding()); } + public Cwbcc(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Equal.getValue(), 0, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Equal.getValue(), 0, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cwbcs extends Fmt2e { + public Cwbcs(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarrySet.getValue(), 0, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarrySet.getValue(), 0, src1.encoding(), simm10, src2.encoding()); } + public Cwbcs(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarrySet.getValue(), 0, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarrySet.getValue(), 0, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cwbe extends Fmt2e { + public Cwbe(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarryClear.getValue(), 0, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarryClear.getValue(), 0, src1.encoding(), simm10, src2.encoding()); } + public Cwbe(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Equal.getValue(), 0, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Equal.getValue(), 0, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cwbg extends Fmt2e { + public Cwbg(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Greater.getValue(), 0, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Greater.getValue(), 0, src1.encoding(), simm10, src2.encoding()); } + public Cwbg(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Greater.getValue(), 0, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Greater.getValue(), 0, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cwbge extends Fmt2e { + public Cwbge(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterEqual.getValue(), 0, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterEqual.getValue(), 0, src1.encoding(), simm10, src2.encoding()); } + public Cwbge(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterEqual.getValue(), 0, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterEqual.getValue(), 0, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cwbgu extends Fmt2e { + public Cwbgu(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterUnsigned.getValue(), 0, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterUnsigned.getValue(), 0, src1.encoding(), simm10, src2.encoding()); } + public Cwbgu(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterUnsigned.getValue(), 0, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterUnsigned.getValue(), 0, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cwbl extends Fmt2e { + public Cwbl(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Less.getValue(), 0, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Less.getValue(), 0, src1.encoding(), simm10, src2.encoding()); } + public Cwbl(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Less.getValue(), 0, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Less.getValue(), 0, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cwble extends Fmt2e { + public Cwble(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqual.getValue(), 0, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqual.getValue(), 0, src1.encoding(), simm10, src2.encoding()); } + public Cwble(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqual.getValue(), 0, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqual.getValue(), 0, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cwbleu extends Fmt2e { + public Cwbleu(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqualUnsigned.getValue(), 0, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqualUnsigned.getValue(), 0, src1.encoding(), simm10, src2.encoding()); } + public Cwbleu(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqualUnsigned.getValue(), 0, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqualUnsigned.getValue(), 0, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cwbne extends Fmt2e { + public Cwbne(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.NotEqual.getValue(), 0, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.NotEqual.getValue(), 0, src1.encoding(), simm10, src2.encoding()); } + public Cwbne(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.NotEqual.getValue(), 0, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.NotEqual.getValue(), 0, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cwbneg extends Fmt2e { + public Cwbneg(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Negative.getValue(), 0, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Negative.getValue(), 0, src1.encoding(), simm10, src2.encoding()); } + public Cwbneg(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Negative.getValue(), 0, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Negative.getValue(), 0, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cwbpos extends Fmt2e { + public Cwbpos(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Positive.getValue(), 0, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Positive.getValue(), 0, src1.encoding(), simm10, src2.encoding()); } + public Cwbpos(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Positive.getValue(), 0, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Positive.getValue(), 0, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cwbvc extends Fmt2e { + public Cwbvc(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowClear.getValue(), 0, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowClear.getValue(), 0, src1.encoding(), simm10, src2.encoding()); } + public Cwbvc(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowClear.getValue(), 0, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowClear.getValue(), 0, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cwbvs extends Fmt2e { + public Cwbvs(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowSet.getValue(), 0, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowSet.getValue(), 0, src1.encoding(), simm10, src2.encoding()); } + public Cwbvs(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowSet.getValue(), 0, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowSet.getValue(), 0, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cxbcc extends Fmt2e { + public Cxbcc(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarryClear.getValue(), 1, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarryClear.getValue(), 1, src1.encoding(), simm10, src2.encoding()); } + public Cxbcc(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Equal.getValue(), 1, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Equal.getValue(), 1, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cxbcs extends Fmt2e { + public Cxbcs(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarrySet.getValue(), 1, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarrySet.getValue(), 1, src1.encoding(), simm10, src2.encoding()); } + public Cxbcs(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarrySet.getValue(), 1, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarrySet.getValue(), 1, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cxbe extends Fmt2e { + public Cxbe(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarryClear.getValue(), 1, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.CarryClear.getValue(), 1, src1.encoding(), simm10, src2.encoding()); } + public Cxbe(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Equal.getValue(), 1, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Equal.getValue(), 1, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cxbg extends Fmt2e { + public Cxbg(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Greater.getValue(), 1, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Greater.getValue(), 1, src1.encoding(), simm10, src2.encoding()); } + public Cxbg(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Greater.getValue(), 1, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Greater.getValue(), 1, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cxbge extends Fmt2e { + public Cxbge(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterEqual.getValue(), 1, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterEqual.getValue(), 1, src1.encoding(), simm10, src2.encoding()); } + public Cxbge(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterEqual.getValue(), 1, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterEqual.getValue(), 1, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cxbgu extends Fmt2e { + public Cxbgu(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterUnsigned.getValue(), 1, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterUnsigned.getValue(), 1, src1.encoding(), simm10, src2.encoding()); } + public Cxbgu(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterUnsigned.getValue(), 1, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.GreaterUnsigned.getValue(), 1, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cxbl extends Fmt2e { + public Cxbl(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Less.getValue(), 1, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Less.getValue(), 1, src1.encoding(), simm10, src2.encoding()); } + public Cxbl(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Less.getValue(), 1, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Less.getValue(), 1, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cxble extends Fmt2e { + public Cxble(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqual.getValue(), 1, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqual.getValue(), 1, src1.encoding(), simm10, src2.encoding()); } + public Cxble(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqual.getValue(), 1, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqual.getValue(), 1, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cxbleu extends Fmt2e { + public Cxbleu(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqualUnsigned.getValue(), 1, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqualUnsigned.getValue(), 1, src1.encoding(), simm10, src2.encoding()); } + public Cxbleu(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqualUnsigned.getValue(), 1, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.LessEqualUnsigned.getValue(), 1, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cxbne extends Fmt2e { + public Cxbne(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.NotEqual.getValue(), 1, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.NotEqual.getValue(), 1, src1.encoding(), simm10, src2.encoding()); } + public Cxbne(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.NotEqual.getValue(), 1, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.NotEqual.getValue(), 1, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cxbneg extends Fmt2e { + public Cxbneg(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Negative.getValue(), 1, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Negative.getValue(), 1, src1.encoding(), simm10, src2.encoding()); } + public Cxbneg(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Negative.getValue(), 1, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Negative.getValue(), 1, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cxbpos extends Fmt2e { + public Cxbpos(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Positive.getValue(), 1, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Positive.getValue(), 1, src1.encoding(), simm10, src2.encoding()); } + public Cxbpos(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.Positive.getValue(), 1, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.Positive.getValue(), 1, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cxbvc extends Fmt2e { + public Cxbvc(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowClear.getValue(), 1, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowClear.getValue(), 1, src1.encoding(), simm10, src2.encoding()); } + public Cxbvc(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowClear.getValue(), 1, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowClear.getValue(), 1, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Cxbvs extends Fmt2e { + public Cxbvs(SPARCAssembler asm, Register src1, Register src2, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowSet.getValue(), 1, - src1.encoding(), simm10, src2.encoding()); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowSet.getValue(), 1, src1.encoding(), simm10, src2.encoding()); } + public Cxbvs(SPARCAssembler asm, Register src1, int immed5, int simm10) { - super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowSet.getValue(), 1, - src1.encoding(), simm10, immed5 | ImmedTrue); + super(asm, Ops.BranchOp.getValue(), ConditionFlag.OverflowSet.getValue(), 1, src1.encoding(), simm10, immed5 | ImmedTrue); } } public static class Edge8cc extends Fmt3p { + public Edge8cc(SPARCAssembler asm, Register src1, Register src2, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge8cc.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge8cc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Edge8n extends Fmt3p { + public Edge8n(SPARCAssembler asm, Register src1, Register src2, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge8n.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge8n.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Edge8lcc extends Fmt3p { + public Edge8lcc(SPARCAssembler asm, Register src1, Register src2, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge8lcc.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge8lcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Edge8ln extends Fmt3p { + public Edge8ln(SPARCAssembler asm, Register src1, Register src2, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge8ln.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge8ln.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Edge16cc extends Fmt3p { + public Edge16cc(SPARCAssembler asm, Register src1, Register src2, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge16cc.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge16cc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Edge16n extends Fmt3p { + public Edge16n(SPARCAssembler asm, Register src1, Register src2, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge16n.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge16n.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Edge16lcc extends Fmt3p { + public Edge16lcc(SPARCAssembler asm, Register src1, Register src2, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge16lcc.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge16lcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Edge16ln extends Fmt3p { + public Edge16ln(SPARCAssembler asm, Register src1, Register src2, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge16ln.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge16ln.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Edge32cc extends Fmt3p { + public Edge32cc(SPARCAssembler asm, Register src1, Register src2, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge32cc.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge32cc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Edge32n extends Fmt3p { + public Edge32n(SPARCAssembler asm, Register src1, Register src2, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge32n.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge32n.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Edge32lcc extends Fmt3p { + public Edge32lcc(SPARCAssembler asm, Register src1, Register src2, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge32lcc.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge32lcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Edge32ln extends Fmt3p { + public Edge32ln(SPARCAssembler asm, Register src1, Register src2, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge32ln.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Edge32ln.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fadds extends Fmt3p { + public Fadds(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fadds.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fadds.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Faddd extends Fmt3p { + public Faddd(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Faddd.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Faddd.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Faddq extends Fmt3p { + public Faddq(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Faddq.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Faddq.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Faligndata extends Fmt3p { + public Faligndata(SPARCAssembler asm, Register src1, Register src2, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Faligndatag.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Faligndatag.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fdivs extends Fmt3p { + public Fdivs(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fdivs.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fdivs.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fdivd extends Fmt3p { + public Fdivd(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fdivd.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fdivd.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fmadds extends Fmt5a { + public Fmadds(SPARCAssembler asm, Register src1, Register src2, Register src3, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fmadds.getValue(), - src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fmadds.getValue(), src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); } } public static class Fmaddd extends Fmt5a { + public Fmaddd(SPARCAssembler asm, Register src1, Register src2, Register src3, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fmaddd.getValue(), - src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fmaddd.getValue(), src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); } } public static class Fmean16 extends Fmt3p { + public Fmean16(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS3 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmean16.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmean16.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fmsubs extends Fmt5a { + public Fmsubs(SPARCAssembler asm, Register src1, Register src2, Register src3, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fmsubs.getValue(), - src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fmsubs.getValue(), src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); } } public static class Fmsubd extends Fmt5a { + public Fmsubd(SPARCAssembler asm, Register src1, Register src2, Register src3, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fmsubd.getValue(), - src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fmsubd.getValue(), src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); } } public static class Fnadds extends Fmt3p { + public Fnadds(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS3 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fnadds.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fnadds.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fnaddd extends Fmt3p { + public Fnaddd(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS3 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fnaddd.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fnaddd.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fnmadds extends Fmt5a { + public Fnmadds(SPARCAssembler asm, Register src1, Register src2, Register src3, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fnmadds.getValue(), - src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fnmadds.getValue(), src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); } } public static class Fnmaddd extends Fmt5a { + public Fnmaddd(SPARCAssembler asm, Register src1, Register src2, Register src3, Register dst) { - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fnmaddd.getValue(), - src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fnmaddd.getValue(), src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); } } public static class Fnmsubs extends Fmt5a { + public Fnmsubs(SPARCAssembler masm, Register src1, Register src2, Register src3, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fnmsubs.getValue(), - src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fnmsubs.getValue(), src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); } } public static class Fnmsubd extends Fmt5a { + public Fnmsubd(SPARCAssembler masm, Register src1, Register src2, Register src3, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fnmsubd.getValue(), - src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Impdep2.getValue(), Op5s.Fnmsubd.getValue(), src1.encoding(), src2.encoding(), src3.encoding(), dst.encoding()); } } public static class Fmuls extends Fmt3p { + public Fmuls(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fmuls.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fmuls.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fmuld extends Fmt3p { + public Fmuld(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fmuld.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fmuld.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fmul8x16 extends Fmt3p { + public Fmul8x16(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS1 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmul8x16.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmul8x16.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fmul8x16au extends Fmt3p { + public Fmul8x16au(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS1 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmul8x16.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmul8x16.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fmul8x16al extends Fmt3p { + public Fmul8x16al(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS1 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmul8x16al.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmul8x16al.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fmul8sux16 extends Fmt3p { + public Fmul8sux16(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS1 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmul8sux16.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmul8sux16.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fmul8ulx16 extends Fmt3p { + public Fmul8ulx16(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS1 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmul8ulx16.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmul8ulx16.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fmuld8sux16 extends Fmt3p { + public Fmuld8sux16(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS1 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmuld8sux16.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmuld8sux16.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fmuld8ulx16 extends Fmt3p { + public Fmuld8ulx16(SPARCAssembler asm, Register src1, Register src2, Register dst) { /* VIS1 only */ - super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmuld8ulx16.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(asm, Ops.ArithOp.getValue(), Op3s.Impdep1.getValue(), Opfs.Fmuld8ulx16.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fnegs extends Fmt3n { + public Fnegs(SPARCAssembler masm, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fnegs.getValue(), - src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fnegs.getValue(), src2.encoding(), dst.encoding()); } } public static class Fnegd extends Fmt3n { + public Fnegd(SPARCAssembler masm, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fnegd.getValue(), - src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fnegd.getValue(), src2.encoding(), dst.encoding()); } } public static class Fstoi extends Fmt3n { + public Fstoi(SPARCAssembler masm, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fstoi.getValue(), - src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fstoi.getValue(), src2.encoding(), dst.encoding()); } } public static class Fdtoi extends Fmt3n { + public Fdtoi(SPARCAssembler masm, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fdtoi.getValue(), - src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fdtoi.getValue(), src2.encoding(), dst.encoding()); } } public static class Flushw extends Fmt3r { + public Flushw(SPARCAssembler masm) { super(masm, Ops.ArithOp.getValue(), 0, Op3s.Flushw.getValue()); } } public static class Fsqrtd extends Fmt3p { + public Fsqrtd(SPARCAssembler masm, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fsqrtd.getValue(), - 0, src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fsqrtd.getValue(), 0, src2.encoding(), dst.encoding()); } } - public static class Fsubs extends Fmt3p { + public Fsubs(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fsubs.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fsubs.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fsubd extends Fmt3p { + public Fsubd(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fsubd.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fsubd.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } public static class Fsubq extends Fmt3p { + public Fsubq(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fsubq.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Fpop1.getValue(), Opfs.Fsubq.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } } 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 Jmpl(Register src, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Jmpl, src, simm13, dst); } } public static class Lddf extends Fmt3b { - public Lddf(SPARCAssembler masm, SPARCAddress src, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Lddf.getValue(), - src.getBase().encoding(), src.getDisplacement(), dst.encoding()); + + // TODO remove address + public Lddf(SPARCAddress src, Register dst) { + super(Ops.LdstOp, Op3s.Lddf, src.getBase(), src.getDisplacement(), dst); } } public static class Ldf extends Fmt3b { - public Ldf(SPARCAssembler masm, SPARCAddress src, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Ldf.getValue(), - src.getBase().encoding(), src.getDisplacement(), dst.encoding()); + + public Ldf(SPARCAddress src, Register dst) { + super(Ops.LdstOp, Op3s.Ldf, src.getBase(), src.getDisplacement(), dst); } } public static class Ldsb extends Fmt3b { - public Ldsb(SPARCAssembler masm, SPARCAddress src, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Ldsb.getValue(), - src.getBase().encoding(), src.getDisplacement(), dst.encoding()); + + public Ldsb(SPARCAddress src, Register dst) { + super(Ops.LdstOp, Op3s.Ldsb, src.getBase(), src.getDisplacement(), dst); } } public static class Ldsh extends Fmt3b { - public Ldsh(SPARCAssembler masm, SPARCAddress src, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Ldsh.getValue(), - src.getBase().encoding(), src.getDisplacement(), dst.encoding()); + + public Ldsh(SPARCAddress src, Register dst) { + super(Ops.LdstOp, Op3s.Ldsh, src.getBase(), src.getDisplacement(), dst); } } public static class Ldsw extends Fmt3b { - public Ldsw(SPARCAssembler masm, SPARCAddress src, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Ldsw.getValue(), - src.getBase().encoding(), src.getDisplacement(), dst.encoding()); + + public Ldsw(SPARCAddress src, Register dst) { + super(Ops.LdstOp, Op3s.Ldsw, src.getBase(), src.getDisplacement(), dst); } } public static class Lduw extends Fmt3b { - public Lduw(SPARCAssembler masm, SPARCAddress src, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Lduw.getValue(), - src.getBase().encoding(), src.getDisplacement(), dst.encoding()); + + public Lduw(SPARCAddress src, Register dst) { + super(Ops.LdstOp, Op3s.Lduw, src.getBase(), src.getDisplacement(), dst); } } public static class Ldx extends Fmt3b { - public Ldx(SPARCAssembler masm, SPARCAddress src, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Ldx.getValue(), - src.getBase().encoding(), src.getDisplacement(), dst.encoding()); + + public Ldx(SPARCAddress src, Register dst) { + super(Ops.LdstOp, Op3s.Ldx, src.getBase(), src.getDisplacement(), dst); } } public static class Membar extends Fmt3b { - public Membar(SPARCAssembler masm, int barriers) { - super(masm, Ops.ArithOp.getValue(), Op3s.Membar.getValue(), - SPARC.r15.encoding(), ImmedTrue | barriers, SPARC.r0.encoding()); + + public Membar(int barriers) { + super(Ops.ArithOp, Op3s.Membar, r15, ImmedTrue | barriers, r0); } } public static class Movcc extends Fmt4c { + public Movcc(SPARCAssembler masm, ConditionFlag cond, CC cca, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Movcc.getValue(), cond.getValue(), cca.getValue(), - src2.encoding(), dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Movcc.getValue(), cond.getValue(), cca.getValue(), src2.encoding(), dst.encoding()); } + public Movcc(SPARCAssembler masm, ConditionFlag cond, CC cca, int simm11a, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Movcc.getValue(), cond.getValue(), cca.getValue(), - simm11a, dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Movcc.getValue(), cond.getValue(), cca.getValue(), simm11a, dst.encoding()); } } public static class Movr extends Fmt3f { - public Movr(SPARCAssembler masm, RCondition rc, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Movr.getValue(), rc.getValue(), - src1.encoding(), src2.encoding(), dst.encoding()); + + public Movr(SPARCAssembler masm, RCondition rc, Register src1, Register src2, Register dst) { + super(masm, Ops.ArithOp.getValue(), Op3s.Movr.getValue(), rc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); } + public Movr(SPARCAssembler masm, RCondition rc, Register src1, int simm10, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Movr.getValue(), rc.getValue(), - src1.encoding(), simm10, dst.encoding()); + super(masm, Ops.ArithOp.getValue(), Op3s.Movr.getValue(), rc.getValue(), src1.encoding(), simm10, dst.encoding()); } } @Deprecated public static class Mulscc extends Fmt3b { + @Deprecated - public Mulscc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Mulscc.getValue(), src1.encoding(), simm13, dst.encoding()); + public Mulscc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Mulscc, src1, simm13, dst); } + @Deprecated - public Mulscc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Mulscc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + public Mulscc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Mulscc, src1, src2, dst); } } public static class Mulx extends Fmt3b { - public Mulx(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Mulx.getValue(), src1.encoding(), simm13, dst.encoding()); - } - public Mulx(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Mulx.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Mulx(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Mulx, src1, simm13, dst); } - } - - public static class NullCheck extends Fmt3b { - public NullCheck(SPARCAssembler masm, SPARCAddress src) { - super(masm, Ops.ArithOp.getValue(), Op3s.Ldx.getValue(), - src.getBase().encoding(), src.getDisplacement(), SPARC.r0.encoding()); + + public Mulx(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Mulx, src1, src2, dst); } } public static class Or extends Fmt3b { - public Or(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Or.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Or(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Or, src1, simm13, dst); } - public Or(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Or.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Or(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Or, src1, src2, dst); } } public static class Orcc extends Fmt3b { - public Orcc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Orcc.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Orcc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Orcc, src1, simm13, dst); } - public Orcc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Orcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Orcc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Orcc, src1, src2, dst); } } public static class Orn extends Fmt3b { - public Orn(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Orn.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Orn(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Orn, src1, simm13, dst); } - public Orn(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Orn.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Orn(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Orn, src1, src2, dst); } } public static class Orncc extends Fmt3b { - public Orncc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Orncc.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Orncc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Orncc, src1, simm13, dst); } - public Orncc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Orncc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Orncc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Orncc, src1, src2, dst); } } public static class Popc extends Fmt3b { - public Popc(SPARCAssembler masm, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Popc.getValue(), 0, simm13, dst.encoding()); + + public Popc(int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Popc, r0, simm13, dst); } - public Popc(SPARCAssembler masm, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Popc.getValue(), 0, src2.encoding(), dst.encoding()); + + public Popc(Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Popc, r0, src2, dst); } } @@ -1927,71 +2102,85 @@ @Deprecated public static class Rdy extends Fmt3q { + public Rdy(SPARCAssembler masm, Register dst) { super(masm, Ops.ArithOp.getValue(), Op3s.Rdreg.getValue(), 0, dst.encoding()); } } public static class Rdccr extends Fmt3q { + public Rdccr(SPARCAssembler masm, Register dst) { super(masm, Ops.ArithOp.getValue(), Op3s.Rdreg.getValue(), 2, dst.encoding()); } } public static class Rdasi extends Fmt3q { + public Rdasi(SPARCAssembler masm, Register dst) { super(masm, Ops.ArithOp.getValue(), Op3s.Rdreg.getValue(), 3, dst.encoding()); } } public static class Rdtick extends Fmt3q { + public Rdtick(SPARCAssembler masm, Register dst) { super(masm, Ops.ArithOp.getValue(), Op3s.Rdreg.getValue(), 4, dst.encoding()); } } public static class Rdpc extends Fmt3q { + public Rdpc(SPARCAssembler masm, Register dst) { super(masm, Ops.ArithOp.getValue(), Op3s.Rdreg.getValue(), 5, dst.encoding()); } } public static class Rdfprs extends Fmt3q { + public Rdfprs(SPARCAssembler masm, Register dst) { super(masm, Ops.ArithOp.getValue(), Op3s.Rdreg.getValue(), 6, dst.encoding()); } } 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 Restore(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Restore, src1, src2, dst); } } 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); } + public Return(SPARCAssembler masm, Register src1, Register src2) { super(masm, Ops.ArithOp.getValue(), Op3s.Rett.getValue(), src1.encoding(), src2.encoding()); } } 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 Save(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Save, src1, src2, dst); + } + + public Save(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Save, src1, simm13, dst); } } public static class Saved extends Fmt3r { + public Saved(SPARCAssembler asm) { super(asm, Ops.ArithOp.getValue(), 0, Op3s.Saved.getValue()); } @@ -1999,511 +2188,470 @@ @Deprecated public static class Sdiv extends Fmt3b { + @Deprecated - public Sdiv(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Sdiv.getValue(), src1.encoding(), simm13, dst.encoding()); + public Sdiv(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Sdiv, src1, simm13, dst); } + @Deprecated - public Sdiv(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Sdiv.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + public Sdiv(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Sdiv, src1, src2, dst); } } @Deprecated public static class Sdivcc extends Fmt3b { + @Deprecated - public Sdivcc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Sdivcc.getValue(), src1.encoding(), simm13, dst.encoding()); + public Sdivcc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Sdivcc, src1, simm13, dst); } + @Deprecated - public Sdivcc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Sdivcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + public Sdivcc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Sdivcc, src1, src2, dst); } } public static class Sdivx extends Fmt3b { - public Sdivx(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Sdivx.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Sdivx(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Sdivx, src1, simm13, dst); } - public Sdivx(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Sdivx.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Sdivx(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Sdivx, src1, src2, dst); } } - public static class Sethi extends Fmt2a { - public Sethi(SPARCAssembler masm, int simm22, Register dst) { - super(masm, Ops.BranchOp.getValue(), Op2s.Sethi.getValue(), simm22, dst.encoding()); + public static class Sethi extends Fmt00a { + + public Sethi(int simm22, Register dst) { + super(Op2s.Sethi, simm22, 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()); + + public Sir(int simm13) { + super(Ops.ArithOp, Op3s.Sir, r0, simm13, r15); } } 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()); + + public Sll(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Sll, src1, simm13, dst); } - public Sll(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Sll.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Sll(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Sll, src1, src2, dst); } } public static class Sllx extends Fmt3b { - public Sllx(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Sllx.getValue(), src1.encoding(), simm13, dst.encoding()); - } - public Sllx(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Sllx.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); - } - } - - public static class Smul extends Fmt3b { - public Smul(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Smul.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Sllx(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Sllx, src1, simm13, dst); } - public Smul(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Smul.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); - } - } - - @Deprecated - public static class Smulcc extends Fmt3b { - public Smulcc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Smulcc.getValue(), src1.encoding(), simm13, dst.encoding()); - } - public Smulcc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Smulcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Sllx(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Sllx, src1, src2, dst); } } public static class Sra extends Fmt3b { - public Sra(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Sra.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Sra(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Sra, src1, simm13, dst); } - public Sra(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Sra.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Sra(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Sra, src1, src2, dst); } } public static class Srax extends Fmt3b { - public Srax(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Srax.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Srax(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Srax, src1, simm13, dst); } - public Srax(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Srax.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Srax(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Srax, src1, src2, dst); } } public static class Srl extends Fmt3b { - public Srl(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Srl.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Srl(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Srl, src1, simm13, dst); } - public Srl(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Srl.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Srl(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Srl, src1, src2, dst); } } public static class Srlx extends Fmt3b { - public Srlx(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Srlx.getValue(), src1.encoding(), simm13, dst.encoding()); - } - public Srlx(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Srlx.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Srlx(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Srlx, src1, simm13, dst); } - } - - @Deprecated - public static class Stbar extends Fmt3b { - public Stbar(SPARCAssembler masm) { - super(masm, Ops.ArithOp.getValue(), Op3s.Membar.getValue(), - SPARC.r15.encoding(), 0, SPARC.r0.encoding()); + + public Srlx(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Srlx, src1, src2, dst); } } public static class Stb extends Fmt3b { - public Stb(SPARCAssembler masm, Register dst, SPARCAddress addr) { - super(masm, Ops.ArithOp.getValue(), Op3s.Stb.getValue(), - addr.getBase().encoding(), addr.getDisplacement(), dst.encoding()); + + public Stb(Register dst, SPARCAddress addr) { + super(Ops.LdstOp, Op3s.Stb, addr.getBase(), addr.getDisplacement(), dst); } } public static class Sth extends Fmt3b { - public Sth(SPARCAssembler masm, Register dst, SPARCAddress addr) { - super(masm, Ops.ArithOp.getValue(), Op3s.Sth.getValue(), - addr.getBase().encoding(), addr.getDisplacement(), dst.encoding()); + + public Sth(Register dst, SPARCAddress addr) { + super(Ops.LdstOp, Op3s.Sth, addr.getBase(), addr.getDisplacement(), dst); } } public static class Stw extends Fmt3b { - public Stw(SPARCAssembler masm, Register dst, SPARCAddress addr) { - super(masm, Ops.ArithOp.getValue(), Op3s.Stw.getValue(), - addr.getBase().encoding(), addr.getDisplacement(), dst.encoding()); + + public Stw(Register dst, SPARCAddress addr) { + super(Ops.LdstOp, Op3s.Stw, addr.getBase(), addr.getDisplacement(), dst); } } public static class Stx extends Fmt3b { - public Stx(SPARCAssembler masm, Register dst, SPARCAddress addr) { - super(masm, Ops.ArithOp.getValue(), Op3s.Stx.getValue(), - addr.getBase().encoding(), addr.getDisplacement(), dst.encoding()); + + public Stx(Register dst, SPARCAddress addr) { + super(Ops.LdstOp, Op3s.Stx, addr.getBase(), addr.getDisplacement(), dst); } } public static class Sub extends Fmt3b { - public Sub(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Sub.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Sub(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Sub, src1, simm13, dst); } - public Sub(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Sub.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Sub(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Sub, src1, src2, dst); } } public static class Subc extends Fmt3b { - public Subc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Subc.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Subc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Subc, src1, simm13, dst); } - public Subc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Subc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Subc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Subc, src1, src2, dst); } } public static class Subcc extends Fmt3b { - public Subcc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Subcc.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Subcc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Subcc, src1, simm13, dst); } - public Subcc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Subcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Subcc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Subcc, src1, src2, dst); } } public static class Subccc extends Fmt3b { - public Subccc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Subccc.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Subccc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Subccc, src1, simm13, dst); } - public Subccc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Subccc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Subccc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Subccc, src1, src2, dst); } } public static class Ta extends Fmt4a { + public Ta(SPARCAssembler asm, CC cc, Register src1, int trap) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), trap, ConditionFlag.Always.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), trap, ConditionFlag.Always.getValue()); } + public Ta(SPARCAssembler asm, CC cc, Register src1, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), src2.encoding(), ConditionFlag.Always.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), src2.encoding(), ConditionFlag.Always.getValue()); } } public static class Taddcc extends Fmt3b { - public Taddcc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Taddcc.getValue(), src1.encoding(), simm13, dst.encoding()); - } - public Taddcc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Taddcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Taddcc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Taddcc, src1, simm13, dst); } - } - - @Deprecated - public static class Taddcctv extends Fmt3b { - @Deprecated - public Taddcctv(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Taddcctv.getValue(), src1.encoding(), simm13, dst.encoding()); - } - @Deprecated - public Taddcctv(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), dst.encoding(), Op3s.Taddcctv.getValue(), src2.encoding(), src1.encoding()); + + public Taddcc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Taddcc, src1, src2, dst); } } public static class Tcc extends Fmt4a { + public Tcc(SPARCAssembler asm, CC cc, Register src1, int trap) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), trap, ConditionFlag.CarryClear.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), trap, ConditionFlag.CarryClear.getValue()); } + public Tcc(SPARCAssembler asm, CC cc, Register src1, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), src2.encoding(), ConditionFlag.CarryClear.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), src2.encoding(), ConditionFlag.CarryClear.getValue()); } } public static class Tcs extends Fmt4a { + public Tcs(SPARCAssembler asm, CC cc, Register src1, int trap) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), trap, ConditionFlag.CarrySet.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), trap, ConditionFlag.CarrySet.getValue()); } + public Tcs(SPARCAssembler asm, CC cc, Register src1, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), src2.encoding(), ConditionFlag.CarrySet.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), src2.encoding(), ConditionFlag.CarrySet.getValue()); } } public static class Te extends Fmt4a { + public Te(SPARCAssembler asm, CC cc, Register src1, int trap) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), trap, ConditionFlag.Equal.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), trap, ConditionFlag.Equal.getValue()); } + public Te(SPARCAssembler asm, CC cc, Register src1, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), src2.encoding(), ConditionFlag.Equal.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), src2.encoding(), ConditionFlag.Equal.getValue()); } } public static class Tg extends Fmt4a { + public Tg(SPARCAssembler asm, CC cc, Register src1, int trap) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), trap, ConditionFlag.Greater.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), trap, ConditionFlag.Greater.getValue()); } + public Tg(SPARCAssembler asm, CC cc, Register src1, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), src2.encoding(), ConditionFlag.Greater.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), src2.encoding(), ConditionFlag.Greater.getValue()); } } public static class Tge extends Fmt4a { + public Tge(SPARCAssembler asm, CC cc, Register src1, int trap) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), trap, ConditionFlag.GreaterEqual.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), trap, ConditionFlag.GreaterEqual.getValue()); } + public Tge(SPARCAssembler asm, CC cc, Register src1, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), src2.encoding(), ConditionFlag.GreaterEqual.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), src2.encoding(), ConditionFlag.GreaterEqual.getValue()); } } public static class Tle extends Fmt4a { + public Tle(SPARCAssembler asm, CC cc, Register src1, int trap) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), trap, ConditionFlag.LessEqual.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), trap, ConditionFlag.LessEqual.getValue()); } + public Tle(SPARCAssembler asm, CC cc, Register src1, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), src2.encoding(), ConditionFlag.LessEqual.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), src2.encoding(), ConditionFlag.LessEqual.getValue()); } } public static class Tleu extends Fmt4a { + public Tleu(SPARCAssembler asm, CC cc, Register src1, int trap) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), trap, ConditionFlag.LessEqualUnsigned.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), trap, ConditionFlag.LessEqualUnsigned.getValue()); } + public Tleu(SPARCAssembler asm, CC cc, Register src1, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), src2.encoding(), ConditionFlag.LessEqualUnsigned.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), src2.encoding(), ConditionFlag.LessEqualUnsigned.getValue()); } } public static class Tn extends Fmt4a { + public Tn(SPARCAssembler asm, CC cc, Register src1, int trap) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), trap, ConditionFlag.Never.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), trap, ConditionFlag.Never.getValue()); } + public Tn(SPARCAssembler asm, CC cc, Register src1, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), src2.encoding(), ConditionFlag.Never.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), src2.encoding(), ConditionFlag.Never.getValue()); } } public static class Tne extends Fmt4a { + public Tne(SPARCAssembler asm, CC cc, Register src1, int trap) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), trap, ConditionFlag.NotEqual.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), trap, ConditionFlag.NotEqual.getValue()); } + public Tne(SPARCAssembler asm, CC cc, Register src1, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), src2.encoding(), ConditionFlag.NotEqual.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), src2.encoding(), ConditionFlag.NotEqual.getValue()); } } public static class Tneg extends Fmt4a { + public Tneg(SPARCAssembler asm, CC cc, Register src1, int trap) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), trap, ConditionFlag.Negative.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), trap, ConditionFlag.Negative.getValue()); } + public Tneg(SPARCAssembler asm, CC cc, Register src1, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), src2.encoding(), ConditionFlag.Negative.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), src2.encoding(), ConditionFlag.Negative.getValue()); } } public static class Tpos extends Fmt4a { + public Tpos(SPARCAssembler asm, CC cc, Register src1, int trap) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), trap, ConditionFlag.Positive.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), trap, ConditionFlag.Positive.getValue()); } + public Tpos(SPARCAssembler asm, CC cc, Register src1, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), src2.encoding(), ConditionFlag.Positive.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), src2.encoding(), ConditionFlag.Positive.getValue()); } } public static class Tsubcc extends Fmt3b { - public Tsubcc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Tsubcc.getValue(), src1.encoding(), simm13, dst.encoding()); - } - public Tsubcc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Tsubcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Tsubcc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Tsubcc, src1, simm13, dst); } - } - - @Deprecated - public static class Tsubcctv extends Fmt3b { - @Deprecated - public Tsubcctv(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Tsubcctv.getValue(), src1.encoding(), simm13, dst.encoding()); - } - @Deprecated - public Tsubcctv(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Tsubcctv.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Tsubcc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Tsubcc, src1, src2, dst); } } public static class Tvc extends Fmt4a { + public Tvc(SPARCAssembler asm, CC cc, Register src1, int trap) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), trap, ConditionFlag.OverflowClear.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), trap, ConditionFlag.OverflowClear.getValue()); } + public Tvc(SPARCAssembler asm, CC cc, Register src1, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), src2.encoding(), ConditionFlag.OverflowClear.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), src2.encoding(), ConditionFlag.OverflowClear.getValue()); } } public static class Tvs extends Fmt4a { + public Tvs(SPARCAssembler asm, CC cc, Register src1, int trap) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), trap, ConditionFlag.OverflowSet.getValue()); - } - public Tvs(SPARCAssembler asm, CC cc, Register src1, Register src2) { - super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), - src1.encoding(), src2.encoding(), ConditionFlag.OverflowSet.getValue()); + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), trap, ConditionFlag.OverflowSet.getValue()); } - } - - @Deprecated - public static class Udiv extends Fmt3b { - @Deprecated - public Udiv(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Udiv.getValue(), src1.encoding(), simm13, dst.encoding()); - } - @Deprecated - public Udiv(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Udiv.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); - } - } - - public static class Udivcc extends Fmt3b { - public Udivcc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Udivcc.getValue(), src1.encoding(), simm13, dst.encoding()); - } - public Udivcc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Udivcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Tvs(SPARCAssembler asm, CC cc, Register src1, Register src2) { + super(asm, Ops.ArithOp.getValue(), Op3s.Trap.getValue(), cc.getValue(), src1.encoding(), src2.encoding(), ConditionFlag.OverflowSet.getValue()); } } public static class Udivx extends Fmt3b { - public Udivx(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Udivx.getValue(), src1.encoding(), simm13, dst.encoding()); - } - public Udivx(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Udivx.getValue(), dst.encoding(), src2.encoding(), src1.encoding()); - } - } - - public static class Umul extends Fmt3b { - public Umul(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Umul.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Udivx(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Udivx, src1, simm13, dst); } - public Umul(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Umul.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); - } - } - - public static class Umulcc extends Fmt3b { - public Umulcc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Umulcc.getValue(), src1.encoding(), simm13, dst.encoding()); - } - public Umulcc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Umulcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Udivx(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Udivx, src1, src2, dst); } } @Deprecated public static class Wry extends Fmt3b { + @Deprecated - public Wry(SPARCAssembler masm, int simm13, Register src2) { - super(masm, Ops.ArithOp.getValue(), Op3s.Wrreg.getValue(), 0, src2.encoding(), simm13); + public Wry(Register src1, int simm13) { + super(Ops.ArithOp, Op3s.Wrreg, src1, simm13, r0); } + @Deprecated - public Wry(SPARCAssembler masm, Register src1, Register src2) { - super(masm, Ops.ArithOp.getValue(), Op3s.Wrreg.getValue(), 0, src2.encoding(), src1.encoding()); + public Wry(Register src1, Register src2) { + super(Ops.ArithOp, Op3s.Wrreg, src1, src2, r0); } } public static class Wrccr extends Fmt3b { - public Wrccr(SPARCAssembler masm, int simm13, Register src2) { - super(masm, Ops.ArithOp.getValue(), Op3s.Wrreg.getValue(), 2, src2.encoding(), simm13); + + public Wrccr(Register src1, int simm13) { + super(Ops.ArithOp, Op3s.Wrreg, src1, simm13, r2); } - public Wrccr(SPARCAssembler masm, Register src1, Register src2) { - super(masm, Ops.ArithOp.getValue(), Op3s.Wrreg.getValue(), 2, src2.encoding(), src1.encoding()); + + public Wrccr(Register src1, Register src2) { + super(Ops.ArithOp, Op3s.Wrreg, src1, src2, r2); } } public static class Wrasi extends Fmt3b { - public Wrasi(SPARCAssembler masm, int simm13, Register src2) { - super(masm, Ops.ArithOp.getValue(), Op3s.Wrreg.getValue(), 3, src2.encoding(), simm13); + + public Wrasi(Register src1, int simm13) { + super(Ops.ArithOp, Op3s.Wrreg, src1, simm13, r3); } - public Wrasi(SPARCAssembler masm, Register src1, Register src2) { - super(masm, Ops.ArithOp.getValue(), Op3s.Wrreg.getValue(), 3, src2.encoding(), src1.encoding()); + + public Wrasi(Register src1, Register src2) { + super(Ops.ArithOp, Op3s.Wrreg, src1, src2, r3); } } public static class Wrfprs extends Fmt3b { - public Wrfprs(SPARCAssembler masm, int simm13, Register src2) { - super(masm, Ops.ArithOp.getValue(), Op3s.Wrreg.getValue(), 6, src2.encoding(), simm13); + + public Wrfprs(Register src1, int simm13) { + super(Ops.ArithOp, Op3s.Wrreg, src1, simm13, r6); } - public Wrfprs(SPARCAssembler masm, Register src1, Register src2) { - super(masm, Ops.ArithOp.getValue(), Op3s.Wrreg.getValue(), 6, src2.encoding(), src1.encoding()); + + public Wrfprs(Register src1, Register src2) { + super(Ops.ArithOp, Op3s.Wrreg, src1, src2, r6); } } public static class Xor extends Fmt3b { - public Xor(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Xor.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Xor(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Xor, src1, simm13, dst); } - public Xor(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Xor.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Xor(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Xor, src1, src2, dst); } } public static class Xorcc extends Fmt3b { - public Xorcc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Xorcc.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Xorcc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Xorcc, src1, simm13, dst); } - public Xorcc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Xorcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Xorcc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Xorcc, src1, src2, dst); } } public static class Xnor extends Fmt3b { - public Xnor(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Xnor.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Xnor(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Xnor, src1, simm13, dst); } - public Xnor(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Xnor.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Xnor(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Xnor, src1, src2, dst); } } public static class Xnorcc extends Fmt3b { - public Xnorcc(SPARCAssembler masm, Register src1, int simm13, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Xnorcc.getValue(), src1.encoding(), simm13, dst.encoding()); + + public Xnorcc(Register src1, int simm13, Register dst) { + super(Ops.ArithOp, Op3s.Xnorcc, src1, simm13, dst); } - public Xnorcc(SPARCAssembler masm, Register src1, Register src2, Register dst) { - super(masm, Ops.ArithOp.getValue(), Op3s.Xnorcc.getValue(), src1.encoding(), src2.encoding(), dst.encoding()); + + public Xnorcc(Register src1, Register src2, Register dst) { + super(Ops.ArithOp, Op3s.Xnorcc, src1, src2, dst); } } } diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCMacroAssembler.java --- a/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCMacroAssembler.java Thu Jun 20 10:56:34 2013 -0700 +++ b/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCMacroAssembler.java Thu Jun 20 20:40:52 2013 -0700 @@ -22,9 +22,13 @@ */ package com.oracle.graal.asm.sparc; +import static com.oracle.graal.sparc.SPARC.*; import static com.oracle.graal.asm.sparc.SPARCAssembler.CC.*; import com.oracle.graal.api.code.*; +import com.oracle.graal.asm.*; +import com.oracle.graal.asm.sparc.SPARCAssembler.*; +import com.oracle.graal.debug.*; import com.oracle.graal.sparc.*; public class SPARCMacroAssembler extends SPARCAssembler { @@ -33,51 +37,74 @@ super(target, registerConfig); } + @Override + public void align(int modulus) { + if (codeBuffer.position() % modulus != 0) { + final int count = modulus - (codeBuffer.position() % modulus); + for (int i = 0; i < count; i++) { + new Nop().emit(this); + } + } + } + + @Override @SuppressWarnings("unused") - public static class Bclr { + public void jmp(Label l) { + new Bpa(l).emit(this); + new Nop().emit(this); + } - public Bclr(SPARCAssembler asm, Register src, Register dst) { - new Andn(asm, dst, src, dst); + @Override + protected final void patchJumpTarget(int branch, int branchTarget) { + final int disp = branchTarget - branch; + Fmt00c fmt = Fmt00c.read(this, branch); + fmt.setDisp19(disp); + fmt.write(this, branch); + } + + @Override + public AbstractAddress makeAddress(Register base, int displacement) { + throw new InternalError("NYI"); + } + + @Override + public AbstractAddress getPlaceholder() { + throw new InternalError("NYI"); + } + + @SuppressWarnings("unused") + public static class Bclr extends Andn { + + public Bclr(Register src, Register dst) { + super(dst, src, dst); } - public Bclr(SPARCAssembler asm, int simm13, Register dst) { - new Andn(asm, dst, simm13, dst); + public Bclr(int simm13, Register dst) { + super(dst, simm13, dst); } } @SuppressWarnings("unused") - public static class Bset { + public static class Bset extends Or { - public Bset(SPARCAssembler asm, Register src, Register dst) { - new Or(asm, dst, src, dst); + public Bset(Register src, Register dst) { + super(dst, src, dst); } - public Bset(SPARCAssembler asm, int simm13, Register dst) { - new Or(asm, dst, simm13, dst); + public Bset(int simm13, Register dst) { + super(dst, simm13, dst); } } @SuppressWarnings("unused") - public static class Btog { + public static class Btst extends Andcc { - public Btog(SPARCAssembler asm, Register src, Register dst) { - new Xor(asm, dst, src, dst); + public Btst(Register src1, Register src2) { + super(src1, src2, g0); } - public Btog(SPARCAssembler asm, int simm13, Register dst) { - new Xor(asm, dst, simm13, dst); - } - } - - @SuppressWarnings("unused") - public static class Btst { - - public Btst(SPARCAssembler asm, Register src1, Register src2) { - new Andcc(asm, src1, src2, SPARC.g0); - } - - public Btst(SPARCAssembler asm, Register src1, int simm13) { - new Andcc(asm, src1, simm13, SPARC.g0); + public Btst(Register src1, int simm13) { + super(src1, simm13, g0); } } @@ -85,194 +112,202 @@ public static class Clr { public Clr(SPARCAssembler asm, Register dst) { - new Or(asm, SPARC.g0, SPARC.g0, dst); + new Or(g0, g0, dst).emit(asm); } public Clr(SPARCAssembler asm, SPARCAddress addr) { - new Stw(asm, SPARC.g0, addr); + new Stw(g0, addr).emit(asm); } } @SuppressWarnings("unused") - public static class Clrb { + public static class Clrb extends Stb { - public Clrb(SPARCAssembler asm, SPARCAddress addr) { - new Stb(asm, SPARC.g0, addr); + public Clrb(SPARCAddress addr) { + super(g0, addr); } } @SuppressWarnings("unused") - public static class Clrh { + public static class Clrh extends Sth { - public Clrh(SPARCAssembler asm, SPARCAddress addr) { - new Sth(asm, SPARC.g0, addr); + public Clrh(SPARCAddress addr) { + super(g0, addr); } } @SuppressWarnings("unused") - public static class Clrx { + public static class Clrx extends Stx { - public Clrx(SPARCAssembler asm, SPARCAddress addr) { - new Stx(asm, SPARC.g0, addr); + public Clrx(SPARCAddress addr) { + super(g0, addr); } } @SuppressWarnings("unused") - public static class Clruw { + public static class Clruw extends Srl { - public Clruw(SPARCAssembler asm, Register src1, Register dst) { + public Clruw(Register src1, Register dst) { + super(src1, g0, dst); assert src1.encoding() != dst.encoding(); - new Srl(asm, src1, SPARC.g0, dst); } - public Clruw(SPARCAssembler asm, Register dst) { - new Srl(asm, dst, SPARC.g0, dst); + public Clruw(Register dst) { + super(dst, g0, dst); } } @SuppressWarnings("unused") - public static class Cmp { + public static class Cmp extends Subcc { - public Cmp(SPARCAssembler asm, Register a, Register b) { - new Subcc(asm, a, b, SPARC.g0); + public Cmp(Register a, Register b) { + super(a, b, g0); } - public Cmp(SPARCAssembler asm, Register a, int simm13) { - new Subcc(asm, a, simm13, SPARC.g0); + public Cmp(Register a, int simm13) { + super(a, simm13, g0); } } @SuppressWarnings("unused") - public static class Dec { + public static class Dec extends Sub { - public Dec(SPARCAssembler asm, Register dst) { - new Sub(asm, dst, 1, dst); + public Dec(Register dst) { + super(dst, 1, dst); } - public Dec(SPARCAssembler asm, int simm13, Register dst) { - new Sub(asm, dst, simm13, dst); + public Dec(int simm13, Register dst) { + super(dst, simm13, dst); } } @SuppressWarnings("unused") - public static class Deccc { + public static class Deccc extends Subcc { - public Deccc(SPARCAssembler asm, Register dst) { - new Subcc(asm, dst, 1, dst); + public Deccc(Register dst) { + super(dst, 1, dst); } - public Deccc(SPARCAssembler asm, int simm13, Register dst) { - new Subcc(asm, dst, simm13, dst); + public Deccc(int simm13, Register dst) { + super(dst, simm13, dst); } } @SuppressWarnings("unused") public static class Inc { - public Inc(SPARCAssembler asm, Register dst) { - new Add(asm, dst, 1, dst); + public Inc(Register dst) { + new Add(dst, 1, dst); } - public Inc(SPARCAssembler asm, int simm13, Register dst) { - new Add(asm, dst, simm13, dst); + public Inc(int simm13, Register dst) { + new Add(dst, simm13, dst); } } @SuppressWarnings("unused") public static class Inccc { - public Inccc(SPARCAssembler asm, Register dst) { - new Addcc(asm, dst, 1, dst); + public Inccc(Register dst) { + new Addcc(dst, 1, dst); } - public Inccc(SPARCAssembler asm, int simm13, Register dst) { - new Addcc(asm, dst, simm13, dst); + public Inccc(int simm13, Register dst) { + new Addcc(dst, simm13, dst); } } @SuppressWarnings("unused") - public static class Jmp { + public static class Jmp extends Jmpl { public Jmp(SPARCAssembler asm, SPARCAddress address) { - new Jmpl(asm, address, SPARC.g0); + super(address.getBase(), address.getDisplacement(), g0); } } @SuppressWarnings("unused") - public static class Neg { + public static class Neg extends Sub { - public Neg(SPARCAssembler asm, Register src2, Register dst) { + public Neg(Register src2, Register dst) { + super(g0, src2, dst); assert src2.encoding() != dst.encoding(); - new Sub(asm, SPARC.g0, src2, dst); } - public Neg(SPARCAssembler asm, Register dst) { - new Sub(asm, SPARC.g0, dst, dst); + public Neg(Register dst) { + super(g0, dst, dst); } } @SuppressWarnings("unused") - public static class Mov { + public static class Mov extends Or { - public Mov(SPARCAssembler asm, Register src1, Register dst) { + public Mov(Register src1, Register dst) { + super(g0, src1, dst); assert src1.encoding() != dst.encoding(); - new Or(asm, SPARC.g0, src1, dst); } - public Mov(SPARCAssembler asm, int simm13, Register dst) { - new Or(asm, SPARC.g0, simm13, dst); + public Mov(int simm13, Register dst) { + super(g0, simm13, dst); + } + } + + public static class Nop extends Sethi { + + public Nop() { + super(0, r0); } } @SuppressWarnings("unused") - public static class Not { + public static class Not extends Xnor { - public Not(SPARCAssembler asm, Register src1, Register dst) { + public Not(Register src1, Register dst) { + super(src1, g0, dst); assert src1.encoding() != dst.encoding(); - new Xnor(asm, src1, SPARC.g0, dst); } - public Not(SPARCAssembler asm, Register dst) { - new Xnor(asm, dst, SPARC.g0, dst); + public Not(Register dst) { + super(dst, g0, dst); } } @SuppressWarnings("unused") - public static class RestoreWindow { + public static class RestoreWindow extends Restore { - public RestoreWindow(SPARCAssembler asm) { - new Restore(asm, SPARC.g0, SPARC.g0, SPARC.g0); + public RestoreWindow() { + super(g0, g0, g0); } } @SuppressWarnings("unused") - public static class Ret { + public static class Ret extends Jmpl { - public Ret(SPARCAssembler asm) { - new Jmpl(asm, new SPARCAddress(SPARC.i0, 8), SPARC.g0); - + public Ret() { + super(i7, 8, g0); } } @SuppressWarnings("unused") - public static class SaveWindow { + public static class SaveWindow extends Save { - public SaveWindow(SPARCAssembler asm) { - new Save(asm, SPARC.g0, SPARC.g0, SPARC.g0); + public SaveWindow() { + super(g0, g0, g0); } } @SuppressWarnings("unused") public static class Setuw { - public Setuw(SPARCAssembler asm, int value, Register dst) { - if (value >= 0 && ((value & 0x3FFF) == 0)) { - new Sethi(asm, hi22(value), dst); + public Setuw(SPARCAssembler masm, int value, Register dst) { + if (value == 0) { + new Clr(masm, dst); } else if (-4095 <= value && value <= 4096) { - new Or(asm, SPARC.g0, value, dst); + new Or(g0, value, dst).emit(masm); + } else if (value >= 0 && ((value & 0x3FFF) == 0)) { + new Sethi(hi22(value), dst).emit(masm); } else { - new Sethi(asm, hi22(value), dst); - new Or(asm, dst, lo10(value), dst); + new Sethi(hi22(value), dst).emit(masm); + new Or(dst, lo10(value), dst).emit(masm); } } } @@ -285,50 +320,50 @@ int lo = (int) (value & ~0); if (isSimm13(lo) && value == lo) { - new Or(asm, SPARC.g0, lo, dst); + new Or(g0, lo, dst).emit(asm); } else if (hi == 0) { - new Sethi(asm, lo, dst); // hardware version zero-extends to upper 32 + new Sethi(lo, dst).emit(asm); // hardware version zero-extends to upper 32 if (lo10(lo) != 0) { - new Or(asm, dst, lo10(lo), dst); + new Or(dst, lo10(lo), dst).emit(asm); } } else if (hi == -1) { - new Sethi(asm, ~lo, dst); // hardware version zero-extends to upper 32 - new Xor(asm, dst, lo10(lo) ^ ~lo10(~0), dst); + new Sethi(~lo, dst).emit(asm); // hardware version zero-extends to upper 32 + new Xor(dst, lo10(lo) ^ ~lo10(~0), dst).emit(asm); } else if (lo == 0) { if (isSimm13(hi)) { - new Or(asm, SPARC.g0, hi, dst); + new Or(g0, hi, dst).emit(asm); } else { - new Sethi(asm, hi, dst); // hardware version zero-extends to upper 32 + new Sethi(hi, dst).emit(asm); // hardware version zero-extends to upper 32 if (lo10(hi) != 0) { - new Or(asm, dst, lo10(hi), dst); + new Or(dst, lo10(hi), dst).emit(asm); } } - new Sllx(asm, dst, 32, dst); + new Sllx(dst, 32, dst).emit(asm); } else { - new Sethi(asm, hi, tmp); - new Sethi(asm, lo, dst); // macro assembler version sign-extends + new Sethi(hi, tmp).emit(asm); + new Sethi(lo, dst).emit(asm); // macro assembler version sign-extends if (lo10(hi) != 0) { - new Or(asm, tmp, lo10(hi), tmp); + new Or(tmp, lo10(hi), tmp).emit(asm); } if (lo10(lo) != 0) { - new Or(asm, dst, lo10(lo), dst); + new Or(dst, lo10(lo), dst).emit(asm); } - new Sllx(asm, tmp, 32, tmp); - new Or(asm, dst, tmp, dst); + new Sllx(tmp, 32, tmp).emit(asm); + new Or(dst, tmp, dst).emit(asm); } } } @SuppressWarnings("unused") - public static class Signx { + public static class Signx extends Sra { - public Signx(SPARCAssembler asm, Register src1, Register dst) { + public Signx(Register src1, Register dst) { + super(src1, g0, dst); assert src1.encoding() != dst.encoding(); - new Sra(asm, src1, SPARC.g0, dst); } - public Signx(SPARCAssembler asm, Register dst) { - new Sra(asm, dst, SPARC.g0, dst); + public Signx(Register dst) { + super(dst, g0, dst); } } @@ -337,7 +372,7 @@ public Trap(SPARCAssembler asm, int trap) { assert trap >= 0 && trap <= 0x7f; - new Ta(asm, Icc, SPARC.g0, trap); + new Ta(asm, Icc, g0, trap); } } } diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCBackend.java --- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCBackend.java Thu Jun 20 10:56:34 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +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; - -import com.oracle.graal.api.code.CallingConvention; -import com.oracle.graal.api.code.CodeCacheProvider; -import com.oracle.graal.api.code.CompilationResult; -import com.oracle.graal.api.code.TargetDescription; -import com.oracle.graal.api.meta.ResolvedJavaMethod; -import com.oracle.graal.asm.AbstractAssembler; -import com.oracle.graal.asm.sparc.SPARCAssembler; -import com.oracle.graal.compiler.gen.LIRGenerator; -import com.oracle.graal.compiler.target.Backend; -import com.oracle.graal.lir.FrameMap; -import com.oracle.graal.lir.LIR; -import com.oracle.graal.lir.asm.FrameContext; -import com.oracle.graal.lir.asm.TargetMethodAssembler; -import com.oracle.graal.nodes.StructuredGraph; - -public class SPARCBackend extends Backend { - - public SPARCBackend(CodeCacheProvider runtime, TargetDescription target) { - super(runtime, target); - } - - @Override - public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) { - return new SPARCLIRGenerator(graph, runtime(), target, frameMap, cc, lir); - } - - @Override - protected AbstractAssembler createAssembler(FrameMap frameMap) { - return new SPARCAssembler(target, frameMap.registerConfig); - } - - class HotSpotFrameContext implements FrameContext { - - @Override - public void enter(TargetMethodAssembler tasm) { - } - - @Override - public void leave(TargetMethodAssembler tasm) { - } - } - @Override - public TargetMethodAssembler newAssembler(LIRGenerator lirGen, CompilationResult compilationResult) { - FrameMap frameMap = lirGen.frameMap; - AbstractAssembler masm = createAssembler(frameMap); - HotSpotFrameContext frameContext = new HotSpotFrameContext(); - TargetMethodAssembler tasm = new TargetMethodAssembler(target, runtime(), frameMap, masm, frameContext, compilationResult); - tasm.setFrameSize(frameMap.frameSize()); - return tasm; - } - - @Override - public void emitCode(TargetMethodAssembler tasm, LIRGenerator lirGen, ResolvedJavaMethod installedCodeOwner) { - - // Emit code for the LIR - lirGen.lir.emitCode(tasm); - - } - - -} diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java --- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Thu Jun 20 10:56:34 2013 -0700 +++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java Thu Jun 20 20:40:52 2013 -0700 @@ -38,8 +38,10 @@ import com.oracle.graal.api.code.TargetDescription; import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.NumUtil; +import com.oracle.graal.asm.sparc.*; import com.oracle.graal.compiler.gen.LIRGenerator; import com.oracle.graal.compiler.target.LIRGenLowerable; +import com.oracle.graal.debug.*; import com.oracle.graal.graph.GraalInternalError; import com.oracle.graal.lir.*; import com.oracle.graal.lir.StandardOp.*; @@ -151,26 +153,38 @@ @Override public void emitCompareBranch(Value left, Value right, Condition cond, boolean unorderedIsTrue, LabelRef label) { + Variable x; + Value y; + Condition condition; + if (LIRValueUtil.isVariable(right)) { + x = load(right); + y = loadNonConst(left); + condition = cond.mirror(); + } else { + x = load(left); + y = loadNonConst(right); + condition = cond; + } switch (left.getKind().getStackKind()) { case Int: - append(new CompareOp(ICMP, left, right)); - append(new BranchOp(cond, label)); + append(new CompareOp(ICMP, x, y)); + append(new BranchOp(condition, label)); break; case Long: - append(new CompareOp(LCMP, left, right)); - append(new BranchOp(cond, label)); + append(new CompareOp(LCMP, x, y)); + append(new BranchOp(condition, label)); break; case Float: - append(new CompareOp(FCMP, left, right)); - append(new BranchOp(cond, label)); + append(new CompareOp(FCMP, x, y)); + append(new BranchOp(condition, label)); break; case Double: - append(new CompareOp(DCMP, left, right)); - append(new BranchOp(cond, label)); + append(new CompareOp(DCMP, x, y)); + append(new BranchOp(condition, label)); break; case Object: - append(new CompareOp(ACMP, left, right)); - append(new BranchOp(cond, label)); + append(new CompareOp(ACMP, x, y)); + append(new BranchOp(condition, label)); break; default: throw GraalInternalError.shouldNotReachHere("" + left.getKind()); @@ -388,8 +402,11 @@ @Override public boolean canInlineConstant(Constant c) { switch (c.getKind()) { + case Int: + return SPARCAssembler.isSimm13(c.asInt()) && !runtime.needsDataPatch(c); case Long: - return NumUtil.isInt(c.asLong()) && !runtime.needsDataPatch(c); + // return NumUtil.isInt(c.asLong()) && !runtime.needsDataPatch(c); + throw new InternalError("NYI"); case Object: return c.isNull(); default: diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Thu Jun 20 10:56:34 2013 -0700 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Thu Jun 20 20:40:52 2013 -0700 @@ -22,37 +22,72 @@ */ package com.oracle.graal.hotspot.sparc; +import sun.misc.*; + import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.asm.AbstractAssembler; -import com.oracle.graal.asm.sparc.SPARCAssembler; +import com.oracle.graal.asm.*; +import com.oracle.graal.asm.sparc.*; +import com.oracle.graal.asm.sparc.SPARCAssembler.*; import com.oracle.graal.compiler.gen.LIRGenerator; -import com.oracle.graal.compiler.sparc.SPARCLIRGenerator; import com.oracle.graal.hotspot.*; +import com.oracle.graal.hotspot.sparc.SPARCHotSpotBackend.*; +import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.hotspot.stubs.Stub; import com.oracle.graal.lir.*; +import com.oracle.graal.lir.sparc.*; import com.oracle.graal.lir.asm.*; import com.oracle.graal.nodes.*; + +import static com.oracle.graal.sparc.SPARC.*; +import static com.oracle.graal.asm.sparc.SPARCAssembler.*; +import static com.oracle.graal.asm.sparc.SPARCMacroAssembler.*; +import static com.oracle.graal.api.code.CallingConvention.Type.*; +import static com.oracle.graal.api.code.ValueUtil.*; import static com.oracle.graal.phases.GraalOptions.*; +import static java.lang.reflect.Modifier.*; /** * HotSpot SPARC specific backend. */ public class SPARCHotSpotBackend extends HotSpotBackend { + private static final Unsafe unsafe = Unsafe.getUnsafe(); + public SPARCHotSpotBackend(HotSpotRuntime runtime, TargetDescription target) { super(runtime, target); } @Override public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) { - return new SPARCLIRGenerator(graph, this.runtime(), this.target, frameMap, cc, lir); + return new SPARCHotSpotLIRGenerator(graph, runtime(), target, frameMap, cc, lir); } - @Override - protected AbstractAssembler createAssembler(FrameMap frameMap) { - return new SPARCAssembler(target, frameMap.registerConfig); + /** + * Emits code to do stack overflow checking. + * + * @param afterFrameInit specifies if the stack pointer has already been adjusted to allocate + * the current frame + */ + protected static void emitStackOverflowCheck(TargetMethodAssembler tasm, boolean afterFrameInit) { + if (StackShadowPages.getValue() > 0) { + SPARCMacroAssembler masm = (SPARCMacroAssembler) tasm.asm; + final int frameSize = tasm.frameMap.frameSize(); + if (frameSize > 0) { + int lastFramePage = frameSize / unsafe.pageSize(); + // emit multiple stack bangs for methods with frames larger than a page + for (int i = 0; i <= lastFramePage; i++) { + int disp = (i + StackShadowPages.getValue()) * unsafe.pageSize(); + if (afterFrameInit) { + disp -= frameSize; + } + tasm.blockComment("[stack overflow check]"); + // FIXME currently doesn't work; maybe frame size is wrong + // new Ldx(new SPARCAddress(sp, -disp), g0).emit(masm); + } + } + } } class HotSpotFrameContext implements FrameContext { @@ -65,23 +100,44 @@ @Override public void enter(TargetMethodAssembler tasm) { + final int frameSize = tasm.frameMap.frameSize(); + + SPARCMacroAssembler masm = (SPARCMacroAssembler) tasm.asm; + if (!isStub) { + emitStackOverflowCheck(tasm, false); + } + new Save(sp, frameSize, sp).emit(masm); + + if (ZapStackOnMethodEntry.getValue()) { + final int slotSize = 8; + for (int i = 0; i < frameSize / slotSize; ++i) { + // 0xC1C1C1C1 + new Stx(g0, new SPARCAddress(sp, i * slotSize)).emit(masm); + } + } } @Override public void leave(TargetMethodAssembler tasm) { + SPARCMacroAssembler masm = (SPARCMacroAssembler) tasm.asm; + new RestoreWindow().emit(masm); } } @Override + protected AbstractAssembler createAssembler(FrameMap frameMap) { + return new SPARCMacroAssembler(target, frameMap.registerConfig); + } + + @Override public TargetMethodAssembler newAssembler(LIRGenerator lirGen, CompilationResult compilationResult) { SPARCHotSpotLIRGenerator gen = (SPARCHotSpotLIRGenerator) lirGen; FrameMap frameMap = gen.frameMap; - LIR lir = gen.lir; - boolean omitFrame = CanOmitFrame.getValue() && !frameMap.frameNeedsAllocating() && !lir.hasArgInCallerFrame(); Stub stub = gen.getStub(); AbstractAssembler masm = createAssembler(frameMap); - HotSpotFrameContext frameContext = omitFrame ? null : new HotSpotFrameContext(stub != null); + // On SPARC we always use stack frames. + HotSpotFrameContext frameContext = new HotSpotFrameContext(stub != null); TargetMethodAssembler tasm = new TargetMethodAssembler(target, runtime(), frameMap, masm, frameContext, compilationResult); tasm.setFrameSize(frameMap.frameSize()); StackSlot deoptimizationRescueSlot = gen.deoptimizationRescueSlot; @@ -93,7 +149,50 @@ } @Override - public void emitCode(TargetMethodAssembler tasm, LIRGenerator lirGen, ResolvedJavaMethod codeCacheOwner) { - // SPARC: Emit code + public void emitCode(TargetMethodAssembler tasm, LIRGenerator lirGen, ResolvedJavaMethod installedCodeOwner) { + SPARCMacroAssembler asm = (SPARCMacroAssembler) tasm.asm; + FrameMap frameMap = tasm.frameMap; + RegisterConfig regConfig = frameMap.registerConfig; + HotSpotVMConfig config = runtime().config; + Label unverifiedStub = installedCodeOwner == null || isStatic(installedCodeOwner.getModifiers()) ? null : new Label(); + + // Emit the prefix + + if (unverifiedStub != null) { + tasm.recordMark(Marks.MARK_UNVERIFIED_ENTRY); + CallingConvention cc = regConfig.getCallingConvention(JavaCallee, null, new JavaType[]{runtime().lookupJavaType(Object.class)}, target, false); + Register inlineCacheKlass = g5; // see MacroAssembler::ic_call + Register receiver = asRegister(cc.getArgument(0)); + SPARCAddress src = new SPARCAddress(receiver, config.hubOffset); + +// new Ldx(asm, src, dst); +// new Cmp(asm, inlineCacheKlass, dst); + new Bpne(CC.Xcc, unverifiedStub).emit(asm); + } + + asm.align(config.codeEntryAlignment); + tasm.recordMark(Marks.MARK_OSR_ENTRY); + tasm.recordMark(Marks.MARK_VERIFIED_ENTRY); + + // Emit code for the LIR + lirGen.lir.emitCode(tasm); + + HotSpotFrameContext frameContext = (HotSpotFrameContext) tasm.frameContext; + if (frameContext != null && !frameContext.isStub) { + tasm.recordMark(Marks.MARK_EXCEPTION_HANDLER_ENTRY); +// SPARCCall.directCall(tasm, asm, runtime().lookupForeignCall(EXCEPTION_HANDLER), null, false, +// null); + tasm.recordMark(Marks.MARK_DEOPT_HANDLER_ENTRY); +// SPARCCall.directCall(tasm, asm, runtime().lookupForeignCall(DEOPT_HANDLER), null, false, null); + } else { + // No need to emit the stubs for entries back into the method since + // it has no calls that can cause such "return" entries + assert !frameMap.accessesCallerFrame() : lirGen.getGraph(); + } + + if (unverifiedStub != null) { + asm.bind(unverifiedStub); +// SPARCCall.directJmp(tasm, asm, runtime().lookupForeignCall(IC_MISS_HANDLER)); + } } } diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRegisterConfig.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRegisterConfig.java Thu Jun 20 20:40:52 2013 -0700 @@ -0,0 +1,240 @@ +/* + * 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.hotspot.sparc; + +import static com.oracle.graal.sparc.SPARC.*; +import static com.oracle.graal.phases.GraalOptions.*; + +import java.util.*; + +import com.oracle.graal.sparc.*; +import com.oracle.graal.api.code.*; +import com.oracle.graal.api.code.CallingConvention.Type; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.graph.*; +import com.oracle.graal.hotspot.*; + +public class SPARCHotSpotRegisterConfig implements RegisterConfig { + + private final Architecture architecture; + + private final Register[] allocatable; + + private final HashMap categorized = new HashMap<>(); + + private final RegisterAttributes[] attributesMap; + + @Override + public Register[] getAllocatableRegisters() { + return allocatable.clone(); + } + + public Register[] getAllocatableRegisters(PlatformKind kind) { + if (categorized.containsKey(kind)) { + return categorized.get(kind); + } + + ArrayList list = new ArrayList<>(); + for (Register reg : getAllocatableRegisters()) { + if (architecture.canStoreValue(reg.getRegisterCategory(), kind)) { + list.add(reg); + } + } + + Register[] ret = list.toArray(new Register[0]); + categorized.put(kind, ret); + return ret; + } + + @Override + public RegisterAttributes[] getAttributesMap() { + return attributesMap.clone(); + } + + private final Register[] javaGeneralParameterRegisters; + private final Register[] nativeGeneralParameterRegisters; + private final Register[] fpuParameterRegisters = {f0, f1, f2, f3, f4, f5, f6, f7}; + + private final CalleeSaveLayout csl; + + private static Register findRegister(String name, Register[] all) { + for (Register reg : all) { + if (reg.name.equals(name)) { + return reg; + } + } + throw new IllegalArgumentException("register " + name + " is not allocatable"); + } + + private static Register[] initAllocatable(boolean reserveForHeapBase) { + Register[] registers = null; + // @formatter:off + if (reserveForHeapBase) { + registers = new Register[] { + // TODO this is not complete + l0, l1, l2, l3, l4, l5, l6, l7, + i0, i1, i2, i3, i4, i5, /*i6,*/ i7, + f0, f1, f2, f3, f4, f5, f6, f7 + }; + } else { + registers = new Register[] { + // TODO this is not complete + l0, l1, l2, l3, l4, l5, l6, l7, + i0, i1, i2, i3, i4, i5, /*i6,*/ i7, + f0, f1, f2, f3, f4, f5, f6, f7 + }; + } + // @formatter:on + + if (RegisterPressure.getValue() != null) { + String[] names = RegisterPressure.getValue().split(","); + Register[] regs = new Register[names.length]; + for (int i = 0; i < names.length; i++) { + regs[i] = findRegister(names[i], registers); + } + return regs; + } + + return registers; + } + + public SPARCHotSpotRegisterConfig(Architecture architecture, HotSpotVMConfig config) { + this.architecture = architecture; + + javaGeneralParameterRegisters = new Register[]{i0, i1, i2, i3, i4, i5}; + nativeGeneralParameterRegisters = new Register[]{i0, i1, i2, i3, i4, i5}; + + csl = null; + allocatable = initAllocatable(config.useCompressedOops); + attributesMap = RegisterAttributes.createMap(this, SPARC.allRegisters); + } + + @Override + public Register[] getCallerSaveRegisters() { + return getAllocatableRegisters(); + } + + @Override + public Register getRegisterForRole(int index) { + throw new UnsupportedOperationException(); + } + + @Override + public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription target, boolean stackOnly) { + if (type == Type.NativeCall) { + return callingConvention(nativeGeneralParameterRegisters, returnType, parameterTypes, type, target, stackOnly); + } + // On x64, parameter locations are the same whether viewed + // from the caller or callee perspective + return callingConvention(javaGeneralParameterRegisters, returnType, parameterTypes, type, target, stackOnly); + } + + public Register[] getCallingConventionRegisters(Type type, Kind kind) { + if (architecture.canStoreValue(FPU, kind)) { + return fpuParameterRegisters; + } + assert architecture.canStoreValue(CPU, kind); + return type == Type.NativeCall ? nativeGeneralParameterRegisters : javaGeneralParameterRegisters; + } + + private CallingConvention callingConvention(Register[] generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, Type type, TargetDescription target, boolean stackOnly) { + AllocatableValue[] locations = new AllocatableValue[parameterTypes.length]; + + int currentGeneral = 0; + int currentFloating = 0; + int currentStackOffset = 0; + + for (int i = 0; i < parameterTypes.length; i++) { + final Kind kind = parameterTypes[i].getKind(); + + switch (kind) { + case Byte: + case Boolean: + case Short: + case Char: + case Int: + case Long: + case Object: + if (!stackOnly && currentGeneral < generalParameterRegisters.length) { + Register register = generalParameterRegisters[currentGeneral++]; + locations[i] = register.asValue(kind); + } + break; + case Float: + case Double: + if (!stackOnly && currentFloating < fpuParameterRegisters.length) { + Register register = fpuParameterRegisters[currentFloating++]; + locations[i] = register.asValue(kind); + } + break; + default: + throw GraalInternalError.shouldNotReachHere(); + } + + if (locations[i] == null) { + locations[i] = StackSlot.get(kind.getStackKind(), currentStackOffset, !type.out); + currentStackOffset += Math.max(target.arch.getSizeInBytes(kind), target.wordSize); + } + } + + Kind returnKind = returnType == null ? Kind.Void : returnType.getKind(); + AllocatableValue returnLocation = returnKind == Kind.Void ? Value.ILLEGAL : getReturnRegister(returnKind).asValue(returnKind); + return new CallingConvention(currentStackOffset, returnLocation, locations); + } + + @Override + public Register getReturnRegister(Kind kind) { + switch (kind) { + case Boolean: + case Byte: + case Char: + case Short: + case Int: + case Long: + case Object: + return i0; + case Float: + case Double: + return f0; + case Void: + case Illegal: + return null; + default: + throw new UnsupportedOperationException("no return register for type " + kind); + } + } + + @Override + public Register getFrameRegister() { + return sp; + } + + public CalleeSaveLayout getCalleeSaveLayout() { + return csl; + } + + @Override + public String toString() { + return String.format("Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" + "CallerSave: " + Arrays.toString(getCallerSaveRegisters()) + "%n"); + } +} diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRuntime.java Thu Jun 20 10:56:34 2013 -0700 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRuntime.java Thu Jun 20 20:40:52 2013 -0700 @@ -22,32 +22,74 @@ */ package com.oracle.graal.hotspot.sparc; +import static com.oracle.graal.sparc.SPARC.*; +import static com.oracle.graal.api.code.CallingConvention.Type.*; +import static com.oracle.graal.api.meta.LocationIdentity.*; +import static com.oracle.graal.api.meta.Value.*; +import static com.oracle.graal.hotspot.HotSpotBackend.*; +import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.*; +import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.*; +import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.Transition.*; +import static com.oracle.graal.hotspot.replacements.AESCryptSubstitutions.*; +import static com.oracle.graal.hotspot.replacements.CipherBlockChainingSubstitutions.*; + import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.meta.*; +import com.oracle.graal.nodes.calc.*; +import com.oracle.graal.nodes.spi.*; + +//import com.oracle.graal.replacements.sparc.*; public class SPARCHotSpotRuntime extends HotSpotRuntime { public SPARCHotSpotRuntime(HotSpotVMConfig config, HotSpotGraalRuntime graalRuntime) { super(config, graalRuntime); - // SPARC: Register stubs. + } + +// private AMD64ConvertSnippets.Templates convertSnippets; + + @Override + public void registerReplacements(Replacements replacements) { + Kind word = graalRuntime.getTarget().wordKind; + + // The calling convention for the exception handler stub is (only?) defined in + // TemplateInterpreterGenerator::generate_throw_exception() + // in templateInterpreter_sparc.cpp around line 1925 + RegisterValue exception = o0.asValue(Kind.Object); // XXX should this be i0? + RegisterValue exceptionPc = o1.asValue(word); // XXX should this be i1? + CallingConvention exceptionCc = new CallingConvention(0, ILLEGAL, exception, exceptionPc); + register(new HotSpotForeignCallLinkage(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF, exceptionCc, NOT_REEXECUTABLE, ANY_LOCATION)); + register(new HotSpotForeignCallLinkage(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF, exceptionCc, NOT_REEXECUTABLE, ANY_LOCATION)); + +// convertSnippets = new AMD64ConvertSnippets.Templates(this, replacements, +// graalRuntime.getTarget()); + super.registerReplacements(replacements); + } + + @Override + public void lower(Node n, LoweringTool tool) { +// if (n instanceof ConvertNode) { +// convertSnippets.lower((ConvertNode) n, tool); +// } else { + super.lower(n, tool); +// } } @Override public Register threadRegister() { - // SPARC: Define thread register. - return null; + throw new InternalError("NYI: SPARC: Define thread register."); } @Override public Register stackPointerRegister() { - // SPARC: Define stack pointer register. - return null; + throw new InternalError("NYI: SPARC: Define stack pointer register."); } @Override protected RegisterConfig createRegisterConfig() { - // SPARC: Create register configuration. - return null; + return new SPARCHotSpotRegisterConfig(graalRuntime.getTarget().arch, config); } } diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java Thu Jun 20 10:56:34 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java Thu Jun 20 20:40:52 2013 -0700 @@ -218,8 +218,18 @@ */ private void compileMethod(HotSpotResolvedJavaMethod method) { try { + System.gc(); long start = System.currentTimeMillis(); + long before = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); vmToCompiler.compileMethod(method, StructuredGraph.INVOCATION_ENTRY_BCI, true, 10); + long after = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); + System.gc(); + long afterGC = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); + +// TTY.println(String.format("used: %6dK (before: %6dK, after: %6dK, after GC: %6dK)", (after - before) / 1024, before / 1024, after / 1024, afterGC / 1024) + +// " " + String.format("%s (%d bytes)", MetaUtil.format("%H::%n(%p)", method), method.getCodeSize())); + TTY.println("| %d | %d |", method.getCodeSize(), (after - before) / 1024); + compileTime += (System.currentTimeMillis() - start); compiledMethodsCounter++; method.reprofile(); // makes the method also not-entrant diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArithmetic.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArithmetic.java Thu Jun 20 10:56:34 2013 -0700 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArithmetic.java Thu Jun 20 20:40:52 2013 -0700 @@ -23,35 +23,8 @@ package com.oracle.graal.lir.sparc; import static com.oracle.graal.api.code.ValueUtil.*; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Add; -import static com.oracle.graal.asm.sparc.SPARCAssembler.And; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Fadds; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Faddd; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Fdivs; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Fdivd; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Fdtoi; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Fmuls; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Fmuld; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Fnegs; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Fnegd; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Fstoi; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Fsubs; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Fsubd; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Mulx; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Or; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Sdivx; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Sll; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Sllx; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Srl; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Srlx; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Sra; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Sub; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Xor; -import static com.oracle.graal.asm.sparc.SPARCAssembler.isSimm13; -import static com.oracle.graal.lir.LIRInstruction.OperandFlag.CONST; -import static com.oracle.graal.lir.LIRInstruction.OperandFlag.HINT; -import static com.oracle.graal.lir.LIRInstruction.OperandFlag.REG; -import static com.oracle.graal.lir.LIRInstruction.OperandFlag.STACK; +import static com.oracle.graal.asm.sparc.SPARCAssembler.*; +import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.sparc.SPARCAssembler; @@ -59,7 +32,6 @@ import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.TargetMethodAssembler; -//@formatter:off public enum SPARCArithmetic { // @formatter:off IADD, ISUB, IMUL, IDIV, IDIVREM, IREM, IUDIV, IUREM, IAND, IOR, IXOR, ISHL, ISHR, IUSHR, @@ -72,11 +44,13 @@ I2F, I2D, F2I, D2I, L2F, L2D, F2L, D2L, MOV_I2F, MOV_L2D, MOV_F2I, MOV_D2L; + // @formatter:on /** * Binary operation with single source/destination operand and one constant. */ public static class BinaryRegConst extends SPARCLIRInstruction { + @Opcode private final SPARCArithmetic opcode; @Def({REG, HINT}) protected AllocatableValue result; @Use({REG, STACK}) protected AllocatableValue x; @@ -107,12 +81,9 @@ */ public static class Unary2Op extends SPARCLIRInstruction { - @Opcode - private final SPARCArithmetic opcode; - @Def({ REG }) - protected AllocatableValue result; - @Use({ REG, STACK }) - protected AllocatableValue x; + @Opcode private final SPARCArithmetic opcode; + @Def({REG}) protected AllocatableValue result; + @Use({REG, STACK}) protected AllocatableValue x; public Unary2Op(SPARCArithmetic opcode, AllocatableValue result, AllocatableValue x) { this.opcode = opcode; @@ -132,12 +103,9 @@ */ public static class Unary1Op extends SPARCLIRInstruction { - @Opcode - private final SPARCArithmetic opcode; - @Def({ REG, HINT }) - protected AllocatableValue result; - @Use({ REG, STACK }) - protected AllocatableValue x; + @Opcode private final SPARCArithmetic opcode; + @Def({REG, HINT}) protected AllocatableValue result; + @Use({REG, STACK}) protected AllocatableValue x; public Unary1Op(SPARCArithmetic opcode, AllocatableValue result, AllocatableValue x) { this.opcode = opcode; @@ -153,12 +121,9 @@ public static class Op1Stack extends SPARCLIRInstruction { - @Opcode - private final SPARCArithmetic opcode; - @Def({ REG, HINT }) - protected Value result; - @Use({ REG, STACK, CONST }) - protected Value x; + @Opcode private final SPARCArithmetic opcode; + @Def({REG, HINT}) protected Value result; + @Use({REG, STACK, CONST}) protected Value x; public Op1Stack(SPARCArithmetic opcode, Value result, Value x) { this.opcode = opcode; @@ -174,14 +139,10 @@ public static class Op2Stack extends SPARCLIRInstruction { - @Opcode - private final SPARCArithmetic opcode; - @Def({ REG, HINT }) - protected Value result; - @Use({ REG, STACK, CONST }) - protected Value x; - @Alive({ REG, STACK, CONST }) - protected Value y; + @Opcode private final SPARCArithmetic opcode; + @Def({REG, HINT}) protected Value result; + @Use({REG, STACK, CONST}) protected Value x; + @Alive({REG, STACK, CONST}) protected Value y; public Op2Stack(SPARCArithmetic opcode, Value result, Value x, Value y) { this.opcode = opcode; @@ -204,14 +165,10 @@ public static class Op2Reg extends SPARCLIRInstruction { - @Opcode - private final SPARCArithmetic opcode; - @Def({ REG, HINT }) - protected Value result; - @Use({ REG, STACK, CONST }) - protected Value x; - @Alive({ REG, CONST }) - protected Value y; + @Opcode private final SPARCArithmetic opcode; + @Def({REG, HINT}) protected Value result; + @Use({REG, STACK, CONST}) protected Value x; + @Alive({REG, CONST}) protected Value y; public Op2Reg(SPARCArithmetic opcode, Value result, Value x, Value y) { this.opcode = opcode; @@ -234,14 +191,10 @@ public static class ShiftOp extends SPARCLIRInstruction { - @Opcode - private final SPARCArithmetic opcode; - @Def({ REG, HINT }) - protected Value result; - @Use({ REG, STACK, CONST }) - protected Value x; - @Alive({ REG, CONST }) - protected Value y; + @Opcode private final SPARCArithmetic opcode; + @Def({REG, HINT}) protected Value result; + @Use({REG, STACK, CONST}) protected Value x; + @Alive({REG, CONST}) protected Value y; public ShiftOp(SPARCArithmetic opcode, Value result, Value x, Value y) { this.opcode = opcode; @@ -266,210 +219,199 @@ @SuppressWarnings("unused") protected static void emit(SPARCAssembler masm, SPARCArithmetic opcode, Value result) { switch (opcode) { - case L2I: - new And(masm, asIntReg(result), -1, asIntReg(result)); - break; - case I2C: - new Sll(masm, asIntReg(result), 16, asIntReg(result)); - new Srl(masm, asIntReg(result), 16, asIntReg(result)); - break; - default: - throw GraalInternalError.shouldNotReachHere("missing: " + opcode); + case L2I: + new And(asIntReg(result), -1, asIntReg(result)).emit(masm); + break; + case I2C: + new Sll(asIntReg(result), 16, asIntReg(result)).emit(masm); + new Srl(asIntReg(result), 16, asIntReg(result)).emit(masm); + break; + default: + throw GraalInternalError.shouldNotReachHere("missing: " + opcode); } } @SuppressWarnings("unused") - public static void emit(TargetMethodAssembler tasm, SPARCAssembler masm, - SPARCArithmetic opcode, Value dst, Value src1, Value src2, LIRFrameState info) { + public static void emit(TargetMethodAssembler tasm, SPARCAssembler masm, SPARCArithmetic opcode, Value dst, Value src1, Value src2, LIRFrameState info) { int exceptionOffset = -1; if (isConstant(src1)) { switch (opcode) { - case ISUB: - assert isSimm13(tasm.asIntConst(src1)); - new Add(masm, asIntReg(src2), -(tasm.asIntConst(src1)), asIntReg(dst)); - break; - case IAND: - throw new InternalError("NYI"); - case IDIV: - assert isSimm13(tasm.asIntConst(src1)); - throw new InternalError("NYI"); - // new Sdivx(masm, asIntReg(src1), asIntReg(src2), - // asIntReg(dst)); - case FSUB: - throw new InternalError("NYI"); - case FDIV: - throw new InternalError("NYI"); - case DSUB: - throw new InternalError("NYI"); - case DDIV: - throw new InternalError("NYI"); - default: - throw GraalInternalError.shouldNotReachHere(); + case ISUB: + assert isSimm13(tasm.asIntConst(src1)); + new Add(asIntReg(src2), -(tasm.asIntConst(src1)), asIntReg(dst)).emit(masm); + break; + case IAND: + throw new InternalError("NYI"); + case IDIV: + assert isSimm13(tasm.asIntConst(src1)); + throw new InternalError("NYI"); + // new Sdivx(masm, asIntReg(src1), asIntReg(src2), + // asIntReg(dst)); + case FSUB: + throw new InternalError("NYI"); + case FDIV: + throw new InternalError("NYI"); + case DSUB: + throw new InternalError("NYI"); + case DDIV: + throw new InternalError("NYI"); + default: + throw GraalInternalError.shouldNotReachHere(); } } else if (isConstant(src2)) { switch (opcode) { - case IADD: - assert isSimm13(tasm.asIntConst(src2)); - new Add(masm, asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)); - break; - case ISUB: - assert isSimm13(tasm.asIntConst(src2)); - new Sub(masm, asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)); - break; - case IMUL: - assert isSimm13(tasm.asIntConst(src2)); - new Mulx(masm, asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)); - break; - case IAND: - assert isSimm13(tasm.asIntConst(src2)); - new And(masm, asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)); - break; - case ISHL: - assert isSimm13(tasm.asIntConst(src2)); - new Sll(masm, asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)); - break; - case ISHR: - assert isSimm13(tasm.asIntConst(src2)); - new Srl(masm, asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)); - break; - case IUSHR: - assert isSimm13(tasm.asIntConst(src2)); - new Sra(masm, asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)); - break; - case IXOR: - assert isSimm13(tasm.asIntConst(src2)); - new Xor(masm, asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)); - break; - case LXOR: - assert isSimm13(tasm.asIntConst(src2)); - new Add(masm, asLongReg(src1), tasm.asIntConst(src2), asLongReg(dst)); - break; - case LUSHR: - throw new InternalError("NYI"); - case FADD: - throw new InternalError("NYI"); - case FMUL: - throw new InternalError("NYI"); - case FDIV: - throw new InternalError("NYI"); - case DADD: - throw new InternalError("NYI"); - case DMUL: - throw new InternalError("NYI"); - case DDIV: - throw new InternalError("NYI"); - default: - throw GraalInternalError.shouldNotReachHere(); + case IADD: + assert isSimm13(tasm.asIntConst(src2)); + new Add(asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)).emit(masm); + break; + case ISUB: + assert isSimm13(tasm.asIntConst(src2)); + new Sub(asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)).emit(masm); + break; + case IMUL: + assert isSimm13(tasm.asIntConst(src2)); + new Mulx(asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)).emit(masm); + break; + case IAND: + assert isSimm13(tasm.asIntConst(src2)); + new And(asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)).emit(masm); + break; + case ISHL: + assert isSimm13(tasm.asIntConst(src2)); + new Sll(asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)).emit(masm); + break; + case ISHR: + assert isSimm13(tasm.asIntConst(src2)); + new Srl(asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)).emit(masm); + break; + case IUSHR: + assert isSimm13(tasm.asIntConst(src2)); + new Sra(asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)).emit(masm); + break; + case IXOR: + assert isSimm13(tasm.asIntConst(src2)); + new Xor(asIntReg(src1), tasm.asIntConst(src2), asIntReg(dst)).emit(masm); + break; + case LXOR: + assert isSimm13(tasm.asIntConst(src2)); + new Add(asLongReg(src1), tasm.asIntConst(src2), asLongReg(dst)).emit(masm); + break; + case LUSHR: + throw new InternalError("NYI"); + case FADD: + throw new InternalError("NYI"); + case FMUL: + throw new InternalError("NYI"); + case FDIV: + throw new InternalError("NYI"); + case DADD: + throw new InternalError("NYI"); + case DMUL: + throw new InternalError("NYI"); + case DDIV: + throw new InternalError("NYI"); + default: + throw GraalInternalError.shouldNotReachHere(); } } else { switch (opcode) { - case IADD: - new Add(masm, asIntReg(src1), asIntReg(src2), asIntReg(dst)); - break; - case ISUB: - new Sub(masm, asIntReg(src1), asIntReg(src2), asIntReg(dst)); - break; - case IMUL: - new Mulx(masm, asIntReg(src1), asIntReg(src2), asIntReg(dst)); - break; - case IDIV: - new Sdivx(masm, asIntReg(src1), asIntReg(src2), asIntReg(dst)); - break; - case IAND: - new And(masm, asIntReg(src1), asIntReg(src2), asIntReg(dst)); - break; - case IOR: - new Or(masm, asIntReg(src1), asIntReg(src2), asIntReg(dst)); - break; - case IXOR: - new Xor(masm, asIntReg(src1), asIntReg(src2), asIntReg(dst)); - break; - case ISHL: - new Sll(masm, asIntReg(src1), asIntReg(src2), asIntReg(dst)); - break; - case ISHR: - new Srl(masm, asIntReg(src1), asIntReg(src2), asIntReg(dst)); - break; - case IUSHR: - new Sra(masm, asIntReg(src1), asIntReg(src2), asIntReg(dst)); - break; - case IREM: - throw new InternalError("NYI"); - case LADD: - new Add(masm, asLongReg(src1), asLongReg(src2), asLongReg(dst)); - break; - case LSUB: - new Sub(masm, asLongReg(src1), asLongReg(src2), asLongReg(dst)); - break; - case LMUL: - new Mulx(masm, asLongReg(src1), asLongReg(src2), asLongReg(dst)); - break; - case LDIV: - new Sdivx(masm, asLongReg(src1), asLongReg(src2), - asLongReg(dst)); - break; - case LAND: - new And(masm, asLongReg(src1), asLongReg(src2), asLongReg(dst)); - break; - case LOR: - new Or(masm, asLongReg(src1), asLongReg(src2), asLongReg(dst)); - break; - case LXOR: - new Xor(masm, asLongReg(src1), asLongReg(src2), asLongReg(dst)); - break; - case LSHL: - new Sll(masm, asLongReg(src1), asLongReg(src2), asLongReg(dst)); - break; - case LSHR: - new Srl(masm, asLongReg(src1), asLongReg(src2), asLongReg(dst)); - break; - case LUSHR: - new Sra(masm, asLongReg(src1), asIntReg(src2), asLongReg(dst)); - break; - case LDIVREM: - case LUDIV: - case LUREM: - case LREM: - throw new InternalError("NYI"); - case FADD: - new Fadds(masm, asFloatReg(src1), asFloatReg(src2), - asFloatReg(dst)); - break; - case FSUB: - new Fsubs(masm, asFloatReg(src1), asFloatReg(src2), - asFloatReg(dst)); - break; - case FMUL: - new Fmuls(masm, asFloatReg(src1), asFloatReg(src2), - asFloatReg(dst)); - break; - case FDIV: - new Fdivs(masm, asFloatReg(src1), asFloatReg(src2), - asFloatReg(dst)); - break; - case FREM: - throw new InternalError("NYI"); - case DADD: - new Faddd(masm, asDoubleReg(src1), asDoubleReg(src2), - asDoubleReg(dst)); - break; - case DSUB: - new Fsubd(masm, asDoubleReg(src1), asDoubleReg(src2), - asDoubleReg(dst)); - break; - case DMUL: - new Fmuld(masm, asDoubleReg(src1), asDoubleReg(src2), - asDoubleReg(dst)); - break; - case DDIV: - new Fdivd(masm, asDoubleReg(src1), asDoubleReg(src2), - asDoubleReg(dst)); - break; - case DREM: - throw new InternalError("NYI"); - default: - throw GraalInternalError.shouldNotReachHere("missing: " - + opcode); + case IADD: + new Add(asIntReg(src1), asIntReg(src2), asIntReg(dst)).emit(masm); + break; + case ISUB: + new Sub(asIntReg(src1), asIntReg(src2), asIntReg(dst)).emit(masm); + break; + case IMUL: + new Mulx(asIntReg(src1), asIntReg(src2), asIntReg(dst)).emit(masm); + break; + case IDIV: + new Sdivx(asIntReg(src1), asIntReg(src2), asIntReg(dst)).emit(masm); + break; + case IAND: + new And(asIntReg(src1), asIntReg(src2), asIntReg(dst)).emit(masm); + break; + case IOR: + new Or(asIntReg(src1), asIntReg(src2), asIntReg(dst)).emit(masm); + break; + case IXOR: + new Xor(asIntReg(src1), asIntReg(src2), asIntReg(dst)).emit(masm); + break; + case ISHL: + new Sll(asIntReg(src1), asIntReg(src2), asIntReg(dst)).emit(masm); + break; + case ISHR: + new Srl(asIntReg(src1), asIntReg(src2), asIntReg(dst)).emit(masm); + break; + case IUSHR: + new Sra(asIntReg(src1), asIntReg(src2), asIntReg(dst)).emit(masm); + break; + case IREM: + throw new InternalError("NYI"); + case LADD: + new Add(asLongReg(src1), asLongReg(src2), asLongReg(dst)).emit(masm); + break; + case LSUB: + new Sub(asLongReg(src1), asLongReg(src2), asLongReg(dst)).emit(masm); + break; + case LMUL: + new Mulx(asLongReg(src1), asLongReg(src2), asLongReg(dst)).emit(masm); + break; + case LDIV: + new Sdivx(asLongReg(src1), asLongReg(src2), asLongReg(dst)).emit(masm); + break; + case LAND: + new And(asLongReg(src1), asLongReg(src2), asLongReg(dst)).emit(masm); + break; + case LOR: + new Or(asLongReg(src1), asLongReg(src2), asLongReg(dst)).emit(masm); + break; + case LXOR: + new Xor(asLongReg(src1), asLongReg(src2), asLongReg(dst)).emit(masm); + break; + case LSHL: + new Sllx(asLongReg(src1), asLongReg(src2), asLongReg(dst)).emit(masm); + break; + case LSHR: + new Srlx(asLongReg(src1), asLongReg(src2), asLongReg(dst)).emit(masm); + break; + case LUSHR: + new Srax(asLongReg(src1), asIntReg(src2), asLongReg(dst)).emit(masm); + break; + case LDIVREM: + case LUDIV: + case LUREM: + case LREM: + throw new InternalError("NYI"); + case FADD: + new Fadds(masm, asFloatReg(src1), asFloatReg(src2), asFloatReg(dst)); + break; + case FSUB: + new Fsubs(masm, asFloatReg(src1), asFloatReg(src2), asFloatReg(dst)); + break; + case FMUL: + new Fmuls(masm, asFloatReg(src1), asFloatReg(src2), asFloatReg(dst)); + break; + case FDIV: + new Fdivs(masm, asFloatReg(src1), asFloatReg(src2), asFloatReg(dst)); + break; + case FREM: + throw new InternalError("NYI"); + case DADD: + new Faddd(masm, asDoubleReg(src1), asDoubleReg(src2), asDoubleReg(dst)); + break; + case DSUB: + new Fsubd(masm, asDoubleReg(src1), asDoubleReg(src2), asDoubleReg(dst)); + break; + case DMUL: + new Fmuld(masm, asDoubleReg(src1), asDoubleReg(src2), asDoubleReg(dst)); + break; + case DDIV: + new Fdivd(masm, asDoubleReg(src1), asDoubleReg(src2), asDoubleReg(dst)); + break; + case DREM: + throw new InternalError("NYI"); + default: + throw GraalInternalError.shouldNotReachHere("missing: " + opcode); } } @@ -480,51 +422,47 @@ } @SuppressWarnings("unused") - public static void emit(TargetMethodAssembler tasm, SPARCAssembler masm, - SPARCArithmetic opcode, Value dst, Value src, LIRFrameState info) { + public static void emit(TargetMethodAssembler tasm, SPARCAssembler masm, SPARCArithmetic opcode, Value dst, Value src, LIRFrameState info) { int exceptionOffset = -1; if (isRegister(src)) { switch (opcode) { - case I2L: - new Sra(masm, asIntReg(src), 0, asLongReg(dst)); - break; - case I2B: - new Sll(masm, asIntReg(src), 24, asIntReg(src)); - new Srl(masm, asIntReg(dst), 24, asIntReg(src)); - break; - case I2F: - new Fstoi(masm, asIntReg(src), asFloatReg(dst)); - break; - case I2D: - new Fdtoi(masm, asIntReg(src), asDoubleReg(dst)); - break; - case FNEG: - new Fnegs(masm, asFloatReg(src), asFloatReg(dst)); - break; - case DNEG: - new Fnegd(masm, asDoubleReg(src), asDoubleReg(dst)); - break; - case LSHL: - new Sllx(masm, asLongReg(dst), asIntReg(src), asLongReg(dst)); - break; - case LSHR: - new Srlx(masm, asLongReg(dst), asIntReg(src), asLongReg(dst)); - break; - default: - throw GraalInternalError.shouldNotReachHere("missing: " - + opcode); + case I2L: + new Sra(asIntReg(src), 0, asLongReg(dst)).emit(masm); + break; + case I2B: + new Sll(asIntReg(src), 24, asIntReg(src)).emit(masm); + new Srl(asIntReg(dst), 24, asIntReg(src)).emit(masm); + break; + case I2F: + new Fstoi(masm, asIntReg(src), asFloatReg(dst)); + break; + case I2D: + new Fdtoi(masm, asIntReg(src), asDoubleReg(dst)); + break; + case FNEG: + new Fnegs(masm, asFloatReg(src), asFloatReg(dst)); + break; + case DNEG: + new Fnegd(masm, asDoubleReg(src), asDoubleReg(dst)); + break; + case LSHL: + new Sllx(asLongReg(dst), asIntReg(src), asLongReg(dst)).emit(masm); + break; + case LSHR: + new Srlx(asLongReg(dst), asIntReg(src), asLongReg(dst)).emit(masm); + break; + default: + throw GraalInternalError.shouldNotReachHere("missing: " + opcode); } } else if (isConstant(src)) { switch (opcode) { - default: - throw GraalInternalError.shouldNotReachHere("missing: " - + opcode); + default: + throw GraalInternalError.shouldNotReachHere("missing: " + opcode); } } else { switch (opcode) { - default: - throw GraalInternalError.shouldNotReachHere("missing: " - + opcode); + default: + throw GraalInternalError.shouldNotReachHere("missing: " + opcode); } } @@ -542,64 +480,60 @@ Kind ysk; switch (opcode) { - case IADD: - case ISUB: - case IMUL: - case IDIV: - case IREM: - case IAND: - case IOR: - case IXOR: - case ISHL: - case ISHR: - case IUSHR: - rk = result.getKind(); - xsk = x.getKind().getStackKind(); - ysk = y.getKind().getStackKind(); - - assert rk == Kind.Int && xsk == Kind.Int && ysk == Kind.Int; - break; - case LADD: - case LSUB: - case LMUL: - case LDIV: - case LREM: - case LAND: - case LOR: - case LXOR: - case LSHL: - case LSHR: - case LUSHR: - rk = result.getKind(); - xk = x.getKind(); - yk = y.getKind(); - - assert rk == Kind.Long && xk == Kind.Long && yk == Kind.Long; - break; - case FADD: - case FSUB: - case FMUL: - case FDIV: - case FREM: - rk = result.getKind(); - xk = x.getKind(); - yk = y.getKind(); - - assert rk == Kind.Float && xk == Kind.Float && yk == Kind.Float; - break; - case DADD: - case DSUB: - case DMUL: - case DDIV: - case DREM: - rk = result.getKind(); - xk = x.getKind(); - yk = y.getKind(); - - assert rk == Kind.Double && xk == Kind.Double && yk == Kind.Double; - break; - default: - throw new InternalError("NYI: " + opcode); + case IADD: + case ISUB: + case IMUL: + case IDIV: + case IREM: + case IAND: + case IOR: + case IXOR: + case ISHL: + case ISHR: + case IUSHR: + rk = result.getKind(); + xsk = x.getKind().getStackKind(); + ysk = y.getKind().getStackKind(); + assert rk == Kind.Int && xsk == Kind.Int && ysk == Kind.Int; + break; + case LADD: + case LSUB: + case LMUL: + case LDIV: + case LREM: + case LAND: + case LOR: + case LXOR: + case LSHL: + case LSHR: + case LUSHR: + rk = result.getKind(); + xk = x.getKind(); + yk = y.getKind(); + assert rk == Kind.Long && xk == Kind.Long && yk == Kind.Long; + break; + case FADD: + case FSUB: + case FMUL: + case FDIV: + case FREM: + rk = result.getKind(); + xk = x.getKind(); + yk = y.getKind(); + assert rk == Kind.Float && xk == Kind.Float && yk == Kind.Float; + break; + case DADD: + case DSUB: + case DMUL: + case DDIV: + case DREM: + rk = result.getKind(); + xk = x.getKind(); + yk = y.getKind(); + assert rk == Kind.Double && xk == Kind.Double && yk == Kind.Double; + break; + default: + throw new InternalError("NYI: " + opcode); } } } diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java Thu Jun 20 10:56:34 2013 -0700 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java Thu Jun 20 20:40:52 2013 -0700 @@ -22,16 +22,9 @@ */ package com.oracle.graal.lir.sparc; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Andn; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Ldsw; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Ldx; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Or; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Popc; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Srl; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Srlx; -import static com.oracle.graal.asm.sparc.SPARCAssembler.Sub; -import static com.oracle.graal.asm.sparc.SPARCAssembler.isSimm13; -import static com.oracle.graal.asm.sparc.SPARCMacroAssembler.Mov; +import static com.oracle.graal.asm.sparc.SPARCAssembler.*; +import static com.oracle.graal.asm.sparc.SPARCMacroAssembler.*; +import static com.oracle.graal.sparc.SPARC.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; @@ -67,25 +60,25 @@ switch (opcode) { case IPOPCNT: // clear upper word for 64 bit POPC - new Srl(masm, src, SPARC.g0, dst); - new Popc(masm, src, dst); + new Srl(src, SPARC.g0, dst).emit(masm); + new Popc(src, dst).emit(masm); break; case LPOPCNT: - new Popc(masm, src, dst); + new Popc(src, dst).emit(masm); break; case BSF: // countTrailingZerosI - bsfl // countTrailingZerosL - masm.bsfq(dst, src); Kind tkind = input.getKind(); if (tkind == Kind.Int) { - new Sub(masm, src, 1, dst); - new Andn(masm, dst, src, dst); - new Srl(masm, dst, SPARC.g0, dst); - new Popc(masm, dst, dst); + new Sub(src, 1, dst).emit(masm); + new Andn(dst, src, dst).emit(masm); + new Srl(dst, SPARC.g0, dst).emit(masm); + new Popc(dst, dst).emit(masm); } else if (tkind == Kind.Long) { - new Sub(masm, src, 1, dst); - new Andn(masm, dst, src, dst); - new Popc(masm, dst, dst); + new Sub(src, 1, dst).emit(masm); + new Andn(dst, src, dst).emit(masm); + new Popc(dst, dst).emit(masm); } else { throw GraalInternalError.shouldNotReachHere("missing: " + tkind); } @@ -95,41 +88,41 @@ // masm.bsrl(dst, src); Kind ikind = input.getKind(); assert ikind == Kind.Int; - new Srl(masm, src, 1, tmp); - new Srl(masm, src, 0, dst); - new Or(masm, src, tmp, dst); - new Srl(masm, dst, 2, tmp); - new Or(masm, dst, tmp, dst); - new Srl(masm, dst, 4, tmp); - new Or(masm, dst, tmp, dst); - new Srl(masm, dst, 8, tmp); - new Or(masm, dst, tmp, dst); - new Srl(masm, dst, 16, tmp); - new Or(masm, dst, tmp, dst); - new Popc(masm, dst, dst); - new Mov(masm, ikind.getBitCount(), tmp); - new Sub(masm, tmp, dst, dst); + new Srl(src, 1, tmp).emit(masm); + new Srl(src, 0, dst).emit(masm); + new Or(src, tmp, dst).emit(masm); + new Srl(dst, 2, tmp).emit(masm); + new Or(dst, tmp, dst).emit(masm); + new Srl(dst, 4, tmp).emit(masm); + new Or(dst, tmp, dst).emit(masm); + new Srl(dst, 8, tmp).emit(masm); + new Or(dst, tmp, dst).emit(masm); + new Srl(dst, 16, tmp).emit(masm); + new Or(dst, tmp, dst).emit(masm); + new Popc(dst, dst).emit(masm); + new Mov(ikind.getBitCount(), tmp).emit(masm); + new Sub(tmp, dst, dst).emit(masm); break; case LBSR: // countLeadingZerosL_bsr masm.bsrq(dst, src); // masm.bsrq(dst, src); Kind lkind = input.getKind(); assert lkind == Kind.Int; - new Srlx(masm, src, 1, tmp); - new Or(masm, src, tmp, dst); - new Srlx(masm, dst, 2, tmp); - new Or(masm, dst, tmp, dst); - new Srlx(masm, dst, 4, tmp); - new Or(masm, dst, tmp, dst); - new Srlx(masm, dst, 8, tmp); - new Or(masm, dst, tmp, dst); - new Srlx(masm, dst, 16, tmp); - new Or(masm, dst, tmp, dst); - new Srlx(masm, dst, 32, tmp); - new Or(masm, dst, tmp, dst); - new Popc(masm, dst, dst); - new Mov(masm, lkind.getBitCount(), tmp); - new Sub(masm, tmp, dst, dst); + new Srlx(src, 1, tmp).emit(masm); + new Or(src, tmp, dst).emit(masm); + new Srlx(dst, 2, tmp).emit(masm); + new Or(dst, tmp, dst).emit(masm); + new Srlx(dst, 4, tmp).emit(masm); + new Or(dst, tmp, dst).emit(masm); + new Srlx(dst, 8, tmp).emit(masm); + new Or(dst, tmp, dst).emit(masm); + new Srlx(dst, 16, tmp).emit(masm); + new Or(dst, tmp, dst).emit(masm); + new Srlx(dst, 32, tmp).emit(masm); + new Or(dst, tmp, dst).emit(masm); + new Popc(dst, dst).emit(masm); + new Mov(lkind.getBitCount(), tmp).emit(masm); + new Sub(tmp, dst, dst).emit(masm); break; default: throw GraalInternalError.shouldNotReachHere("missing: " + opcode); @@ -138,10 +131,10 @@ } else if (ValueUtil.isConstant(input) && isSimm13(tasm.asIntConst(input))) { switch (opcode) { case IPOPCNT: - new Popc(masm, tasm.asIntConst(input), dst); + new Popc(tasm.asIntConst(input), dst).emit(masm); break; case LPOPCNT: - new Popc(masm, tasm.asIntConst(input), dst); + new Popc(tasm.asIntConst(input), dst).emit(masm); break; default: throw GraalInternalError.shouldNotReachHere("missing: " + opcode); @@ -150,32 +143,32 @@ SPARCAddress src = (SPARCAddress) tasm.asAddress(input); switch (opcode) { case IPOPCNT: - new Ldsw(masm, src, tmp); + new Ldsw(src, tmp).emit(masm); // clear upper word for 64 bit POPC - new Srl(masm, tmp, SPARC.g0, dst); - new Popc(masm, tmp, dst); + new Srl(tmp, g0, dst).emit(masm); + new Popc(tmp, dst).emit(masm); break; case LPOPCNT: - new Ldx(masm, src, tmp); - new Popc(masm, tmp, dst); + new Ldx(src, tmp).emit(masm); + new Popc(tmp, dst).emit(masm); break; case BSF: assert input.getKind() == Kind.Int; - new Ldsw(masm, src, tmp); - new Srl(masm, tmp, 1, tmp); - new Srl(masm, tmp, 0, dst); - new Or(masm, tmp, tmp, dst); - new Srl(masm, dst, 2, tmp); - new Or(masm, dst, tmp, dst); - new Srl(masm, dst, 4, tmp); - new Or(masm, dst, tmp, dst); - new Srl(masm, dst, 8, tmp); - new Or(masm, dst, tmp, dst); - new Srl(masm, dst, 16, tmp); - new Or(masm, dst, tmp, dst); - new Popc(masm, dst, dst); - new Mov(masm, Kind.Int.getBitCount(), tmp); - new Sub(masm, tmp, dst, dst); + new Ldsw(src, tmp).emit(masm); + new Srl(tmp, 1, tmp).emit(masm); + new Srl(tmp, 0, dst).emit(masm); + new Or(tmp, tmp, dst).emit(masm); + new Srl(dst, 2, tmp).emit(masm); + new Or(dst, tmp, dst).emit(masm); + new Srl(dst, 4, tmp).emit(masm); + new Or(dst, tmp, dst).emit(masm); + new Srl(dst, 8, tmp).emit(masm); + new Or(dst, tmp, dst).emit(masm); + new Srl(dst, 16, tmp).emit(masm); + new Or(dst, tmp, dst).emit(masm); + new Popc(dst, dst).emit(masm); + new Mov(Kind.Int.getBitCount(), tmp).emit(masm); + new Sub(tmp, dst, dst).emit(masm); break; case IBSR: // masm.bsrl(dst, src); diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCompare.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCompare.java Thu Jun 20 10:56:34 2013 -0700 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCompare.java Thu Jun 20 20:40:52 2013 -0700 @@ -23,25 +23,24 @@ package com.oracle.graal.lir.sparc; import static com.oracle.graal.api.code.ValueUtil.*; -import static com.oracle.graal.asm.sparc.SPARCAssembler.isSimm13; +import static com.oracle.graal.asm.sparc.SPARCAssembler.*; import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.asm.sparc.SPARCAssembler; -import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Cmp; +import com.oracle.graal.asm.sparc.*; +import com.oracle.graal.asm.sparc.SPARCMacroAssembler.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; -//@formatter:off public enum SPARCCompare { ICMP, LCMP, ACMP, FCMP, DCMP; public static class CompareOp extends SPARCLIRInstruction { @Opcode private final SPARCCompare opcode; - @Use({REG, STACK, CONST}) protected Value x; - @Use({REG, STACK, CONST}) protected Value y; + @Use({REG}) protected Value x; + @Use({REG, CONST}) protected Value y; public CompareOp(SPARCCompare opcode, Value x, Value y) { this.opcode = opcode; @@ -57,11 +56,9 @@ @Override protected void verify() { super.verify(); - assert (name().startsWith("I") && x.getKind() == Kind.Int && y.getKind().getStackKind() == Kind.Int) - || (name().startsWith("L") && x.getKind() == Kind.Long && y.getKind() == Kind.Long) - || (name().startsWith("A") && x.getKind() == Kind.Object && y.getKind() == Kind.Object) - || (name().startsWith("F") && x.getKind() == Kind.Float && y.getKind() == Kind.Float) - || (name().startsWith("D") && x.getKind() == Kind.Double && y.getKind() == Kind.Double); + assert (name().startsWith("I") && x.getKind() == Kind.Int && y.getKind().getStackKind() == Kind.Int) || (name().startsWith("L") && x.getKind() == Kind.Long && y.getKind() == Kind.Long) || + (name().startsWith("A") && x.getKind() == Kind.Object && y.getKind() == Kind.Object) || + (name().startsWith("F") && x.getKind() == Kind.Float && y.getKind() == Kind.Float) || (name().startsWith("D") && x.getKind() == Kind.Double && y.getKind() == Kind.Double); } } @@ -70,66 +67,48 @@ if (isRegister(y)) { switch (opcode) { case ICMP: - new Cmp(masm, asIntReg(x), asIntReg(y)); + new Cmp(asIntReg(x), asIntReg(y)).emit(masm); break; case LCMP: - new Cmp(masm, asLongReg(x), asLongReg(y)); + new Cmp(asLongReg(x), asLongReg(y)).emit(masm); break; case ACMP: // masm.cmpptr(asObjectReg(x), asObjectReg(y)); - break; + // break; case FCMP: // masm.ucomiss(asFloatReg(x), asFloatReg(y)); - break; + // break; case DCMP: // masm.ucomisd(asDoubleReg(x), asDoubleReg(y)); - break; + // break; default: throw GraalInternalError.shouldNotReachHere(); } - } else if (isConstant(y)) { + } else { + assert isConstant(y); switch (opcode) { case ICMP: assert isSimm13(tasm.asIntConst(y)); - new Cmp(masm, asIntReg(x), tasm.asIntConst(y)); + new Cmp(asIntReg(x), tasm.asIntConst(y)).emit(masm); break; case LCMP: assert isSimm13(tasm.asIntConst(y)); - new Cmp(masm, asLongReg(x), tasm.asIntConst(y)); + new Cmp(asLongReg(x), tasm.asIntConst(y)).emit(masm); break; case ACMP: if (((Constant) y).isNull()) { // masm.cmpq(asObjectReg(x), 0); - break; + // break; + throw GraalInternalError.shouldNotReachHere(); } else { throw GraalInternalError.shouldNotReachHere("Only null object constants are allowed in comparisons"); } case FCMP: // masm.ucomiss(asFloatReg(x), (AMD64Address) tasm.asFloatConstRef(y)); - break; + // break; case DCMP: // masm.ucomisd(asDoubleReg(x), (AMD64Address) tasm.asDoubleConstRef(y)); - break; - default: - throw GraalInternalError.shouldNotReachHere(); - } - } else { - switch (opcode) { - case ICMP: - // masm.cmpl(asIntReg(x), (AMD64Address) tasm.asIntAddr(y)); - break; - case LCMP: - // masm.cmpq(asLongReg(x), (AMD64Address) tasm.asLongAddr(y)); - break; - case ACMP: - // masm.cmpptr(asObjectReg(x), (AMD64Address) tasm.asObjectAddr(y)); - break; - case FCMP: - // masm.ucomiss(asFloatReg(x), (AMD64Address) tasm.asFloatAddr(y)); - break; - case DCMP: - // masm.ucomisd(asDoubleReg(x), (AMD64Address) tasm.asDoubleAddr(y)); - break; + // break; default: throw GraalInternalError.shouldNotReachHere(); } diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java Thu Jun 20 10:56:34 2013 -0700 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java Thu Jun 20 20:40:52 2013 -0700 @@ -30,10 +30,8 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.*; import com.oracle.graal.asm.sparc.*; -import com.oracle.graal.asm.sparc.SPARCAssembler.Bpe; -import com.oracle.graal.asm.sparc.SPARCAssembler.CC; -import com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag; -import com.oracle.graal.asm.sparc.SPARCAssembler.Subcc; +import com.oracle.graal.asm.sparc.SPARCAssembler.*; +import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.StandardOp.FallThroughOp; @@ -41,6 +39,8 @@ import com.oracle.graal.nodes.calc.*; import com.oracle.graal.sparc.*; +import static com.oracle.graal.asm.sparc.SPARCMacroAssembler.*; + public class SPARCControlFlow { public static class BranchOp extends SPARCLIRInstruction implements StandardOp.BranchOp { @@ -56,11 +56,15 @@ @Override @SuppressWarnings("unused") public void emitCode(TargetMethodAssembler tasm, SPARCAssembler masm) { - // masm.at(); - Label l = destination.label(); - // l.addPatchAt(tasm.asm.codeBuffer.position()); - String target = l.isBound() ? "L" + l.toString() : AbstractSPARCAssembler.UNBOUND_TARGET; - // masm.bra(target); + switch (condition) { + case GT: + // FIXME xcc is wrong! It depends on the compare. + new Bpg(CC.Xcc, destination.label()).emit(masm); + break; + default: + throw GraalInternalError.shouldNotReachHere(); + } + new Nop().emit(masm); } @Override @@ -143,10 +147,10 @@ switch (other.getKind()) { case Int: // masm.cmovl(cond, asRegister(result), asRegister(other)); - break; + // break; case Long: // masm.cmovq(cond, asRegister(result), asRegister(other)); - break; + // break; default: throw GraalInternalError.shouldNotReachHere(); } @@ -155,10 +159,10 @@ switch (other.getKind()) { case Int: // masm.cmovl(cond, asRegister(result), addr); - break; + // break; case Long: // masm.cmovq(cond, asRegister(result), addr); - break; + // break; default: throw GraalInternalError.shouldNotReachHere(); } @@ -226,10 +230,9 @@ @Override public void emitCode(TargetMethodAssembler tasm, SPARCAssembler masm) { - if (tasm.frameContext != null) { - tasm.frameContext.leave(tasm); - } - // masm.return(); + new Ret().emit(masm); + // On SPARC we always leave the frame. + tasm.frameContext.leave(tasm); } } @@ -261,10 +264,10 @@ } long lc = keyConstants[i].asLong(); assert NumUtil.isInt(lc); - new Subcc(masm, intKey, (int) lc, SPARC.r0); // CMP + new Cmp(intKey, (int) lc).emit(masm); Label l = keyTargets[i].label(); l.addPatchAt(tasm.asm.codeBuffer.position()); - new Bpe(masm, CC.Icc, l); + new Bpe(CC.Icc, l).emit(masm); } } else if (key.getKind() == Kind.Long) { Register longKey = asLongReg(key); @@ -274,15 +277,15 @@ // masm.at(); Label l = keyTargets[i].label(); l.addPatchAt(tasm.asm.codeBuffer.position()); - new Bpe(masm, CC.Xcc, l); + new Bpe(CC.Xcc, l).emit(masm); } } else if (key.getKind() == Kind.Object) { Register intKey = asObjectReg(key); Register temp = asObjectReg(scratch); for (int i = 0; i < keyConstants.length; i++) { SPARCMove.move(tasm, masm, temp.asValue(Kind.Object), keyConstants[i]); - new Subcc(masm, intKey, temp, SPARC.r0); // CMP - new Bpe(masm, CC.Icc, keyTargets[i].label()); + new Cmp(intKey, temp).emit(masm); + new Bpe(CC.Ptrcc, keyTargets[i].label()).emit(masm); } } else { throw new GraalInternalError("sequential switch only supported for int, long and object"); diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java Thu Jun 20 10:56:34 2013 -0700 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java Thu Jun 20 20:40:52 2013 -0700 @@ -28,28 +28,16 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.sparc.*; -import com.oracle.graal.asm.sparc.SPARCAssembler.Lddf; -import com.oracle.graal.asm.sparc.SPARCAssembler.Ldf; -import com.oracle.graal.asm.sparc.SPARCAssembler.Ldsb; -import com.oracle.graal.asm.sparc.SPARCAssembler.Ldsh; -import com.oracle.graal.asm.sparc.SPARCAssembler.Ldsw; -import com.oracle.graal.asm.sparc.SPARCAssembler.Lduw; -import com.oracle.graal.asm.sparc.SPARCAssembler.Ldx; -import com.oracle.graal.asm.sparc.SPARCAssembler.Membar; -import com.oracle.graal.asm.sparc.SPARCAssembler.NullCheck; -import com.oracle.graal.asm.sparc.SPARCAssembler.Or; -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.SPARCMacroAssembler.Setuw; -import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Setx; +import com.oracle.graal.asm.sparc.SPARCAssembler.*; +import com.oracle.graal.asm.sparc.SPARCMacroAssembler.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.StandardOp.MoveOp; import com.oracle.graal.lir.asm.*; import com.oracle.graal.sparc.*; +import static com.oracle.graal.sparc.SPARC.*; + public class SPARCMove { public static class LoadOp extends SPARCLIRInstruction { @@ -72,28 +60,28 @@ SPARCAddress addr = address.toAddress(); switch (kind) { case Byte: - new Ldsb(masm, addr, asRegister(result)); + new Ldsb(addr, asRegister(result)).emit(masm); break; case Short: - new Ldsh(masm, addr, asRegister(result)); + new Ldsh(addr, asRegister(result)).emit(masm); break; case Char: - new Lduw(masm, addr, asRegister(result)); + new Lduw(addr, asRegister(result)).emit(masm); break; case Int: - new Ldsw(masm, addr, asRegister(result)); + new Ldsw(addr, asRegister(result)).emit(masm); break; case Long: - new Ldx(masm, addr, asRegister(result)); + new Ldx(addr, asRegister(result)).emit(masm); break; case Float: - new Ldf(masm, addr, asRegister(result)); + new Ldf(addr, asRegister(result)).emit(masm); break; case Double: - new Lddf(masm, addr, asRegister(result)); + new Lddf(addr, asRegister(result)).emit(masm); break; case Object: - new Ldx(masm, addr, asRegister(result)); + new Ldx(addr, asRegister(result)).emit(masm); break; default: throw GraalInternalError.shouldNotReachHere(); @@ -112,7 +100,7 @@ @Override public void emitCode(TargetMethodAssembler tasm, SPARCAssembler asm) { - new Membar(asm, barriers); + new Membar(barriers).emit(asm); } } @@ -184,7 +172,7 @@ @SuppressWarnings("unused") public void emitCode(TargetMethodAssembler tasm, SPARCAssembler masm) { tasm.recordImplicitException(masm.codeBuffer.position(), state); - new NullCheck(masm, new SPARCAddress(asRegister(input), 0)); + new Ldx(new SPARCAddress(asRegister(input), 0), r0); } } @@ -201,7 +189,7 @@ @Override public void emitCode(TargetMethodAssembler tasm, SPARCAssembler asm) { - new Ldx(asm, (SPARCAddress) tasm.asAddress(slot), asLongReg(result)); + new Ldx((SPARCAddress) tasm.asAddress(slot), asLongReg(result)).emit(asm); } } @@ -226,26 +214,22 @@ SPARCAddress addr = address.toAddress(); switch (kind) { case Byte: - new Stb(masm, asRegister(input), addr); + new Stb(asRegister(input), addr).emit(masm); break; case Short: - new Sth(masm, asRegister(input), addr); + new Sth(asRegister(input), addr).emit(masm); break; case Int: - new Stw(masm, asRegister(input), addr); + new Stw(asRegister(input), addr).emit(masm); break; case Long: - new Stx(masm, asRegister(input), addr); + new Stx(asRegister(input), addr).emit(masm); + break; + case Object: + new Stx(asRegister(input), addr).emit(masm); break; case Float: - new Stx(masm, asRegister(input), addr); - break; case Double: - new Stx(masm, asRegister(input), addr); - break; - case Object: - new Stx(masm, asRegister(input), addr); - break; default: throw GraalInternalError.shouldNotReachHere("missing: " + address.getKind()); } @@ -277,20 +261,14 @@ } switch (input.getKind()) { case Int: - new Or(masm, SPARC.r0, asRegister(input), asRegister(result)); + new Mov(asRegister(input), asRegister(result)).emit(masm); break; case Long: - new Or(masm, SPARC.r0, asRegister(input), asRegister(result)); + new Mov(asRegister(input), asRegister(result)).emit(masm); 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()); } diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCTestOp.java --- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCTestOp.java Thu Jun 20 10:56:34 2013 -0700 +++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCTestOp.java Thu Jun 20 20:40:52 2013 -0700 @@ -27,9 +27,8 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.sparc.*; -import com.oracle.graal.asm.sparc.SPARCAssembler.Ldsw; -import com.oracle.graal.asm.sparc.SPARCAssembler.Ldx; -import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Cmp; +import com.oracle.graal.asm.sparc.SPARCAssembler.*; +import com.oracle.graal.asm.sparc.SPARCMacroAssembler.*; import com.oracle.graal.graph.*; import com.oracle.graal.lir.asm.*; @@ -45,14 +44,14 @@ @Override @SuppressWarnings("unused") - public void emitCode(TargetMethodAssembler tasm, SPARCAssembler asm) { + public void emitCode(TargetMethodAssembler tasm, SPARCAssembler masm) { if (isRegister(y)) { switch (x.getKind()) { case Int: - new Cmp(asm, asIntReg(x), asIntReg(y)); + new Cmp(asIntReg(x), asIntReg(y)).emit(masm); break; case Long: - new Cmp(asm, asLongReg(x), asLongReg(y)); + new Cmp(asLongReg(x), asLongReg(y)).emit(masm); break; default: throw GraalInternalError.shouldNotReachHere(); @@ -60,10 +59,10 @@ } else if (isConstant(y)) { switch (x.getKind()) { case Int: - new Cmp(asm, asIntReg(x), tasm.asIntConst(y)); + new Cmp(asIntReg(x), tasm.asIntConst(y)).emit(masm); break; case Long: - new Cmp(asm, asLongReg(x), tasm.asIntConst(y)); + new Cmp(asLongReg(x), tasm.asIntConst(y)).emit(masm); break; default: throw GraalInternalError.shouldNotReachHere(); @@ -71,12 +70,12 @@ } else { switch (x.getKind()) { case Int: - new Ldsw(asm, (SPARCAddress) tasm.asIntAddr(y), asIntReg(y)); - new Cmp(asm, asIntReg(x), asIntReg(y)); + new Ldsw((SPARCAddress) tasm.asIntAddr(y), asIntReg(y)).emit(masm); + new Cmp(asIntReg(x), asIntReg(y)).emit(masm); break; case Long: - new Ldx(asm, (SPARCAddress) tasm.asLongAddr(y), asLongReg(y)); - new Cmp(asm, asLongReg(x), asLongReg(y)); + new Ldx((SPARCAddress) tasm.asLongAddr(y), asLongReg(y)).emit(masm); + new Cmp(asLongReg(x), asLongReg(y)).emit(masm); break; default: throw GraalInternalError.shouldNotReachHere(); diff -r 63e44cdabb91 -r f78079947084 graal/com.oracle.graal.sparc/src/com/oracle/graal/sparc/SPARC.java --- a/graal/com.oracle.graal.sparc/src/com/oracle/graal/sparc/SPARC.java Thu Jun 20 10:56:34 2013 -0700 +++ b/graal/com.oracle.graal.sparc/src/com/oracle/graal/sparc/SPARC.java Thu Jun 20 20:40:52 2013 -0700 @@ -83,6 +83,24 @@ public static final Register g6 = r6; public static final Register g7 = r7; + 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 l0 = r16; + public static final Register l1 = r17; + public static final Register l2 = r18; + public static final Register l3 = r19; + public static final Register l4 = r20; + public static final Register l5 = r21; + public static final Register l6 = r22; + public static final Register l7 = r23; + public static final Register i0 = r24; public static final Register i1 = r25; public static final Register i2 = r26; @@ -92,14 +110,8 @@ 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 fp = i6; + public static final Register sp = o6; public static final Register[] gprRegisters = { r0, r1, r2, r3, r4, r5, r6, r7, @@ -129,19 +141,47 @@ }; public SPARC() { - super("SPARC", 8, ByteOrder.LITTLE_ENDIAN, allRegisters, LOAD_STORE | STORE_STORE, 1, 0, 8); - // SPARC: Fix architecture parameters. + super("SPARC", + 8, + ByteOrder.BIG_ENDIAN, + allRegisters, + LOAD_STORE | STORE_STORE, + 1, + r31.encoding + 1, + 8); } @Override - public boolean canStoreValue(RegisterCategory category, PlatformKind kind) { - // TODO Auto-generated method stub + public boolean canStoreValue(RegisterCategory category, PlatformKind platformKind) { + if (!(platformKind instanceof Kind)) { + return false; + } + + Kind kind = (Kind) platformKind; + if (category == CPU) { + switch (kind) { + case Boolean: + case Byte: + case Char: + case Short: + case Int: + case Long: + case Object: + return true; + } + } else if (category == FPU) { + switch (kind) { + case Float: + case Double: + return true; + } + } + return false; } @Override public PlatformKind getLargestStorableKind(RegisterCategory category) { - // TODO Auto-generated method stub - return null; + throw new InternalError("NYI"); } }