Mercurial > hg > graal-compiler
diff graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCMacroAssembler.java @ 10854:e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
author | twisti |
---|---|
date | Mon, 22 Jul 2013 22:26:49 -0700 |
parents | 7a8d6ba83a04 |
children | c3b09d69dfde |
line wrap: on
line diff
--- a/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCMacroAssembler.java Mon Jul 22 21:43:31 2013 -0700 +++ b/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCMacroAssembler.java Mon Jul 22 22:26:49 2013 -0700 @@ -324,19 +324,24 @@ } } - public static class Setx { + /** + * This instruction is like sethi but for 64-bit values. + */ + public static class Sethix { + + private static final int INSTRUCTION_SIZE = 7; private long value; private Register dst; private boolean forceRelocatable; - public Setx(long value, Register dst, boolean forceRelocatable) { + public Sethix(long value, Register dst, boolean forceRelocatable) { this.value = value; this.dst = dst; this.forceRelocatable = forceRelocatable; } - public Setx(long value, Register dst) { + public Sethix(long value, Register dst) { this(value, dst, false); } @@ -344,28 +349,6 @@ int hi = (int) (value >> 32); int lo = (int) (value & ~0); -// if (isSimm13(lo) && value == lo) { -// new Or(g0, lo, dst).emit(masm); -// } else if (hi == 0) { -// new Sethi(lo, dst).emit(masm); // hardware version zero-extends to upper 32 -// if (lo10(lo) != 0) { -// new Or(dst, lo10(lo), dst).emit(masm); -// } -// } else if (hi == -1) { -// new Sethi(~lo, dst).emit(masm); // hardware version zero-extends to upper 32 -// new Xor(dst, ~lo10(~0), dst).emit(masm); -// new Add(dst, lo10(lo), dst).emit(masm); -// } else if (lo == 0) { -// if (isSimm13(hi)) { -// new Or(g0, hi, dst).emit(masm); -// } else { -// new Sethi(hi, dst).emit(masm); // hardware version zero-extends to upper 32 -// if (lo10(hi) != 0) { -// new Or(dst, lo10(hi), dst).emit(masm); -// } -// } -// new Sllx(dst, 32, dst).emit(masm); - // This is the same logic as MacroAssembler::internal_set. final int startPc = masm.codeBuffer.position(); @@ -402,10 +385,32 @@ } // Pad out the instruction sequence so it can be patched later. if (forceRelocatable) { - while (masm.codeBuffer.position() < (startPc + (7 * 4))) { + while (masm.codeBuffer.position() < (startPc + (INSTRUCTION_SIZE * 4))) { new Nop().emit(masm); } } + } + } + + public static class Setx { + + private long value; + private Register dst; + private boolean forceRelocatable; + + public Setx(long value, Register dst, boolean forceRelocatable) { + this.value = value; + this.dst = dst; + this.forceRelocatable = forceRelocatable; + } + + public Setx(long value, Register dst) { + this(value, dst, false); + } + + public void emit(SPARCMacroAssembler masm) { + new Sethix(value, dst, forceRelocatable).emit(masm); + int lo = (int) (value & ~0); if (lo10(lo) != 0 || forceRelocatable) { new Add(dst, lo10(lo), dst).emit(masm); }