1 /* |
1 /* |
2 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright (c) 2018, Red Hat Inc. All rights reserved. |
3 * Copyright (c) 2018, Red Hat Inc. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
23 */ |
23 */ |
24 |
24 |
25 |
25 |
26 package org.graalvm.compiler.lir.aarch64; |
26 package org.graalvm.compiler.lir.aarch64; |
27 |
27 |
28 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.STACK; |
|
29 import static jdk.vm.ci.code.ValueUtil.asStackSlot; |
28 import static jdk.vm.ci.code.ValueUtil.asStackSlot; |
30 import static jdk.vm.ci.code.ValueUtil.isStackSlot; |
29 import static jdk.vm.ci.code.ValueUtil.isStackSlot; |
|
30 import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.STACK; |
31 |
31 |
32 import java.util.Arrays; |
32 import java.util.Arrays; |
33 |
33 |
34 import org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler; |
34 import org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler; |
35 import org.graalvm.compiler.lir.LIRInstructionClass; |
35 import org.graalvm.compiler.lir.LIRInstructionClass; |
36 import org.graalvm.compiler.lir.LIRValueUtil; |
36 import org.graalvm.compiler.lir.LIRValueUtil; |
37 import org.graalvm.compiler.lir.Opcode; |
37 import org.graalvm.compiler.lir.Opcode; |
|
38 import org.graalvm.compiler.lir.StandardOp; |
38 import org.graalvm.compiler.lir.asm.CompilationResultBuilder; |
39 import org.graalvm.compiler.lir.asm.CompilationResultBuilder; |
39 |
40 |
40 import jdk.vm.ci.code.Register; |
41 import jdk.vm.ci.code.Register; |
41 import jdk.vm.ci.code.StackSlot; |
42 import jdk.vm.ci.code.StackSlot; |
42 import jdk.vm.ci.meta.AllocatableValue; |
43 import jdk.vm.ci.meta.AllocatableValue; |
43 |
44 |
44 /** |
45 /** |
45 * Restores registers from stack slots. |
46 * Restores registers from stack slots. |
46 */ |
47 */ |
47 @Opcode("RESTORE_REGISTER") |
48 @Opcode("RESTORE_REGISTER") |
48 public class AArch64RestoreRegistersOp extends AArch64LIRInstruction { |
49 public class AArch64RestoreRegistersOp extends AArch64LIRInstruction implements StandardOp.RestoreRegistersOp { |
49 public static final LIRInstructionClass<AArch64RestoreRegistersOp> TYPE = LIRInstructionClass.create(AArch64RestoreRegistersOp.class); |
50 public static final LIRInstructionClass<AArch64RestoreRegistersOp> TYPE = LIRInstructionClass.create(AArch64RestoreRegistersOp.class); |
50 |
51 |
51 /** |
52 /** |
52 * The slots from which the registers are restored. |
53 * The slots from which the registers are restored. |
53 */ |
54 */ |
68 this.slots = values; |
69 this.slots = values; |
69 this.save = save; |
70 this.save = save; |
70 } |
71 } |
71 |
72 |
72 protected Register[] getSavedRegisters() { |
73 protected Register[] getSavedRegisters() { |
73 return save.savedRegisters; |
74 return save.getSavedRegisters(); |
74 } |
75 } |
75 |
76 |
76 protected void restoreRegister(CompilationResultBuilder crb, AArch64MacroAssembler masm, Register result, StackSlot input) { |
77 protected void restoreRegister(CompilationResultBuilder crb, AArch64MacroAssembler masm, Register result, StackSlot input) { |
77 AArch64Move.stack2reg(crb, masm, result.asValue(), input); |
78 AArch64Move.stack2reg(crb, masm, result.asValue(), input); |
78 } |
79 } |