Delete the V9 specific findOptimalStorageSize method, inlining it into all callers.
[oota-llvm.git] / include / llvm / Target / TargetFrameInfo.h
1 //===-- llvm/Target/TargetFrameInfo.h ---------------------------*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // Interface to describe the layout of a stack frame on the target machine.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_TARGET_TARGETFRAMEINFO_H
15 #define LLVM_TARGET_TARGETFRAMEINFO_H
16
17 namespace llvm {
18
19 class MachineFunction;
20
21 struct TargetFrameInfo {
22   enum StackDirection {
23     StackGrowsUp,        // Adding to the stack increases the stack address
24     StackGrowsDown       // Adding to the stack decreases the stack address
25   };
26 private:
27   StackDirection StackDir;
28   unsigned StackAlignment;
29   int LocalAreaOffset;
30 public:
31   TargetFrameInfo(StackDirection D, unsigned StackAl, int LAO)
32     : StackDir(D), StackAlignment(StackAl), LocalAreaOffset(LAO) {}
33
34   // These methods return information that describes the abstract stack layout
35   // of the target machine.
36
37   /// getStackGrowthDirection - Return the direction the stack grows
38   ///
39   StackDirection getStackGrowthDirection() const { return StackDir; }
40
41   /// getStackAlignment - This method returns the number of bytes that the stack
42   /// pointer must be aligned to.  Typically, this is the largest alignment for
43   /// any data object in the target.
44   ///
45   unsigned getStackAlignment() const { return StackAlignment; }
46
47   /// getOffsetOfLocalArea - This method returns the offset of the local area
48   /// from the stack pointer on entrance to a function.
49   ///
50   int getOffsetOfLocalArea() const { return LocalAreaOffset; }
51
52   //===--------------------------------------------------------------------===//
53   // These methods provide details of the stack frame used by Sparc, thus they
54   // are Sparc specific.
55   //===--------------------------------------------------------------------===//
56
57   virtual int  getStackFrameSizeAlignment       () const;
58   virtual int  getMinStackFrameSize             () const;
59   virtual int  getNumFixedOutgoingArgs          () const;
60   virtual int  getSizeOfEachArgOnStack          () const;
61   virtual bool argsOnStackHaveFixedSize         () const;
62
63   // This method adjusts a stack offset to meet alignment rules of target.
64   virtual int adjustAlignment(int unalignedOffset, bool growUp,
65                               unsigned align) const;
66
67   // These methods compute offsets using the frame contents for a particular
68   // function.  The frame contents are obtained from the MachineFunction object
69   // for the given function.  The rest must be implemented by the
70   // machine-specific subclass.
71   // 
72   virtual int getIncomingArgOffset              (MachineFunction& mcInfo,
73                                                  unsigned argNum) const;
74   virtual int getOutgoingArgOffset              (MachineFunction& mcInfo,
75                                                  unsigned argNum) const;
76   
77   virtual int getFirstIncomingArgOffset         (MachineFunction& mcInfo,
78                                                  bool& growUp) const;
79   virtual int getFirstOutgoingArgOffset         (MachineFunction& mcInfo,
80                                                  bool& growUp) const;
81   virtual int getFirstOptionalOutgoingArgOffset (MachineFunction&,
82                                                  bool& growUp) const;
83   virtual int getFirstAutomaticVarOffset        (MachineFunction& mcInfo,
84                                                  bool& growUp) const;
85   virtual int getRegSpillAreaOffset             (MachineFunction& mcInfo,
86                                                  bool& growUp) const;
87   virtual int getTmpAreaOffset                  (MachineFunction& mcInfo,
88                                                  bool& growUp) const;
89   virtual int getDynamicAreaOffset              (MachineFunction& mcInfo,
90                                                  bool& growUp) const;
91
92   //
93   // These methods specify the base register used for each stack area
94   // (generally FP or SP)
95   // 
96   virtual int getIncomingArgBaseRegNum()               const;
97   virtual int getOutgoingArgBaseRegNum()               const;
98   virtual int getOptionalOutgoingArgBaseRegNum()       const;
99   virtual int getAutomaticVarBaseRegNum()              const;
100   virtual int getRegSpillAreaBaseRegNum()              const;
101   virtual int getDynamicAreaBaseRegNum()               const;
102 };
103
104 } // End llvm namespace
105
106 #endif