comparison graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java @ 21200:9965d71c8971

Introduce AMD64StackMove.
author Josef Eisl <josef.eisl@jku.at>
date Tue, 28 Apr 2015 18:24:30 +0200
parents 3253fe1bed41
children a4f376f516dc
comparison
equal deleted inserted replaced
21199:a5ea5041155d 21200:9965d71c8971
106 public AllocatableValue getResult() { 106 public AllocatableValue getResult() {
107 return result; 107 return result;
108 } 108 }
109 } 109 }
110 110
111 @Opcode("STACKMOVE")
112 public static final class AMD64StackMove extends AMD64LIRInstruction implements MoveOp {
113 public static final LIRInstructionClass<AMD64StackMove> TYPE = LIRInstructionClass.create(AMD64StackMove.class);
114
115 @Def({STACK}) protected AllocatableValue result;
116 @Use({STACK, HINT}) protected Value input;
117 @Alive({OperandFlag.STACK, OperandFlag.UNINITIALIZED}) private StackSlotValue backupSlot;
118
119 private Register scratch;
120
121 public AMD64StackMove(AllocatableValue result, Value input, Register scratch, StackSlotValue backupSlot) {
122 super(TYPE);
123 this.result = result;
124 this.input = input;
125 this.backupSlot = backupSlot;
126 this.scratch = scratch;
127 }
128
129 @Override
130 public Value getInput() {
131 return input;
132 }
133
134 @Override
135 public AllocatableValue getResult() {
136 return result;
137 }
138
139 @Override
140 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
141 // backup scratch register
142 move(backupSlot.getKind(), crb, masm, backupSlot, scratch.asValue(backupSlot.getLIRKind()));
143 // move stack slot
144 move(getInput().getKind(), crb, masm, scratch.asValue(getInput().getLIRKind()), getInput());
145 move(getResult().getKind(), crb, masm, getResult(), scratch.asValue(getResult().getLIRKind()));
146 // restore scratch register
147 move(backupSlot.getKind(), crb, masm, scratch.asValue(backupSlot.getLIRKind()), backupSlot);
148
149 }
150 }
151
111 public static final class LeaOp extends AMD64LIRInstruction { 152 public static final class LeaOp extends AMD64LIRInstruction {
112 public static final LIRInstructionClass<LeaOp> TYPE = LIRInstructionClass.create(LeaOp.class); 153 public static final LIRInstructionClass<LeaOp> TYPE = LIRInstructionClass.create(LeaOp.class);
113 154
114 @Def({REG}) protected AllocatableValue result; 155 @Def({REG}) protected AllocatableValue result;
115 @Use({COMPOSITE, UNINITIALIZED}) protected AMD64AddressValue address; 156 @Use({COMPOSITE, UNINITIALIZED}) protected AMD64AddressValue address;