blob: 5c128b0343879126f734b0730b10ee0a04527e2b [file] [log] [blame]
Brian Carlstrom7940e442013-07-12 13:46:57 -07001/*
2 * Copyright (C) 2011 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
Brian Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_COMPILER_JNI_QUICK_MIPS_CALLING_CONVENTION_MIPS_H_
18#define ART_COMPILER_JNI_QUICK_MIPS_CALLING_CONVENTION_MIPS_H_
Brian Carlstrom7940e442013-07-12 13:46:57 -070019
20#include "jni/quick/calling_convention.h"
21
22namespace art {
23namespace mips {
Ian Rogers790a6b72014-04-01 10:36:00 -070024
25constexpr size_t kFramePointerSize = 4;
26
Andreas Gampe25ff0042014-03-20 08:34:03 -070027class MipsManagedRuntimeCallingConvention FINAL : public ManagedRuntimeCallingConvention {
Brian Carlstrom7940e442013-07-12 13:46:57 -070028 public:
29 MipsManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty)
Ian Rogers790a6b72014-04-01 10:36:00 -070030 : ManagedRuntimeCallingConvention(is_static, is_synchronized, shorty, kFramePointerSize) {}
Andreas Gampe25ff0042014-03-20 08:34:03 -070031 ~MipsManagedRuntimeCallingConvention() OVERRIDE {}
Brian Carlstrom7940e442013-07-12 13:46:57 -070032 // Calling convention
Andreas Gampe25ff0042014-03-20 08:34:03 -070033 ManagedRegister ReturnRegister() OVERRIDE;
34 ManagedRegister InterproceduralScratchRegister() OVERRIDE;
Brian Carlstrom7940e442013-07-12 13:46:57 -070035 // Managed runtime calling convention
Andreas Gampe25ff0042014-03-20 08:34:03 -070036 ManagedRegister MethodRegister() OVERRIDE;
37 bool IsCurrentParamInRegister() OVERRIDE;
38 bool IsCurrentParamOnStack() OVERRIDE;
39 ManagedRegister CurrentParamRegister() OVERRIDE;
40 FrameOffset CurrentParamStackOffset() OVERRIDE;
Dmitry Petrochenkofca82202014-03-21 11:21:37 +070041 const ManagedRegisterEntrySpills& EntrySpills() OVERRIDE;
Brian Carlstrom7940e442013-07-12 13:46:57 -070042
43 private:
Dmitry Petrochenkofca82202014-03-21 11:21:37 +070044 ManagedRegisterEntrySpills entry_spills_;
Brian Carlstrom7940e442013-07-12 13:46:57 -070045
46 DISALLOW_COPY_AND_ASSIGN(MipsManagedRuntimeCallingConvention);
47};
48
Andreas Gampe25ff0042014-03-20 08:34:03 -070049class MipsJniCallingConvention FINAL : public JniCallingConvention {
Brian Carlstrom7940e442013-07-12 13:46:57 -070050 public:
Roland Levillain3887c462015-08-12 18:15:42 +010051 MipsJniCallingConvention(bool is_static, bool is_synchronized, const char* shorty);
Andreas Gampe25ff0042014-03-20 08:34:03 -070052 ~MipsJniCallingConvention() OVERRIDE {}
Brian Carlstrom7940e442013-07-12 13:46:57 -070053 // Calling convention
Andreas Gampe25ff0042014-03-20 08:34:03 -070054 ManagedRegister ReturnRegister() OVERRIDE;
55 ManagedRegister IntReturnRegister() OVERRIDE;
56 ManagedRegister InterproceduralScratchRegister() OVERRIDE;
Brian Carlstrom7940e442013-07-12 13:46:57 -070057 // JNI calling convention
Andreas Gampe25ff0042014-03-20 08:34:03 -070058 void Next() OVERRIDE; // Override default behavior for AAPCS
59 size_t FrameSize() OVERRIDE;
60 size_t OutArgSize() OVERRIDE;
Vladimir Marko32248382016-05-19 10:37:24 +010061 ArrayRef<const ManagedRegister> CalleeSaveRegisters() const OVERRIDE;
Andreas Gampe25ff0042014-03-20 08:34:03 -070062 ManagedRegister ReturnScratchRegister() const OVERRIDE;
63 uint32_t CoreSpillMask() const OVERRIDE;
Vladimir Marko32248382016-05-19 10:37:24 +010064 uint32_t FpSpillMask() const OVERRIDE;
Andreas Gampe25ff0042014-03-20 08:34:03 -070065 bool IsCurrentParamInRegister() OVERRIDE;
66 bool IsCurrentParamOnStack() OVERRIDE;
67 ManagedRegister CurrentParamRegister() OVERRIDE;
68 FrameOffset CurrentParamStackOffset() OVERRIDE;
Brian Carlstrom7940e442013-07-12 13:46:57 -070069
Andreas Gamped1104322014-05-01 14:38:56 -070070 // Mips does not need to extend small return types.
71 bool RequiresSmallResultTypeExtension() const OVERRIDE {
72 return false;
73 }
74
Brian Carlstrom7940e442013-07-12 13:46:57 -070075 protected:
Andreas Gampe25ff0042014-03-20 08:34:03 -070076 size_t NumberOfOutgoingStackArgs() OVERRIDE;
Brian Carlstrom7940e442013-07-12 13:46:57 -070077
78 private:
Brian Carlstrom7940e442013-07-12 13:46:57 -070079 // Padding to ensure longs and doubles are not split in AAPCS
80 size_t padding_;
81
82 DISALLOW_COPY_AND_ASSIGN(MipsJniCallingConvention);
83};
Andreas Gampe25ff0042014-03-20 08:34:03 -070084
Brian Carlstrom7940e442013-07-12 13:46:57 -070085} // namespace mips
86} // namespace art
87
Brian Carlstromfc0e3212013-07-17 14:40:12 -070088#endif // ART_COMPILER_JNI_QUICK_MIPS_CALLING_CONVENTION_MIPS_H_