Added MipsMachineFunction class, to hold Mips dinamic stack info when inserting Prolo...
[oota-llvm.git] / lib / Target / Mips / MipsMachineFunction.h
1 //===-- MipsMachineFunctionInfo.h - Private data used for Mips ----*- C++ -*-=//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Bruno Cardoso Lopes and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the Mips specific subclass of MachineFunctionInfo.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef MIPS_MACHINE_FUNCTION_INFO_H
15 #define MIPS_MACHINE_FUNCTION_INFO_H
16
17 #include "llvm/CodeGen/MachineFunction.h"
18
19 namespace llvm {
20
21 /// MipsFunctionInfo - This class is derived from MachineFunction private
22 /// Mips target-specific information for each MachineFunction.
23 class MipsFunctionInfo : public MachineFunctionInfo {
24
25 private:
26   /// Holds for each function where on the stack 
27   /// the Frame Pointer must be saved
28   int FPStackOffset;
29
30   /// Holds for each function where on the stack 
31   /// the Return Address must be saved
32   int RAStackOffset;
33
34 public:
35   MipsFunctionInfo(MachineFunction& MF) 
36   : FPStackOffset(0), RAStackOffset(0)
37   {}
38
39   int getFPStackOffset() const { return FPStackOffset; }
40   void setFPStackOffset(int Off) { FPStackOffset = Off; }
41
42   int getRAStackOffset() const { return RAStackOffset; }
43   void setRAStackOffset(int Off) { RAStackOffset = Off; }
44
45   int getTopSavedRegOffset() const { 
46     return (RAStackOffset > FPStackOffset) ? 
47            (RAStackOffset) : (FPStackOffset);
48   }
49 };
50
51 } // end of namespace llvm
52
53
54 #endif