Ugh, the old sparc backend attaches MachineCodeForInstruction annotations on
[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 #include <cstdlib>
18
19 namespace llvm {
20
21 class MachineFunction;
22
23 struct TargetFrameInfo {
24   enum StackDirection {
25     StackGrowsUp,        // Adding to the stack increases the stack address
26     StackGrowsDown       // Adding to the stack decreases the stack address
27   };
28 private:
29   StackDirection StackDir;
30   unsigned StackAlignment;
31   int LocalAreaOffset;
32 public:
33   TargetFrameInfo(StackDirection D, unsigned StackAl, int LAO)
34     : StackDir(D), StackAlignment(StackAl), LocalAreaOffset(LAO) {}
35
36   // These methods return information that describes the abstract stack layout
37   // of the target machine.
38
39   /// getStackGrowthDirection - Return the direction the stack grows
40   ///
41   StackDirection getStackGrowthDirection() const { return StackDir; }
42
43   /// getStackAlignment - This method returns the number of bytes that the stack
44   /// pointer must be aligned to.  Typically, this is the largest alignment for
45   /// any data object in the target.
46   ///
47   unsigned getStackAlignment() const { return StackAlignment; }
48
49   /// getOffsetOfLocalArea - This method returns the offset of the local area
50   /// from the stack pointer on entrance to a function.
51   ///
52   int getOffsetOfLocalArea() const { return LocalAreaOffset; }
53
54   //===--------------------------------------------------------------------===//
55   // These methods provide details of the stack frame used by Sparc, thus they
56   // are Sparc specific.
57   //===--------------------------------------------------------------------===//
58
59   virtual int  getStackFrameSizeAlignment       () const { abort(); }
60   virtual int  getMinStackFrameSize             () const { abort(); }
61   virtual int  getNumFixedOutgoingArgs          () const { abort(); }
62   virtual int  getSizeOfEachArgOnStack          () const { abort(); }
63   virtual bool argsOnStackHaveFixedSize         () const { abort(); }
64
65   // This method adjusts a stack offset to meet alignment rules of target.
66   virtual int adjustAlignment(int unalignedOffset, bool growUp,
67                               unsigned align) const { abort(); }
68
69   // These methods compute offsets using the frame contents for a particular
70   // function.  The frame contents are obtained from the MachineFunction object
71   // for the given function.  The rest must be implemented by the
72   // machine-specific subclass.
73   // 
74   virtual int getIncomingArgOffset              (MachineFunction& mcInfo,
75                                                  unsigned argNum)const{abort();}
76   virtual int getOutgoingArgOffset              (MachineFunction& mcInfo,
77                                                  unsigned argNum)const{abort();}
78   
79   virtual int getFirstIncomingArgOffset         (MachineFunction& mcInfo,
80                                                  bool& growUp) const { abort();}
81   virtual int getFirstOutgoingArgOffset         (MachineFunction& mcInfo,
82                                                  bool& growUp) const {abort();}
83   virtual int getFirstOptionalOutgoingArgOffset (MachineFunction&,
84                                                  bool& growUp) const {abort();}
85   virtual int getFirstAutomaticVarOffset        (MachineFunction& mcInfo,
86                                                  bool& growUp) const {abort();}
87   virtual int getRegSpillAreaOffset             (MachineFunction& mcInfo,
88                                                  bool& growUp) const {abort();}
89   virtual int getTmpAreaOffset                  (MachineFunction& mcInfo,
90                                                  bool& growUp) const {abort();}
91   virtual int getDynamicAreaOffset              (MachineFunction& mcInfo,
92                                                  bool& growUp) const {abort();}
93
94   //
95   // These methods specify the base register used for each stack area
96   // (generally FP or SP)
97   // 
98   virtual int getIncomingArgBaseRegNum()               const { abort(); }
99   virtual int getOutgoingArgBaseRegNum()               const { abort(); }
100   virtual int getOptionalOutgoingArgBaseRegNum()       const { abort(); }
101   virtual int getAutomaticVarBaseRegNum()              const { abort(); }
102   virtual int getRegSpillAreaBaseRegNum()              const { abort(); }
103   virtual int getDynamicAreaBaseRegNum()               const { abort(); }
104 };
105
106 } // End llvm namespace
107
108 #endif