# HG changeset patch # User Josef Eisl # Date 1430238270 -7200 # Node ID 9965d71c8971adf78bcd03815c4d7c4579d204e6 # Parent a5ea5041155dd66f3b9315802316e729e65782a9 Introduce AMD64StackMove. diff -r a5ea5041155d -r 9965d71c8971 graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java --- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Mon Apr 27 11:21:55 2015 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Tue Apr 28 18:24:30 2015 +0200 @@ -108,6 +108,47 @@ } } + @Opcode("STACKMOVE") + public static final class AMD64StackMove extends AMD64LIRInstruction implements MoveOp { + public static final LIRInstructionClass TYPE = LIRInstructionClass.create(AMD64StackMove.class); + + @Def({STACK}) protected AllocatableValue result; + @Use({STACK, HINT}) protected Value input; + @Alive({OperandFlag.STACK, OperandFlag.UNINITIALIZED}) private StackSlotValue backupSlot; + + private Register scratch; + + public AMD64StackMove(AllocatableValue result, Value input, Register scratch, StackSlotValue backupSlot) { + super(TYPE); + this.result = result; + this.input = input; + this.backupSlot = backupSlot; + this.scratch = scratch; + } + + @Override + public Value getInput() { + return input; + } + + @Override + public AllocatableValue getResult() { + return result; + } + + @Override + public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { + // backup scratch register + move(backupSlot.getKind(), crb, masm, backupSlot, scratch.asValue(backupSlot.getLIRKind())); + // move stack slot + move(getInput().getKind(), crb, masm, scratch.asValue(getInput().getLIRKind()), getInput()); + move(getResult().getKind(), crb, masm, getResult(), scratch.asValue(getResult().getLIRKind())); + // restore scratch register + move(backupSlot.getKind(), crb, masm, scratch.asValue(backupSlot.getLIRKind()), backupSlot); + + } + } + public static final class LeaOp extends AMD64LIRInstruction { public static final LIRInstructionClass TYPE = LIRInstructionClass.create(LeaOp.class);