blob: c26591704e11567999d5804993966c0ff2ba6b0a [file] [log] [blame]
Ian Rogers2c8f6532011-09-02 17:16:34 -07001// 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
8namespace art {
9namespace x86 {
10
11class X86ManagedRuntimeCallingConvention : public ManagedRuntimeCallingConvention {
12 public:
Ian Rogers169c9a72011-11-13 20:13:17 -080013 explicit X86ManagedRuntimeCallingConvention(bool is_static, bool is_synchronized,
14 const char* shorty) :
15 ManagedRuntimeCallingConvention(is_static, is_synchronized, shorty) {}
Ian Rogers2c8f6532011-09-02 17:16:34 -070016 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
31class X86JniCallingConvention : public JniCallingConvention {
32 public:
Ian Rogers169c9a72011-11-13 20:13:17 -080033 X86JniCallingConvention(bool is_static, bool is_synchronized, const char* shorty) :
34 JniCallingConvention(is_static, is_synchronized, shorty) {}
Ian Rogers2c8f6532011-09-02 17:16:34 -070035 virtual ~X86JniCallingConvention() {}
36 // Calling convention
37 virtual ManagedRegister ReturnRegister();
38 virtual ManagedRegister InterproceduralScratchRegister();
39 // JNI calling convention
40 virtual size_t FrameSize();
Ian Rogers2c8f6532011-09-02 17:16:34 -070041 virtual size_t OutArgSize();
Ian Rogersbdb03912011-09-14 00:55:44 -070042 virtual const std::vector<ManagedRegister>& CalleeSaveRegisters() const {
43 DCHECK(callee_save_regs_.empty());
44 return callee_save_regs_;
45 }
Ian Rogersdc51b792011-09-22 20:41:37 -070046 virtual ManagedRegister ReturnScratchRegister() const;
Ian Rogersbdb03912011-09-14 00:55:44 -070047 virtual uint32_t CoreSpillMask() const {
48 return 0;
49 }
50 virtual uint32_t FpSpillMask() const {
51 return 0;
52 }
Ian Rogersad42e132011-09-17 20:23:33 -070053 virtual bool IsMethodRegisterClobberedPreCall();
Ian Rogers2c8f6532011-09-02 17:16:34 -070054 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 Rogersbdb03912011-09-14 00:55:44 -070063 static std::vector<ManagedRegister> callee_save_regs_;
64
Ian Rogers2c8f6532011-09-02 17:16:34 -070065 DISALLOW_COPY_AND_ASSIGN(X86JniCallingConvention);
66};
67
68} // namespace x86
69} // namespace art
70
71#endif // ART_SRC_CALLING_CONVENTION_X86_H_