659955cdfba42a30c6497fad8dc51231d30a921c
[oota-llvm.git] / include / llvm / Target / TargetFrameInfo.h
1 //===-- llvm/CodeGen/MachineFrameInfo.h -------------------------*- C++ -*-===//
2 //
3 // Interface to layout of stack frame on target machine.
4 //
5 //===----------------------------------------------------------------------===//
6
7 #ifndef LLVM_CODEGEN_FRAMEINFO_H
8 #define LLVM_CODEGEN_FRAMEINFO_H
9
10 #include "Support/NonCopyable.h"
11 #include <vector>
12
13 class MachineCodeForMethod;
14 class TargetMachine;
15
16 struct MachineFrameInfo : public NonCopyableV {
17   const TargetMachine &target;
18   
19 public:
20   MachineFrameInfo(const TargetMachine& tgt) : target(tgt) {}
21   
22   //
23   // These methods provide constant parameters of the frame layout.
24   // 
25   virtual int  getStackFrameSizeAlignment       () const = 0;
26   virtual int  getMinStackFrameSize             () const = 0;
27   virtual int  getNumFixedOutgoingArgs          () const = 0;
28   virtual int  getSizeOfEachArgOnStack          () const = 0;
29   virtual bool argsOnStackHaveFixedSize         () const = 0;
30   
31   //
32   // These methods compute offsets using the frame contents for a
33   // particular method.  The frame contents are obtained from the
34   // MachineCodeInfoForMethod object for the given method.
35   // The first few methods have default machine-independent implementations.
36   // The rest must be implemented by the machine-specific subclass.
37   // 
38   virtual int getIncomingArgOffset              (MachineCodeForMethod& mcInfo,
39                                                  unsigned argNum) const;
40   virtual int getOutgoingArgOffset              (MachineCodeForMethod& mcInfo,
41                                                  unsigned argNum) const;
42   
43   virtual int getFirstIncomingArgOffset         (MachineCodeForMethod& mcInfo,
44                                                  bool& growUp) const=0;
45   virtual int getFirstOutgoingArgOffset         (MachineCodeForMethod& mcInfo,
46                                                  bool& growUp) const=0;
47   virtual int getFirstOptionalOutgoingArgOffset (MachineCodeForMethod&,
48                                                  bool& growUp) const=0;
49   virtual int getFirstAutomaticVarOffset        (MachineCodeForMethod& mcInfo,
50                                                  bool& growUp) const=0;
51   virtual int getRegSpillAreaOffset             (MachineCodeForMethod& mcInfo,
52                                                  bool& growUp) const=0;
53   virtual int getTmpAreaOffset                  (MachineCodeForMethod& mcInfo,
54                                                  bool& growUp) const=0;
55   virtual int getDynamicAreaOffset              (MachineCodeForMethod& mcInfo,
56                                                  bool& growUp) const=0;
57
58   //
59   // These methods specify the base register used for each stack area
60   // (generally FP or SP)
61   // 
62   virtual int getIncomingArgBaseRegNum()               const=0;
63   virtual int getOutgoingArgBaseRegNum()               const=0;
64   virtual int getOptionalOutgoingArgBaseRegNum()       const=0;
65   virtual int getAutomaticVarBaseRegNum()              const=0;
66   virtual int getRegSpillAreaBaseRegNum()              const=0;
67   virtual int getDynamicAreaBaseRegNum()               const=0;
68 };
69
70 #endif