Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 1 | /* |
| 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 Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_COMPILER_JNI_QUICK_MIPS_CALLING_CONVENTION_MIPS_H_ |
| 18 | #define ART_COMPILER_JNI_QUICK_MIPS_CALLING_CONVENTION_MIPS_H_ |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 19 | |
| 20 | #include "jni/quick/calling_convention.h" |
| 21 | |
| 22 | namespace art { |
| 23 | namespace mips { |
Ian Rogers | 790a6b7 | 2014-04-01 10:36:00 -0700 | [diff] [blame] | 24 | |
| 25 | constexpr size_t kFramePointerSize = 4; |
| 26 | |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 27 | class MipsManagedRuntimeCallingConvention FINAL : public ManagedRuntimeCallingConvention { |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 28 | public: |
| 29 | MipsManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty) |
Ian Rogers | 790a6b7 | 2014-04-01 10:36:00 -0700 | [diff] [blame] | 30 | : ManagedRuntimeCallingConvention(is_static, is_synchronized, shorty, kFramePointerSize) {} |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 31 | ~MipsManagedRuntimeCallingConvention() OVERRIDE {} |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 32 | // Calling convention |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 33 | ManagedRegister ReturnRegister() OVERRIDE; |
| 34 | ManagedRegister InterproceduralScratchRegister() OVERRIDE; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 35 | // Managed runtime calling convention |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 36 | ManagedRegister MethodRegister() OVERRIDE; |
| 37 | bool IsCurrentParamInRegister() OVERRIDE; |
| 38 | bool IsCurrentParamOnStack() OVERRIDE; |
| 39 | ManagedRegister CurrentParamRegister() OVERRIDE; |
| 40 | FrameOffset CurrentParamStackOffset() OVERRIDE; |
Dmitry Petrochenko | fca8220 | 2014-03-21 11:21:37 +0700 | [diff] [blame] | 41 | const ManagedRegisterEntrySpills& EntrySpills() OVERRIDE; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 42 | |
| 43 | private: |
Dmitry Petrochenko | fca8220 | 2014-03-21 11:21:37 +0700 | [diff] [blame] | 44 | ManagedRegisterEntrySpills entry_spills_; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 45 | |
| 46 | DISALLOW_COPY_AND_ASSIGN(MipsManagedRuntimeCallingConvention); |
| 47 | }; |
| 48 | |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 49 | class MipsJniCallingConvention FINAL : public JniCallingConvention { |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 50 | public: |
Roland Levillain | 3887c46 | 2015-08-12 18:15:42 +0100 | [diff] [blame] | 51 | MipsJniCallingConvention(bool is_static, bool is_synchronized, const char* shorty); |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 52 | ~MipsJniCallingConvention() OVERRIDE {} |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 53 | // Calling convention |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 54 | ManagedRegister ReturnRegister() OVERRIDE; |
| 55 | ManagedRegister IntReturnRegister() OVERRIDE; |
| 56 | ManagedRegister InterproceduralScratchRegister() OVERRIDE; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 57 | // JNI calling convention |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 58 | void Next() OVERRIDE; // Override default behavior for AAPCS |
| 59 | size_t FrameSize() OVERRIDE; |
| 60 | size_t OutArgSize() OVERRIDE; |
Vladimir Marko | 3224838 | 2016-05-19 10:37:24 +0100 | [diff] [blame] | 61 | ArrayRef<const ManagedRegister> CalleeSaveRegisters() const OVERRIDE; |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 62 | ManagedRegister ReturnScratchRegister() const OVERRIDE; |
| 63 | uint32_t CoreSpillMask() const OVERRIDE; |
Vladimir Marko | 3224838 | 2016-05-19 10:37:24 +0100 | [diff] [blame] | 64 | uint32_t FpSpillMask() const OVERRIDE; |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 65 | bool IsCurrentParamInRegister() OVERRIDE; |
| 66 | bool IsCurrentParamOnStack() OVERRIDE; |
| 67 | ManagedRegister CurrentParamRegister() OVERRIDE; |
| 68 | FrameOffset CurrentParamStackOffset() OVERRIDE; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 69 | |
Andreas Gampe | d110432 | 2014-05-01 14:38:56 -0700 | [diff] [blame] | 70 | // Mips does not need to extend small return types. |
| 71 | bool RequiresSmallResultTypeExtension() const OVERRIDE { |
| 72 | return false; |
| 73 | } |
| 74 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 75 | protected: |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 76 | size_t NumberOfOutgoingStackArgs() OVERRIDE; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 77 | |
| 78 | private: |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 79 | // Padding to ensure longs and doubles are not split in AAPCS |
| 80 | size_t padding_; |
| 81 | |
| 82 | DISALLOW_COPY_AND_ASSIGN(MipsJniCallingConvention); |
| 83 | }; |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 84 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 85 | } // namespace mips |
| 86 | } // namespace art |
| 87 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 88 | #endif // ART_COMPILER_JNI_QUICK_MIPS_CALLING_CONVENTION_MIPS_H_ |