calling_convention_mips64.h revision 542451cc546779f5c67840e105c51205a1b0a8fd
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, bool is_synchronized, const char* shorty); 58 ~Mips64JniCallingConvention() OVERRIDE {} 59 // Calling convention 60 ManagedRegister ReturnRegister() OVERRIDE; 61 ManagedRegister IntReturnRegister() OVERRIDE; 62 ManagedRegister InterproceduralScratchRegister() OVERRIDE; 63 // JNI calling convention 64 size_t FrameSize() OVERRIDE; 65 size_t OutArgSize() OVERRIDE; 66 ArrayRef<const ManagedRegister> CalleeSaveRegisters() const OVERRIDE; 67 ManagedRegister ReturnScratchRegister() const OVERRIDE; 68 uint32_t CoreSpillMask() const OVERRIDE; 69 uint32_t FpSpillMask() const OVERRIDE; 70 bool IsCurrentParamInRegister() OVERRIDE; 71 bool IsCurrentParamOnStack() OVERRIDE; 72 ManagedRegister CurrentParamRegister() OVERRIDE; 73 FrameOffset CurrentParamStackOffset() OVERRIDE; 74 75 // Mips64 does not need to extend small return types. 76 bool RequiresSmallResultTypeExtension() const OVERRIDE { 77 return false; 78 } 79 80 protected: 81 size_t NumberOfOutgoingStackArgs() OVERRIDE; 82 83 private: 84 DISALLOW_COPY_AND_ASSIGN(Mips64JniCallingConvention); 85}; 86 87} // namespace mips64 88} // namespace art 89 90#endif // ART_COMPILER_JNI_QUICK_MIPS64_CALLING_CONVENTION_MIPS64_H_ 91