1 | // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file |
2 | // for details. All rights reserved. Use of this source code is governed by a |
3 | // BSD-style license that can be found in the LICENSE file. |
4 | |
5 | #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
6 | #if defined(TARGET_ARCH_ARM64) |
7 | |
8 | #include "vm/compiler/assembler/assembler.h" |
9 | #include "vm/compiler/graph_intrinsifier.h" |
10 | |
11 | namespace dart { |
12 | namespace compiler { |
13 | |
14 | #define __ assembler-> |
15 | |
16 | intptr_t GraphIntrinsifier::ParameterSlotFromSp() { |
17 | return -1; |
18 | } |
19 | |
20 | static bool IsABIPreservedRegister(Register reg) { |
21 | return ((1 << reg) & kAbiPreservedCpuRegs) != 0; |
22 | } |
23 | |
24 | void GraphIntrinsifier::IntrinsicCallPrologue(Assembler* assembler) { |
25 | ASSERT(IsABIPreservedRegister(CODE_REG)); |
26 | ASSERT(!IsABIPreservedRegister(ARGS_DESC_REG)); |
27 | ASSERT(IsABIPreservedRegister(CALLEE_SAVED_TEMP)); |
28 | ASSERT(IsABIPreservedRegister(CALLEE_SAVED_TEMP2)); |
29 | ASSERT(CALLEE_SAVED_TEMP != CODE_REG); |
30 | ASSERT(CALLEE_SAVED_TEMP != ARGS_DESC_REG); |
31 | ASSERT(CALLEE_SAVED_TEMP2 != CODE_REG); |
32 | ASSERT(CALLEE_SAVED_TEMP2 != ARGS_DESC_REG); |
33 | |
34 | assembler->Comment("IntrinsicCallPrologue" ); |
35 | assembler->mov(CALLEE_SAVED_TEMP, LR); |
36 | assembler->mov(CALLEE_SAVED_TEMP2, ARGS_DESC_REG); |
37 | } |
38 | |
39 | void GraphIntrinsifier::IntrinsicCallEpilogue(Assembler* assembler) { |
40 | assembler->Comment("IntrinsicCallEpilogue" ); |
41 | assembler->mov(LR, CALLEE_SAVED_TEMP); |
42 | assembler->mov(ARGS_DESC_REG, CALLEE_SAVED_TEMP2); |
43 | } |
44 | |
45 | #undef __ |
46 | |
47 | } // namespace compiler |
48 | } // namespace dart |
49 | |
50 | #endif // defined(TARGET_ARCH_ARM64) |
51 | |