Mercurial > hg > truffle
changeset 21200:9965d71c8971
Introduce AMD64StackMove.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Tue, 28 Apr 2015 18:24:30 +0200 |
parents | a5ea5041155d |
children | 5b913e452629 |
files | graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/PhiResolver.java |
diffstat | 1 files changed, 41 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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<AMD64StackMove> 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<LeaOp> TYPE = LIRInstructionClass.create(LeaOp.class);