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_ARM.
6#if defined(TARGET_ARCH_ARM)
7
8#include "vm/compiler/assembler/assembler.h"
9#include "vm/compiler/graph_intrinsifier.h"
10
11namespace dart {
12namespace compiler {
13
14#define __ assembler->
15
16intptr_t GraphIntrinsifier::ParameterSlotFromSp() {
17 return -1;
18}
19
20static bool IsABIPreservedRegister(Register reg) {
21 return ((1 << reg) & kAbiPreservedCpuRegs) != 0;
22}
23
24void GraphIntrinsifier::IntrinsicCallPrologue(Assembler* assembler) {
25 ASSERT(IsABIPreservedRegister(CODE_REG));
26 ASSERT(IsABIPreservedRegister(ARGS_DESC_REG));
27 ASSERT(IsABIPreservedRegister(CALLEE_SAVED_TEMP));
28
29 // Save LR by moving it to a callee saved temporary register.
30 assembler->Comment("IntrinsicCallPrologue");
31 assembler->mov(CALLEE_SAVED_TEMP, Operand(LR));
32}
33
34void GraphIntrinsifier::IntrinsicCallEpilogue(Assembler* assembler) {
35 // Restore LR.
36 assembler->Comment("IntrinsicCallEpilogue");
37 assembler->mov(LR, Operand(CALLEE_SAVED_TEMP));
38}
39
40#undef __
41
42} // namespace compiler
43} // namespace dart
44
45#endif // defined(TARGET_ARCH_ARM)
46