Ian Rogers | 2c8f653 | 2011-09-02 17:16:34 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #ifndef ART_SRC_CALLING_CONVENTION_X86_H_ |
| 4 | #define ART_SRC_CALLING_CONVENTION_X86_H_ |
| 5 | |
| 6 | #include "calling_convention.h" |
| 7 | |
| 8 | namespace art { |
| 9 | namespace x86 { |
| 10 | |
| 11 | class X86ManagedRuntimeCallingConvention : public ManagedRuntimeCallingConvention { |
| 12 | public: |
Ian Rogers | 169c9a7 | 2011-11-13 20:13:17 -0800 | [diff] [blame] | 13 | explicit X86ManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, |
| 14 | const char* shorty) : |
| 15 | ManagedRuntimeCallingConvention(is_static, is_synchronized, shorty) {} |
Ian Rogers | 2c8f653 | 2011-09-02 17:16:34 -0700 | [diff] [blame] | 16 | virtual ~X86ManagedRuntimeCallingConvention() {} |
| 17 | // Calling convention |
| 18 | virtual ManagedRegister ReturnRegister(); |
| 19 | virtual ManagedRegister InterproceduralScratchRegister(); |
| 20 | // Managed runtime calling convention |
| 21 | virtual ManagedRegister MethodRegister(); |
| 22 | virtual bool IsCurrentParamInRegister(); |
| 23 | virtual bool IsCurrentParamOnStack(); |
| 24 | virtual ManagedRegister CurrentParamRegister(); |
| 25 | virtual FrameOffset CurrentParamStackOffset(); |
| 26 | |
| 27 | private: |
| 28 | DISALLOW_COPY_AND_ASSIGN(X86ManagedRuntimeCallingConvention); |
| 29 | }; |
| 30 | |
| 31 | class X86JniCallingConvention : public JniCallingConvention { |
| 32 | public: |
Ian Rogers | 169c9a7 | 2011-11-13 20:13:17 -0800 | [diff] [blame] | 33 | X86JniCallingConvention(bool is_static, bool is_synchronized, const char* shorty) : |
| 34 | JniCallingConvention(is_static, is_synchronized, shorty) {} |
Ian Rogers | 2c8f653 | 2011-09-02 17:16:34 -0700 | [diff] [blame] | 35 | virtual ~X86JniCallingConvention() {} |
| 36 | // Calling convention |
| 37 | virtual ManagedRegister ReturnRegister(); |
| 38 | virtual ManagedRegister InterproceduralScratchRegister(); |
| 39 | // JNI calling convention |
| 40 | virtual size_t FrameSize(); |
Ian Rogers | 2c8f653 | 2011-09-02 17:16:34 -0700 | [diff] [blame] | 41 | virtual size_t OutArgSize(); |
Ian Rogers | bdb0391 | 2011-09-14 00:55:44 -0700 | [diff] [blame] | 42 | virtual const std::vector<ManagedRegister>& CalleeSaveRegisters() const { |
| 43 | DCHECK(callee_save_regs_.empty()); |
| 44 | return callee_save_regs_; |
| 45 | } |
Ian Rogers | dc51b79 | 2011-09-22 20:41:37 -0700 | [diff] [blame] | 46 | virtual ManagedRegister ReturnScratchRegister() const; |
Ian Rogers | bdb0391 | 2011-09-14 00:55:44 -0700 | [diff] [blame] | 47 | virtual uint32_t CoreSpillMask() const { |
| 48 | return 0; |
| 49 | } |
| 50 | virtual uint32_t FpSpillMask() const { |
| 51 | return 0; |
| 52 | } |
Ian Rogers | ad42e13 | 2011-09-17 20:23:33 -0700 | [diff] [blame] | 53 | virtual bool IsMethodRegisterClobberedPreCall(); |
Ian Rogers | 2c8f653 | 2011-09-02 17:16:34 -0700 | [diff] [blame] | 54 | virtual bool IsCurrentParamInRegister(); |
| 55 | virtual bool IsCurrentParamOnStack(); |
| 56 | virtual ManagedRegister CurrentParamRegister(); |
| 57 | virtual FrameOffset CurrentParamStackOffset(); |
| 58 | |
| 59 | protected: |
| 60 | virtual size_t NumberOfOutgoingStackArgs(); |
| 61 | |
| 62 | private: |
Ian Rogers | bdb0391 | 2011-09-14 00:55:44 -0700 | [diff] [blame] | 63 | static std::vector<ManagedRegister> callee_save_regs_; |
| 64 | |
Ian Rogers | 2c8f653 | 2011-09-02 17:16:34 -0700 | [diff] [blame] | 65 | DISALLOW_COPY_AND_ASSIGN(X86JniCallingConvention); |
| 66 | }; |
| 67 | |
| 68 | } // namespace x86 |
| 69 | } // namespace art |
| 70 | |
| 71 | #endif // ART_SRC_CALLING_CONVENTION_X86_H_ |