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_X64.
6#if defined(TARGET_ARCH_X64)
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 0;
18}
19
20static bool IsABIPreservedRegister(Register reg) {
21 return ((1 << reg) & CallingConventions::kCalleeSaveCpuRegisters) != 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 ASSERT(CALLEE_SAVED_TEMP != CODE_REG);
29 ASSERT(CALLEE_SAVED_TEMP != ARGS_DESC_REG);
30
31 assembler->Comment("IntrinsicCallPrologue");
32 assembler->movq(CALLEE_SAVED_TEMP, ARGS_DESC_REG);
33}
34
35void GraphIntrinsifier::IntrinsicCallEpilogue(Assembler* assembler) {
36 assembler->Comment("IntrinsicCallEpilogue");
37 assembler->movq(ARGS_DESC_REG, CALLEE_SAVED_TEMP);
38}
39
40#undef __
41
42} // namespace compiler
43} // namespace dart
44
45#endif // defined(TARGET_ARCH_X64)
46