calling_convention_mips64.h revision cc8b04e5481ca7567d337d9358f92dc2195fc137
1/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ART_COMPILER_JNI_QUICK_MIPS64_CALLING_CONVENTION_MIPS64_H_
18#define ART_COMPILER_JNI_QUICK_MIPS64_CALLING_CONVENTION_MIPS64_H_
19
20#include "base/enums.h"
21#include "jni/quick/calling_convention.h"
22
23namespace art {
24namespace mips64 {
25
26constexpr size_t kFramePointerSize = 8;
27static_assert(kFramePointerSize == static_cast<size_t>(PointerSize::k64),
28              "Invalid frame pointer size");
29
30class Mips64ManagedRuntimeCallingConvention FINAL : public ManagedRuntimeCallingConvention {
31 public:
32  Mips64ManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty)
33      : ManagedRuntimeCallingConvention(is_static,
34                                        is_synchronized,
35                                        shorty,
36                                        PointerSize::k64) {}
37  ~Mips64ManagedRuntimeCallingConvention() OVERRIDE {}
38  // Calling convention
39  ManagedRegister ReturnRegister() OVERRIDE;
40  ManagedRegister InterproceduralScratchRegister() OVERRIDE;
41  // Managed runtime calling convention
42  ManagedRegister MethodRegister() OVERRIDE;
43  bool IsCurrentParamInRegister() OVERRIDE;
44  bool IsCurrentParamOnStack() OVERRIDE;
45  ManagedRegister CurrentParamRegister() OVERRIDE;
46  FrameOffset CurrentParamStackOffset() OVERRIDE;
47  const ManagedRegisterEntrySpills& EntrySpills() OVERRIDE;
48
49 private:
50  ManagedRegisterEntrySpills entry_spills_;
51
52  DISALLOW_COPY_AND_ASSIGN(Mips64ManagedRuntimeCallingConvention);
53};
54
55class Mips64JniCallingConvention FINAL : public JniCallingConvention {
56 public:
57  Mips64JniCallingConvention(bool is_static,
58                             bool is_synchronized,
59                             bool is_critical_native,
60                             const char* shorty);
61  ~Mips64JniCallingConvention() OVERRIDE {}
62  // Calling convention
63  ManagedRegister ReturnRegister() OVERRIDE;
64  ManagedRegister IntReturnRegister() OVERRIDE;
65  ManagedRegister InterproceduralScratchRegister() OVERRIDE;
66  // JNI calling convention
67  size_t FrameSize() OVERRIDE;
68  size_t OutArgSize() OVERRIDE;
69  ArrayRef<const ManagedRegister> CalleeSaveRegisters() const OVERRIDE;
70  ManagedRegister ReturnScratchRegister() const OVERRIDE;
71  uint32_t CoreSpillMask() const OVERRIDE;
72  uint32_t FpSpillMask() const OVERRIDE;
73  bool IsCurrentParamInRegister() OVERRIDE;
74  bool IsCurrentParamOnStack() OVERRIDE;
75  ManagedRegister CurrentParamRegister() OVERRIDE;
76  FrameOffset CurrentParamStackOffset() OVERRIDE;
77
78  // Mips64 does not need to extend small return types.
79  bool RequiresSmallResultTypeExtension() const OVERRIDE {
80    return false;
81  }
82
83 protected:
84  size_t NumberOfOutgoingStackArgs() OVERRIDE;
85
86 private:
87  DISALLOW_COPY_AND_ASSIGN(Mips64JniCallingConvention);
88};
89
90}  // namespace mips64
91}  // namespace art
92
93#endif  // ART_COMPILER_JNI_QUICK_MIPS64_CALLING_CONVENTION_MIPS64_H_
94