MipsMachineFunction.h revision d47aa3adbef5ee2343b61c96292454f3a5b77dbc
1//===-- MipsMachineFunctionInfo.h - Private data used for Mips ----*- C++ -*-=//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// 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 "MipsSubtarget.h"
18#include "llvm/CodeGen/MachineFrameInfo.h"
19#include "llvm/CodeGen/MachineFunction.h"
20#include "llvm/Target/TargetFrameLowering.h"
21#include "llvm/Target/TargetMachine.h"
22#include <utility>
23
24namespace llvm {
25
26/// MipsFunctionInfo - This class is derived from MachineFunction private
27/// Mips target-specific information for each MachineFunction.
28class MipsFunctionInfo : public MachineFunctionInfo {
29public:
30  MipsFunctionInfo(MachineFunction& MF)
31   : MF(MF), SRetReturnReg(0), GlobalBaseReg(0), Mips16SPAliasReg(0),
32     VarArgsFrameIndex(0), CallsEhReturn(false)
33  {}
34
35  unsigned getSRetReturnReg() const { return SRetReturnReg; }
36  void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; }
37
38  bool globalBaseRegSet() const;
39  unsigned getGlobalBaseReg();
40
41  bool mips16SPAliasRegSet() const;
42  unsigned getMips16SPAliasReg();
43
44  int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
45  void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
46
47  bool hasByvalArg() const { return HasByvalArg; }
48  void setFormalArgInfo(unsigned Size, bool HasByval) {
49    IncomingArgSize = Size;
50    HasByvalArg = HasByval;
51  }
52
53  unsigned getIncomingArgSize() const { return IncomingArgSize; }
54
55  bool callsEhReturn() const { return CallsEhReturn; }
56  void setCallsEhReturn() { CallsEhReturn = true; }
57
58  void createEhDataRegsFI();
59  int getEhDataRegFI(unsigned Reg) const { return EhDataRegFI[Reg]; }
60  bool isEhDataRegFI(int FI) const;
61
62private:
63  virtual void anchor();
64
65  MachineFunction& MF;
66  /// SRetReturnReg - Some subtargets require that sret lowering includes
67  /// returning the value of the returned struct in a register. This field
68  /// holds the virtual register into which the sret argument is passed.
69  unsigned SRetReturnReg;
70
71  /// GlobalBaseReg - keeps track of the virtual register initialized for
72  /// use as the global base register. This is used for PIC in some PIC
73  /// relocation models.
74  unsigned GlobalBaseReg;
75
76  /// Mips16SPAliasReg - keeps track of the virtual register initialized for
77  /// use as an alias for SP for use in load/store of halfword/byte from/to
78  /// the stack
79  unsigned Mips16SPAliasReg;
80
81  /// VarArgsFrameIndex - FrameIndex for start of varargs area.
82  int VarArgsFrameIndex;
83
84  /// True if function has a byval argument.
85  bool HasByvalArg;
86
87  /// Size of incoming argument area.
88  unsigned IncomingArgSize;
89
90  /// CallsEhReturn - Whether the function calls llvm.eh.return.
91  bool CallsEhReturn;
92
93  /// Frame objects for spilling eh data registers.
94  int EhDataRegFI[4];
95};
96
97} // end of namespace llvm
98
99#endif // MIPS_MACHINE_FUNCTION_INFO_H
100