# HG changeset patch # User Josef Eisl # Date 1434614369 -7200 # Node ID 985f49785f066c14941f3e4ff9d27d7deba42632 # Parent f00f1f9df48edae46021555861110d561b4ab91b AMD64Move: add AMD64PushPopStackMove. diff -r f00f1f9df48e -r 985f49785f06 graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java --- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Thu Jun 18 09:58:29 2015 +0200 +++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java Thu Jun 18 09:59:29 2015 +0200 @@ -59,6 +59,7 @@ import com.oracle.graal.lir.amd64.AMD64ControlFlow.ReturnOp; import com.oracle.graal.lir.amd64.AMD64ControlFlow.StrategySwitchOp; import com.oracle.graal.lir.amd64.AMD64ControlFlow.TableSwitchOp; +import com.oracle.graal.lir.amd64.AMD64Move.AMD64PushPopStackMove; import com.oracle.graal.lir.amd64.AMD64Move.AMD64StackMove; import com.oracle.graal.lir.amd64.AMD64Move.CompareAndSwapOp; import com.oracle.graal.lir.amd64.AMD64Move.LeaDataOp; @@ -164,10 +165,23 @@ } protected LIRInstruction createStackMove(AllocatableValue result, Value input) { - RegisterBackupPair backup = getScratchRegister(input.getPlatformKind()); - Register scratchRegister = backup.register; - StackSlotValue backupSlot = backup.backupSlot; - return createStackMove(result, input, scratchRegister, backupSlot); + Kind kind = result.getKind(); + OperandSize size; + switch (kind) { + case Long: + case Double: + size = QWORD; + break; + case Short: + size = WORD; + break; + default: + RegisterBackupPair backup = getScratchRegister(input.getPlatformKind()); + Register scratchRegister = backup.register; + StackSlotValue backupSlot = backup.backupSlot; + return createStackMove(result, input, scratchRegister, backupSlot); + } + return new AMD64PushPopStackMove(size, result, input); } protected LIRInstruction createStackMove(AllocatableValue result, Value input, Register scratchRegister, StackSlotValue backupSlot) { diff -r f00f1f9df48e -r 985f49785f06 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 Thu Jun 18 09:58:29 2015 +0200 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java Thu Jun 18 09:59:29 2015 +0200 @@ -156,6 +156,38 @@ } } + @Opcode("STACKMOVE") + public static final class AMD64PushPopStackMove extends AMD64LIRInstruction implements MoveOp { + public static final LIRInstructionClass TYPE = LIRInstructionClass.create(AMD64PushPopStackMove.class); + + @Def({STACK}) protected AllocatableValue result; + @Use({STACK, HINT}) protected Value input; + private final OperandSize size; + + public AMD64PushPopStackMove(OperandSize size, AllocatableValue result, Value input) { + super(TYPE); + this.result = result; + this.input = input; + this.size = size; + } + + @Override + public Value getInput() { + return input; + } + + @Override + public AllocatableValue getResult() { + return result; + } + + @Override + public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { + AMD64MOp.PUSH.emit(masm, size, (AMD64Address) crb.asAddress(input)); + AMD64MOp.POP.emit(masm, size, (AMD64Address) crb.asAddress(result)); + } + } + public static final class LeaOp extends AMD64LIRInstruction { public static final LIRInstructionClass TYPE = LIRInstructionClass.create(LeaOp.class);